alexmurray / emacs-snap

GNU Emacs in a snap
https://snapcraft.io/emacs
71 stars 13 forks source link

For "edge" channel with native compilation, doom emacs does not work. #28

Closed ilyagr closed 3 years ago

ilyagr commented 3 years ago

I tried out the edge channel of the emacs snap, hoping for everything to be magically faster because of native compilation. It didn't work for me. I'm in no particular rush to use it, but I thought I'd file this in case it turns out to be simple to reproduce and fix.

I had this version of emacs snap installed on Debian 10 (running on Crostini/Chrome OS i386, though I don't think that matters):

edge:      28.0.50-native-comp-7ba816e 2021-03-21 (1083) 221MB classic

Doom emacs was at current head (https://github.com/hlissner/doom-emacs/commit/5b3f52f5fb98cc3af653b043d809254cebe04e6a, from Mar 22).

I had problems very similar to https://github.com/d12frosted/homebrew-emacs-plus/issues/288: Doom can't install its packages, and all doom commands fail. This happens even if I remove .local and start fresh. See also https://github.com/hlissner/doom-emacs/issues/4469. Doom emacs tries to take full advantage of native compilation and compile all the packages.

Apparently, when not using snaps, people fixed similar problems by recompiling gcc. I assume that's part of the snap, so I can't do it.

Here is the output I get:

$ doom doctor
Installing straight...
Native compiler error: (lambda (arg21 &rest arg22) (let ((f #'message)) (apply f arg21 arg22))), "Compiling /home/ilyagr/.local/app/doom-emacs/.local/cache/eln/28.0.50-93c9a8b7/subr--trampoline-6d657373616765_message_0.eln...
ld: cannot find crtbeginS.o: No such file or directory
ld: cannot find -lgcc
ld: cannot find -lgcc_s
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice \"failed to compile\" \"/home/ilyagr/.local/app/doom-emacs/.local/cache/el...\" \"error invoking gcc driver\")
  comp--compile-ctxt-to-file(\"/home/ilyagr/.local/app/doom-emacs/.local/cache/el...\")
  comp-compile-ctxt-to-file(\"/home/ilyagr/.local/app/doom-emacs/.local/cache/el...\")
  comp-final1()
  eval-buffer(#<buffer  *load*> nil \"/tmp/emacs-int-comp-subr--trampoline-6d65737361676...\" nil t)  ; Reading at buffer position 7356
  load-with-code-conversion(\"/tmp/emacs-int-comp-subr--trampoline-6d65737361676...\" \"/tmp/emacs-int-comp-subr--trampoline-6d65737361676...\" nil t)
  load(\"/tmp/emacs-int-comp-subr--trampoline-6d65737361676...\" nil t)
  command-line-1((\"-l\" \"/tmp/emacs-int-comp-subr--trampoline-6d65737361676...\"))
  command-line()
  normal-top-level()

"
ilyagr commented 3 years ago

I see this might be a duplicate of https://github.com/alexmurray/emacs-snap/issues/22 and https://github.com/hlissner/doom-emacs/issues/4198, though the symptoms are slightly different. If I get around to trying the fix suggested in #22 (removing --no-site-lisp) or the more complicated fixes suggested in the other issue, I'll report the result here.

egh commented 3 years ago

version; 28.0.50-native-comp-8ed46b7 os; debian testing

I am seeing a similar error. I do not use Doom emacs. Steps to reproduce:

emacs -q
M-x package-install ace-window ;; it's the first package I saw, I assume it would have a problem with other packages too

Expected result: successful compilation.

Actual result (from *Async-native-compile-log* buffer):

Compiling /home/egh/c/dotfiles/home/.emacs.d/elpa/avy-0.5.0/avy.el...

In toplevel form:
avy.el:1528:1: Warning: custom-declare-variable `avy-indent-line-overlay' docstring wider than 80 characters
/usr/bin/ld: cannot find libgcc_s.so.1
collect2: error: ld returned 1 exit status
libgccjit.so: error: error invoking gcc driver
/home/egh/c/dotfiles/home/.emacs.d/elpa/avy-0.5.0/avy.el: Error: Internal native compiler error failed to compile
Compiling /home/egh/.emacs.d/elpa/ace-window-0.10.0/ace-window.el...
Compiling /home/egh/c/dotfiles/home/.emacs.d/elpa/ace-window-0.10.0/ace-window.el...

In toplevel form:
ace-window.el:95:1: Warning: custom-declare-variable `aw-minibuffer-flag' docstring wider than 80 characters

In toplevel form:
ace-window.el:95:1: Warning: custom-declare-variable `aw-minibuffer-flag' docstring wider than 80 characters
ace-window.el:99:1: Warning: custom-declare-variable `aw-ignored-buffers' docstring wider than 80 characters
ace-window.el:104:1: Warning: custom-declare-variable `aw-ignore-on' docstring wider than 80 characters
ace-window.el:138:1: Warning: custom-declare-variable `aw-frame-offset' docstring wider than 80 characters
ace-window.el:143:1: Warning: custom-declare-variable `aw-frame-size' docstring wider than 80 characters
ace-window.el:157:1: Warning: defvar `aw-dispatch-alist' docstring wider than 80 characters
ace-window.el:99:1: Warning: custom-declare-variable `aw-ignored-buffers' docstring wider than 80 characters
ace-window.el:104:1: Warning: custom-declare-variable `aw-ignore-on' docstring wider than 80 characters
ace-window.el:138:1: Warning: custom-declare-variable `aw-frame-offset' docstring wider than 80 characters
ace-window.el:143:1: Warning: custom-declare-variable `aw-frame-size' docstring wider than 80 characters
ace-window.el:157:1: Warning: defvar `aw-dispatch-alist' docstring wider than 80 characters
ace-window.el:191:1: Warning: custom-declare-variable `aw-make-frame-char' docstring wider than 80 characters
ace-window.el:191:1: Warning: custom-declare-variable `aw-make-frame-char' docstring wider than 80 characters
/usr/bin/ld: cannot find libgcc_s.so.1
/usr/bin/ld: cannot find libgcc_s.so.1
collect2: error: ld returned 1 exit status
libgccjit.so: error: error invoking gcc driver
/home/egh/c/dotfiles/home/.emacs.d/elpa/ace-window-0.10.0/ace-window.el: Error: Internal native compiler error failed to compile
collect2: error: ld returned 1 exit status
libgccjit.so: error: error invoking gcc driver
/home/egh/.emacs.d/elpa/ace-window-0.10.0/ace-window.el: Error: Internal native compiler error failed to compile
Compilation finished.
Compilation finished.

For the record, not sure if it matters:

🤔 dpkg -S libgcc_s.so.1
libgcc-s1:amd64: /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc-s1:i386: /lib/i386-linux-gnu/libgcc_s.so.1
alexmurray commented 3 years ago

@egh thanks for the detailed info - I believe this should be fixed as of https://github.com/alexmurray/emacs-snap/commit/fd5494be11bab5c602560e82aa8b77c39d8f5734 - I have triggered a rebuild which should be available in the edge channel in an hour or so... let me know if this resolves things for you (I tested it in a clean debian testing VM and it worked for me with these changes)

egh commented 3 years ago

@alexmurray This seems to fix the issue for me, thank you!

ilyagr commented 3 years ago

I'm still getting exactly the same error with the following snap version

  edge:      28.0.50-native-comp-b064ddd 2021-04-14 (1107) 209MB classic

and doom emacs at https://github.com/hlissner/doom-emacs/commit/2d140a7a8.

alexmurray commented 3 years ago

Did the change to remove --no-site-lisp work for you? There is not much I can do about this as if doom is ignoring site-lisp then the snap won't function correctly - it needs this to setup the environment correctly etc.

ilyagr commented 3 years ago

Ah, yes, doom emacs installs itself and starts up fine after removing --no-site-lisp from bin/doom as suggested in https://github.com/alexmurray/emacs-snap/issues/22#issuecomment-720217524. Thank you!

alexmurray commented 3 years ago

Excellent, I will close this issue then now.