alexmurray / emacs-snap

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

emacs 28 native compiler error #30

Closed lrstott closed 3 years ago

lrstott commented 3 years ago

Emacs gcc compile error Ubuntu 20.04 up to date snap: snap-id: 4gE2S31SnK2LeqsZF8XTPuHOlqlzbqsW tracking: latest/edge refresh-date: today at 08:26 CDT channels: latest/stable: 27.2 2021-04-07 (1090) 165MB classic latest/candidate: 27.2 2021-04-07 (1090) 165MB classic latest/beta: 27.2 2021-04-30 (1120) 184MB classic latest/edge: 28.0.50-master-4f510f6 2021-05-16 (1142) 282MB classic installed: 28.0.50-master-4f510f6 (1142) 282MB classic

Error in emacs: Warning (initialization): An error occurred while loading ‘/home/rich/emacs/5/.config/emacs/init.el’:

Native compiler error: (lambda (arg0 &optional) (let ((f #'yes-or-no-p)) (funcall f arg0))), Compiling /home/rich/emacs/5/.config/emacs/eln-cache/28.0.50-ddb1f269/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_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/rich/emacs/5/.config/emacs/eln-cache/28.0.50..." "error invoking gcc driver") comp--compile-ctxt-to-file("/home/rich/emacs/5/.config/emacs/eln-cache/28.0.50...") comp-compile-ctxt-to-file("/home/rich/emacs/5/.config/emacs/eln-cache/28.0.50...") comp-final1() load-with-code-conversion("/tmp/emacs-int-comp-subr--trampoline-7965732d6f722..." "/tmp/emacs-int-comp-subr--trampoline-7965732d6f722..." nil t) command-line-1(("-l" "/tmp/emacs-int-comp-subr--trampoline-7965732d6f722...")) command-line() normal-top-level()

To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the ‘--debug-init’ option to view a complete error backtrace. Disable showing Disable logging Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging Warning (comp): /home/rich/emacs/5/.config/emacs/elpa/use-package-20210106.2145/use-package-core.el: Error: Internal native compiler error failed to compile Disable showing Disable logging Warning (comp): bind-key.el:134:20: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode' Disable showing Disable logging Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging Warning (comp): /home/rich/emacs/5/.config/emacs/elpa/use-package-20210106.2145/use-package-bind-key.el: Error: Internal native compiler error failed to compile Disable showing Disable logging Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging Warning (comp): /home/rich/emacs/5/.config/emacs/elpa/bind-key-20200805.1727/bind-key.el: Error: Internal native compiler error failed to compile Disable showing Disable logging Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging Warning (comp): /home/rich/emacs/5/.config/emacs/elpa/use-package-20210106.2145/use-package-diminish.el: Error: Internal native compiler error failed to compile Disable showing Disable logging Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging Warning (comp): /home/rich/emacs/5/.config/emacs/elpa/use-package-20210106.2145/use-package-delight.el: Error: Internal native compiler error failed to compile Disable showing Disable logging Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging Warning (comp): /home/rich/emacs/5/.config/emacs/elpa/use-package-20210106.2145/use-package-ensure.el: Error: Internal native compiler error failed to compile Disable showing Disable logging

alexmurray commented 3 years ago

Thanks for reporting this issue - this is fixed via the above commit and new builds have been released to the edge channel so a simple snap refresh emacs should fix this for you.

lrstott commented 3 years ago

Thank you! All is good now.

swarnendubiswas commented 3 years ago

I installed the Sep 27 edge build, and I am again getting this issue on an Ubuntu 20.04 LTS system. Is there a way to resolve it?

alexmurray commented 2 years ago

@swarnendubiswas I can't reproduce any failures - I installed the edge channel emacs snap on a fresh Ubuntu 20.04 LTS VM and then installed say ace-window from ELPA and there were no issues with native compilation. Can you please provide more details?

swarnendubiswas commented 2 years ago

I installed successfully on Ubuntu 20.04. I get the following error when I start Emacs.

Warning (initialization): An error occurred while loading `/home/swarnendu/.emacs.d/init.el':

Native compiler error: (lambda (arg0 &optional) (let ((f #'yes-or-no-p)) (funcall f arg0))), Compiling /home/swarnendu/.emacs.d/eln-cach\
e/28.0.60-ca671949/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_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/swarnendu/.emacs.d/eln-cache/28.0.60-ca67194..." "error invoking gc\
c driver")
  comp--compile-ctxt-to-file("/home/swarnendu/.emacs.d/eln-cache/28.0.60-ca67194...")
  comp-compile-ctxt-to-file("/home/swarnendu/.emacs.d/eln-cache/28.0.60-ca67194...")
  comp-final1()
  load-with-code-conversion("/tmp/emacs-int-comp-subr--trampoline-7965732d6f722..." "/tmp/emacs-int-comp-subr--trampoline-7965732d6f722.\
.." nil t)
  command-line-1(("-l" "/tmp/emacs-int-comp-subr--trampoline-7965732d6f722..."))
  command-line()
  normal-top-level()

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace. Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /home/swarnendu/.emacs.d/elpa/use-package-20210207.1926/use-package-core.el: Error: Internal native compiler error faile\
d to compile Disable showing Disable logging
Warning (comp): bind-key.el:134:20: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode' Disable sho\
wing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /home/swarnendu/.emacs.d/elpa/use-package-20210207.1926/use-package-diminish.el: Error: Internal native compiler error f\
ailed to compile Disable showing Disable logging
...

I have a standard install, so I am unsure why I get the error.

benjamin-rood commented 2 years ago

I started getting this today, too. Native-compile

File mode specification error: (native-compiler-error (lambda (arg10 &optional arg11 arg12 arg13 arg14) (let ((f #'load)) (funcall f arg10 arg11 arg12 arg13 arg14))) Compiling /home/br/.emacs.d/eln-cache/28.1-6071d483/subr--trampoline-6c6f6164_load_0.eln...
ld: cannot find crti.o: No such file or directory
ld: cannot find crtbeginS.o: No such file or directory
ld: cannot find -lgcc
ld: cannot find -lgcc_s
ld: cannot find -lc
ld: cannot find -lgcc
ld: cannot find -lgcc_s
ld: cannot find crtendS.o: No such file or directory
ld: cannot find crtn.o: No such file or directory
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice "failed to compile" "/home/br/.emacs.d/eln-cache/28.1-6071d483/subr--tr..." "error invoking gcc driver")
  comp--compile-ctxt-to-file("/home/br/.emacs.d/eln-cache/28.1-6071d483/subr--tr...")
  comp-compile-ctxt-to-file("/home/br/.emacs.d/eln-cache/28.1-6071d483/subr--tr...")
  comp-final1()
  load-with-code-conversion("/tmp/emacs-int-comp-subr--trampoline-6c6f6164_load..." "/tmp/emacs-int-comp-subr--trampoline-6c6f6164_load..." nil t)
  command-line-1(("-l" "/tmp/emacs-int-comp-subr--trampoline-6c6f6164_load..."))
  command-line()
  normal-top-level()

)
Beginning of buffer
comp--native-compile: Native compiler error: (lambda (arg17 &optional arg18) (let ((f #'x-focus-frame)) (funcall f arg17 arg18))), "Compiling /home/br/.emacs.d/eln-cache/28.1-6071d483/subr--trampoline-782d666f6375732d6672616d65_x_focus_frame_0.eln...
ld: cannot find crti.o: No such file or directory
ld: cannot find crtbeginS.o: No such file or directory
ld: cannot find -lgcc
ld: cannot find -lgcc_s
ld: cannot find -lc
ld: cannot find -lgcc
ld: cannot find -lgcc_s
ld: cannot find crtendS.o: No such file or directory
ld: cannot find crtn.o: No such file or directory
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice \"failed to compile\" \"/home/br/.emacs.d/eln-cache/28.1-6071d483/subr--tr...\" \"error invoking gcc driver\")
  comp--compile-ctxt-to-file(\"/home/br/.emacs.d/eln-cache/28.1-6071d483/subr--tr...\")
  comp-compile-ctxt-to-file(\"/home/br/.emacs.d/eln-cache/28.1-6071d483/subr--tr...\")
  comp-final1()
  load-with-code-conversion(\"/tmp/emacs-int-comp-subr--trampoline-782d666f63757...\" \"/tmp/emacs-int-comp-subr--trampoline-782d666f63757...\" nil t)
  command-line-1((\"-l\" \"/tmp/emacs-int-comp-subr--trampoline-782d666f63757...\"))
  command-line()
  normal-top-level()
"
kirill-gerasimenko-da commented 2 years ago

I started getting this today, too. Native-compile

@benjamin-rood the same happens to me!

benjamin-rood commented 2 years ago

I've had to downgrade to the default emacs from apt which is 27.1

On Mon, 9 May 2022 at 11:55, Kirill Gerasimenko @.***> wrote:

I started getting this today, too. Native-compile

@benjamin-rood https://github.com/benjamin-rood the same happens to me!

— Reply to this email directly, view it on GitHub https://github.com/alexmurray/emacs-snap/issues/30#issuecomment-1120829035, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNCK5G6V2JSEWONVDO4OVDVJDHHVANCNFSM45HA3BOQ . You are receiving this because you were mentioned.Message ID: @.***>

kirill-gerasimenko-da commented 2 years ago

@benjamin-rood You could have just used latest stable from snap with

sudo snap install emacs --classic
alexmurray commented 2 years ago

Can anyone who is facing this error please post the output of:

M-x describe-variable native-comp-driver-options

Thanks.

alexmurray commented 2 years ago

Ok I think that hopefully https://github.com/alexmurray/emacs-snap/commit/58411aad868b697fecb850355518773c5037fb5b and https://github.com/alexmurray/emacs-snap/commit/978719677dcc0dcc73b2fd382657ad9c5330a000 should fix the native compilation errors - apologies for inadvertently reintroducing those.

I have triggered a rebuild of the snap and it should be available in the beta channel in the next couple hours. Can you please test this and let me know if it resolves the issue for you? Thanks.

benjamin-rood commented 2 years ago

@benjamin-rood You could have just used latest stable from snap with

sudo snap install emacs --classic

@kirill-gerasimenko-da The compilation errors are occurring on the stable build, too. That's why I downgraded to 27

kirill-gerasimenko-da commented 2 years ago

oh, said to hear. it helped me though.

idanov commented 1 year ago

These warnings are now showing up on emacs 29, my value for the variable mentioned by @alexmurray is:

("--sysroot=/snap/emacs/1729/" "-B/snap/emacs/1729/usr/lib/gcc/")

Is there something I can do for a workaround?

alexmurray commented 1 year ago

Thanks for letting me know, I'll try take a look on Monday.

idanov commented 1 year ago

Update on the issue, ensuring the Emacs environment has:

export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

This is on Ubuntu 22.04 with installed libgccjit-11-dev.

I stumbled on my solution here, although unsure how relevant that is for this particular snap, but sharing it here in case it helps with resolving the issue.

alexmurray commented 1 year ago

@idanov It shouldn't be needed to set LIBRARY_PATH like this for native-comp (especially to include something from outside the snap) - I am attempting to reproduce the issue now and if I can reproduce it then will work on a fix.

(FWIW setting LIBRARY_PATH like that means that anything emacs invokes will also inherit this - so if you compile a C application from emacs then it will also use this LIBRARY_PATH setting which is perhaps not what you want - also the snap should ship all it's own dependencies and shouldn't require anything to be manually installed on the host system).

alexmurray commented 1 year ago

I am unable to reproduce this error - on a fresh Ubuntu 22.04 VM I ran the following:

sudo apt install libgccjit-11-dev
sudo snap install --beta --classic emacs
emacs

Then within emacs:

M-x package-install
ace-window
C-x b *Async-native-compile-log*
# observe no errors printed

Can you provide any more information?

idanov commented 1 year ago

My Ubuntu was upgraded from 18.04 to 22.04 over the years, so it could be something to do with my own personal version. If you couldn't reproduce it with a fresh Ubuntu VM, then I would assume it's only happening on my own setup. Thanks a lot for following up though @alexmurray 🙏

alexmurray commented 1 year ago

Ok thanks for letting me know - let's leave this closed for now but if it still is an issue for you I can try and help you debug what is going on - please open a separate issue though.