reddit / emacs

ALPHA: Emacs 29 for Windows with AOT Trampolines

mplscorwin · 2022-10-15 18:41
The "snapshot" binaries of Emacs 29 for Windows posted today should be somewhat less fragile while running without GCC/libgccjit (e.g. MSYS2 installed and on the Windows path). [https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-29/?C=M;O=D](https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-29/?C=M;O=D) **Note**: the snapshot is dated Oct 13, 2022, but I posted it today, Oct 15th; took me a few days. The last included commit was cbd04ad3d572850775f18bde868c71abcde733ed. Anyway, this build use a new "trampolines" target for `make`. This target pre-compiles (AOT) trampolines, infrastructure that allows natively compiled elisp to call redefined elisp primitives, which are then included with the installer, zip and no-deps.zip distributables. While redefining primitives is discouraged, it does happen, especially via advice APIs. Including these trampolines should enable installing and running (e.g.) packages that advise elisp primitives. Previously (in all 29 snapshots and GNU windows binary distributions of Emacs 28) that might have failed because Emacs unconditionally creates trampolines on the fly if they do not exist when needed. Precompiling the trampolines should prevent Emacs from triggering async native compilation even when `native-comp-available-p` was returning `nil`, to make them. TIA for bug reports & feedback! PS, in case others are building Emacs with native comp enabled and **not** distributing GCC/libgcc with, the new make target isn't on the Emacs 28 branch (yet). It should be fairly easy to patch it in or manually add something like this to your packaging process after success of `make all`, before `make install` (or `make install-strip` or whtv) (mapatoms (λ (f)             (when (subr-primitive-p (symbol-function f))               (or (comp-trampoline-search f)                   (comp-trampoline-compile f))))) This code comes from message #50 in bug #[58318](https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58318#50), and worked for me (however, the 29 snapshot binaries do use the new make target, now - they don't use the above snippet). Edit: un-mangled the code block
rswgnu · 2022-10-16 02:23
Thanks very much for this.
jcalve34 · 2022-10-16 08:01
Does this type of build need any specific flags? Could you share the build steps?
Thaodan · 2022-10-16 11:59
Just run make trampolines after you do the initial make or during. Something like this: `make NATIVE_FULL_AOT=1 bootstrap trampolines` or: `make NATIVE_FULL_AOT=1 bootstrap; make trampolines`.
mplscorwin · 2022-10-16 16:20
Yup, basically this. FTR, here's my typical process to build and package a new development snapshot: (Starts in \~/emacs-build/git/master, a directory where I've cloned "master") make maintainer-clean ./autogen.sh ./configure --with-modules --without-dbus --with-native-compilation --without-compress-install CFLAGS=-O2 make # this is the new step make trampolines make install -j 20 prefix=/d/emacs-build/install/emacs-29.0.50-snapshot-yyyy-mm-dd FULL_NATIVE_AOT=1 # build finished, now packaging # make a folder to put the files we will upload into mkdir /d/upload/emacs-29.0.50-snapshot-yyyy-mm-dd.zip # move tto the "install" root folder cd /d/emacs-build/install # create the "no-deps" zip zip -r -9 /d/emacs-build/upload/emacs-29.0.50-snapshot-yyyy-mm-dd/emacs-29.0.50-snapshot-yyyy-mm-dd-nodeps.zip ./emacs-29.0.50-snapshot-yyyy-mm-dd # start the main zip as a copy of the cp /d/emacs-build/upload/emacs-29.0.50-snapshot-yyyy-mm-dd/emacs-29.0.50-snapshot-yyyy-mm-dd-nodeps.zip /d/emacs-build/install/emacs-29.0.50-snapshot-yyyy-mm-dd/emacs-29.0.50-snapshot-yyyy-mm-dd.zip # add (previously prepaired) deps into bin folder unzip -d emacs-29.0.50-snapshot-yyyy-mm-dd/bin ~/emacs-build/deps/emacs-29-deps.zip # re-add the bin folder to the full zip version zip -r -9 /d/emacs-build/upload/emacs-29.0.50-snapshot-yyyy-mm-dd/emacs-29.0.50-snapshot-yyyy-mm-dd.zip ./emacs-29.0.50-snapshot-yyyy-mm-dd/bin # rename "installation folder" to ease installer creation mv emacs-29.0.50-snapshot-yyyy-mm-dd emacs-29.0.50 # make the installer cp ~/emacs-build/git/master/admin/nt/dist-build/emacs.nsi . makensis -v4 -DEMACS_VERSION=29.0.50 -DVERSION_BRANCH=29.0.50 -DOUT_VERSION=29.0.50 emacs.nsi # move (and rename) the installer mv emacs-29.0.50-installer.exe ../upload/emacs-29.0.50-snapshot-yyyy-mm-dd/emacs-29.0.50-snapshot-yyyy-mm-dd-installer.exe # make sha1 sums cd ../upload/emacs-29.0.50-snapshot-yyyy-mm-dd sha256sum * > emacs-29.0.50-snapshot-yyyy-mm-dd-sha256sums.txt # and then some junk to FTP to GNU ALPHA...
greg7mdp · 2022-11-13 22:14
Nice, but you still can't install eglot via "Options" / "Manage Emacs Packages", right?
mplscorwin · 2022-11-13 22:23
I have no idea. Probably worth a big report (for eglot, ai assume), if not.