Guideline for building GNU Emacs with MSYS2/MinGW-w64
The following guidelines described how to compile GNU Emacs with MSYS2/MinGW-w64 combination.
Set up the MSYS2/MinGW-w64 build environment
Download the x86_64 version of MSYS2 in here and install in your preferred directory, e.g.
C:\msys64. Note that path containing spaces may causes problems. Run
msys2_shell.bat in the
C:\msys64 and you will see a BASH window opened. In the BASH prompt, use the following command to install the necessary packages:
These packages are:
Build required package
- For various image formats
- For libxml2
- For GnuTLS
Get the source code
Follow the instruction in savannah. Or download the release version in gnu ftp. It should be noted that the the autocrlf feature of git may mess up the configure file. Therefore it is better to disable this feature by running the command:
configure; make; make install
Run mingw64_shell.bat in
C:\msys64. This will open a BASH window for MinGW-w64 environment. In the BASH prompt, chdir to the directory of source code. Then run the following commands to build Emacs and install in
C:\emacs. If you are building the development version, the first line of the commands will be needed.
Note that I disable imagemagick because it breaks the build process.
If all of the above are successfully done, you should have an Emacs installed in
C:\emacs. However, it may not work properly since it depends on DLLs in the MinGW-w64 environment. I use the following command to make sure the DLLs are placed with the execution file:
If you only run Emacs in your PC and your MinGW-w64 binary folder (e.g.
C:\msys64\mingw64\bin) is in PATH the above copy step can be optional.
Double click the runemacs.exe in
C:\emacs\bin. If no errors occur, you have successfully builded the 64-Bit version of GNU Emacs.