11

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?

JFM
  • 185
  • 1
  • 6
  • 2
    I would also appreciate gccemacs on windows. I think about installing it using [msys2/mingw64](https://www.msys2.org/) platform for windows. I once successfully compiled emacs on windows with this platform. By the way, this is the recommended procedure to build emacs on windows (see [INSTALL.W64](https://github.com/emacs-mirror/emacs/blob/master/nt/INSTALL.W64)). I have not yet tried to compile gccemacs the same way. Trouble is that the library `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 – deb2014 Nov 22 '20 at 22:45
  • 1
    I don't have enough reputation to comment on the main answer, but I think that `--with-nativecomp` should be `--with-native-compilation`, based on https://lists.gnu.org/archive/html/emacs-devel/2021-02/msg02011.html. – Alan Apr 27 '21 at 19:31

4 Answers4

7

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.

phils
  • 48,657
  • 3
  • 76
  • 115
deb2014
  • 83
  • 4
  • 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). – Drew Dec 27 '20 at 19:10
  • 1
    You 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 – deb2014 Dec 28 '20 at 14:29
  • Would you have a look into your *.bat lines, please? The last line seems very strange. – Keks Dose Jan 15 '21 at 19:43
  • Is there something like AUR / yay for MSYS, similar to Arch ? I guess I'm asking for a PKGBUILD :D – VanLaser Jan 18 '21 at 08: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 – deb2014 Jan 18 '21 at 15:48
5

Here are unofficial builds https://github.com/kiennq/emacs-build/releases via https://www.emacswiki.org/emacs/GccEmacs

rofrol
  • 186
  • 2
  • 8
2

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.

NickD
  • 27,023
  • 3
  • 23
  • 42
Wolfgang
  • 51
  • 1
  • `source=("emacs-git::git://git.savannah.gnu.org/emacs.git#branch=feature/native-comp")` is no longer needed (and will become stale) as `feature/native-comp` was merged to `master` the other day. See [Emacs commit 289000e](https://git.savannah.gnu.org/gitweb/?p=emacs.git;a=commit;h=289000eee729689b0cf362a21baa40ac7f9506f6) and also https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg01175.html – phils Apr 27 '21 at 05:04
1

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.

Phil Lord
  • 161
  • 3