2

Not sure what's going on, but suddenly Emacs just started byte-compiling native-compiling everything, all Elisp files. No idea how to get it to stop or what caused this. It's doing all the packages too. The laptop I'm on just can't handle this.

How can I prevent this from happening?

Updates:

setting (setq-default no-native-compile t) does not work, not sure if that's a bug in emacs or if that variable is meant for something else.

an alpine dev updated their emacs compilation to include the NATIVE_FULL_AOT=1 flag, which ships a precompiled aot tree in /usr/lib/emacs... but this also does not prevent native compile of everything in /usr/share/emacs/lisp

tbny
  • 51
  • 5
  • 2
    Are you perhaps using Emacs 28 (or 29) with the native-compilation feature enabled? Byte compilation is unlikely to cause you any dramas even on a low-spec machine. Native compilation is another story. If it's that, then you should install or compile Emacs *without* native compilation (noting also that a *default* build will not include this feature). – phils Apr 11 '22 at 05:43
  • That said, native compilation *may* prove to be a boon to you on a low-spec machine *once* everything has been compiled. (But don't then make a habit of updating lots of ELPA packages at once.) – phils Apr 11 '22 at 05:45
  • yea, on alpine, just got the update recently to emacs 28. the elpa packages aren't that bad, but it's doing everything in /usr/share/emacs/28.1/lisp, which is quite a lot. it is the native compilation. i'm just using the standard emacs-x11 package that ships with alpine. so i can't disable this without pulling emacs source and compiling? – tbny Apr 11 '22 at 09:48
  • 1
    I know nothing about Alpine, but I don't think any OS should be *only* building Emacs with-native-compilation -- it should definitely be optional. Check to see if they've provided an alternative package and, if not, raise an upstream issue with them. – phils Apr 11 '22 at 10:21
  • You could try `(setq-default no-native-compile t)`; but if you wish to use Emacs without any native compilation, and there's no package for that, you probably *should* build it yourself. – phils Apr 11 '22 at 10:28
  • 1
    thanks for the responses @phils, i got in touch with folks on their irc, and ended up filing an issue on their gitlab. will try to set that variable and see if it works for this scenario – tbny Apr 11 '22 at 11:29
  • unfortunately due to the hardware i'm on, maintaining my own emacs package is out of the question. and this is all i got. this laptop can barely pull the source for emacs, let alone try to compile it – tbny Apr 11 '22 at 12:09
  • 1
    i can confirm that setting `no-native-compile` does not work for this circumstance of avoiding compiling everything in `/usr/share/emacs/28.1/lisp`, but the devs on alpine are talking about compiling with `NATIVE_FULL_AOT=1`, which should ship with `/usr/share` compiled – tbny Apr 11 '22 at 19:53
  • `no-native-compile` *is* documented as being intended for file-local usage, but I'm a little surprised setting the global value doesn't work as well. Try `(setq native-comp-deferred-compilation nil)` instead? – phils Apr 13 '22 at 10:38
  • And for good measure I'll mention `load-no-native` as well (although that's possibly counter-productive for you). – phils Apr 13 '22 at 10:41

2 Answers2

2

After filing an issue with the distro's git repo and discussing it with a dev, the emacs build is no longer being compiled and shipped with the --with-native-compilation flag. It seems so far that this is the only way to prevent the issue from happening.

update:

another user in the repo issue i filed brought up that we should be able to use (setq comp-deferred-compilation nil) to prevent native compiling of everything under /usr/share/emacs/28.1/lisp, but i have not tested if this actually works

tbny
  • 51
  • 5
  • I do think it would be great for OS package maintainers to introduce new native-compilation packages for Emacs as alternatives to the traditional builds. If they're not already considering that, I'd try suggesting it (on the basis that users with higher-spec hardware may find it a desirable option). – phils Apr 14 '22 at 05:19
  • 1
    as of today, i can see the alpine-linux devs are providing separate builds with native compilation enabled. very thankful for their support. thanks for helping out with the initial befuddlement i experienced with the transition to emacs 28.1 – tbny Apr 15 '22 at 09:00
0

This answer is a little late, perhaps, since the package maintainers have separated out native-comp and non-native-comp builds. But you should be able to prevent all native compilation by adding this to the beginning of early-init.el:

(setq native-comp-speed -1)
JFM
  • 185
  • 1
  • 6