Compiling emacs 23.4 on 64 bit Windows 7
Like most rational people, I don't seek out problems. When I wanted emacs on my Windows 7 notebook, I dutifully downloaded and installed the binary package. My joy did not last when emacs started to balk using tramp on a remote site. The cryptic message suggested that my remote system did not have ls. Of course this was a misleading error, as the real problem was that tramp was broken. I had to compile the latest tramp. After struggling and googling for several days I decided that the best route was to install a full from source package, including a fresh tramp from the latest emacs trunk (as of May 1, 2013).
It turns out that compiling emacs for Windows 7 is straightforward, despite the confusing set of instructions on various well intentioned sites. One of the problems is the fact that these differing instructions date back several years, and they use various combinations of Cygwin, Mingw32, Mysys and/or Microsoft nmake.exe and cl.exe. If you just want emacs working with the minimal prerequisites, you can rely on two projects: gnuwin32 and Strawberry Perl (32 bit). Okay, maybe you need three if you include git. These projects all have fairly simple installers, which was my biggest motivation for turning to them.
- Install git via http://git-scm.com/downloads
- Fetch emacs using git clone git://git.savannah.gnu.org/emacs.git (bzr was too slow).
- I used GetGnuWin32 to install the required libraries. I installed it under c:\gnuwin32
- I fetched Strawberry Perl 188.8.131.52 (32bit) for the C compiler
I'll forgo explaining the pre-requisite installation procedures here, as they are included on the linked download sites. I will note that I elected to put the strawberry perl package (and compiler) under c:\gnuwin32 and to date I have had no problems installing binaries under "c:\Program Files (x86)\emacs-24.3", though worries about spaces in path names prevented me from doing so using a direct "make install", instead I installed to c:\emacs and relocated / renamed that directory to the desired final program files folder.
After installing these requisite packages, my path looked like:
c:\gnuwin32\sbin c:\gnuwin32\libexec c:\gnuwin32\bin c:\program files (x86)\git\cmd c:\gnuwin32\strawberry\c\bin c:\gnuwin32\strawberry\perl\site\bin c:\gnuwin32\strawberry\perl\bin
It's important to use the 32 bit version of Strawberry Perl. After successfully compiling with the 32 bit version, I tried the 64 bit (my Windows 7 is 64 bit). I had no luck (even trying the -m32 flag). In my case the configure script was run from the nt subdirectory of the fetched source tree.
The build batch file below is available here.
rem compiling emacs with strawberry perl *32 bit* rem next line satisfies the searching for libxpm copy c:\gnuwin32\src\simx.h c:\gnuwin32\include\X11\simx.h /y call configure.bat --cflags -isystemc:/GnuWin32/include --no-debug --with-gcc --prefix=c:/emacs make -j 3 XMFLAGS="-j 3" bootstrap make -j 3 XMFLAGS="-j 3" rem AS ADMINISTRATOR make install move c:\emacs "c:\Program Files (x86)\emacs-24.3"
This emacs package works fine with Putty/plink.exe, solving the problem I had with the binary package on my local GNU mirror. The binaries that I compiled are available here (md5sum 26d214accdc8b35fc3bc4cdd545188df).