I use the official binaries (28.0.50 prerelease) for MS Windows. I am using gccemacs on my home Linux machines, and feel like native-comp on Windows would be really useful for me at work. However, I don't have a MingW toolchain installed. Is anyone providing gccemacs binaries for MS-Windows?
4 Answers
Here are unofficial builds https://github.com/kiennq/emacs-build/releases via https://www.emacswiki.org/emacs/GccEmacs
Thanks to many people and their work here, the emacs native-compilation feature is now available on windows 10. Still yet you have to compile it yourself (from the Emacs master branch).
First install msys2/mingw64 and all the required development packages for emacs (see nt/INSTALL.W64 in emacs source). Then install gcc and, of course, libgccjit. This later is now available as a regular mingw64 package.
Then, still following nt/INSTALL.W64 :
./autogen.sh
./configure --without-dbus --without-pop --with-native-compilation --prefix=/your/install/path
make -j$(nproc) # or make NATIVE_FULL_AOT=1 -j$(nproc) // longer
make install
Then create a batch script with :
@ECHO OFF
TITLE Emacs - native-compilation
SET HOME=C:\Users\yourname
C:
CD %HOME%
IF EXIST .emacs.d\server\server DEL .emacs.d\server\server
SET PATH=C:\msys64\mingw64\local\bin;C:\msys64\mingw64\bin;%PATH%
C:\msys64\mingw64\local\bin\emacsclientw.exe -n -a C:\msys64\mingw64\local\bin\runemacs.exe -e "(make-frame-visible)"
And then, you can run it by clicking on the batch script as any other windows 10 program.
I assume your msys64 installation is at C:\msys64 and that emacs - nativecomp is installed at C:\msys64\mingw64\local so as to not interfere with the default emacs 27.1 mingw64 package.
It is mandatory to add "C:\msys64\mingw64\bin" to the windows path because emacs needs some libraries at startup which are in there.
-
While of interest and generally helpful to Emacs users, this doesn't seem to answer the question "Is anyone providing gccemacs binaries for MS-Windows?" at all. It's essentially supplementary commentary (much appreciated, but not an answer).– DrewCommented Dec 27, 2020 at 19:10
-
1You are right but as said, no package at the moment to my knowledge and in the initial message, it is more precisely asked for gccemacs binaries. My answer aimed at showing the author's question how to get some himself. That said, in following days I will try to build a mingw64 package. Regards– deb2014Commented Dec 28, 2020 at 14:29
-
Would you have a look into your *.bat lines, please? The last line seems very strange. Commented Jan 15, 2021 at 19:43
-
Is there something like AUR / yay for MSYS, similar to Arch ? I guess I'm asking for a PKGBUILD :D– VanLaserCommented Jan 18, 2021 at 8:47
-
1@KeksDose : I have updated my answer, the last line is a way to start emacs with windows 10 I borrowed somewhere else, but they are other (simpler) ways– deb2014Commented Jan 18, 2021 at 15:48
There isn't an "official" one at the moment. The windows port is a little flaky right now. Once it has had a bit more time to mature, or once it merges to master there will be an "official" snapshot (if that is not a contradiction in terms) of it.
I created a MINGW PKGBUILD
file for native compilation Emacs. You can find it here. A MINGW package is also available as a pre-release version here.
You can install the pre-release version by using:
# Open mingw shell (e.g. msys2)
pacman -U mingw-w64-x86_64-emacs-native-compilation-*-any.pkg.tar.zst
The request for merging this into MINGW-packages
main fork (thus making Emacs native comp available via MINGW's pacman
) was not approved, because native compilation is still an experimental feature. So for now, I can only provide it on my fork of the MINGW-packages
repository.
-
source=("emacs-git::git://git.savannah.gnu.org/emacs.git#branch=feature/native-comp")
is no longer needed (and will become stale) asfeature/native-comp
was merged tomaster
the other day. See Emacs commit 289000e and also lists.gnu.org/archive/html/emacs-devel/2021-04/msg01175.html– philsCommented Apr 27, 2021 at 5:04
libgccjit
is required, as far as I understand, which I did not find in msys2/mingw64 packages. This library is part of the gcc distribution but, is u--with-nativecomp
should be--with-native-compilation
, based on lists.gnu.org/archive/html/emacs-devel/2021-02/msg02011.html.