Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs fails with libgccjit.so: error invoking gcc driver #360412

Closed
jcowgar opened this issue Nov 30, 2024 · 8 comments · Fixed by #361752
Closed

Emacs fails with libgccjit.so: error invoking gcc driver #360412

jcowgar opened this issue Nov 30, 2024 · 8 comments · Fixed by #361752
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin 6.topic: emacs Text editor

Comments

@jcowgar
Copy link

jcowgar commented Nov 30, 2024

Describe the bug

When installing and then running Emacs, Warnings are emitted in Emacs:

⛔ Warning (native-compiler): libgccjit.so: error: error invoking gcc driver
⛔ Warning (native-compiler): /nix/store/ny5j2ay81dzl931yzfk2wds3k83ygxn0-emacs-30.0.92/share/emacs/site-lisp/site-start.el: Error Internal native compiler error: "failed to compile", "/Users/jeremy/.emacs.d/eln-cache/30.0.92-802b27dc/site-start-f0b9874f-8f4312e0.eln", "error invoking gcc driver"

Prior to execution, there is no ~/.emacs.d, it is created on initial start. I ensured there was no ~/.config/emacs as well. Fresh install, simply emacs.

This report includes screen shots of the emacs30 package, but I have tried straight emacs and emacs29 packages with the exact same result.

This is a warning here and emacs will continue to function however as you begin to add packages or attempt to install tree sitter grammar files, the same error occurs and thus emacs is unusable the moment you need a tree sitter grammar file to provide editing capability for a particular language.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Add pkgs.emacs to configuration.nix

Expected behavior

I expect Emacs to start with no warnings

Screenshots

Screenshot 2024-11-30 at 7 46 47 AM

Additional context

This is on a macOS system using nix-darwin and an aarch64 (M3).

Metadata

  • system: "aarch64-darwin"
  • host os: Darwin 24.1.0, macOS 15.1.1
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.24.10
  • channels(root): "nixpkgs"
  • nixpkgs: /nix/store/7c2g8d7nzs52snmcf5fk5m4nwvnbkqqm-source

Notify maintainers

libgccjit maintainers: @Synthetica9, @vcunat, @Ericson2314
emacs maintainers: @AndersonTorres, @adisbladis, @jwiegley, @lovek323, @matthewbauer


Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

@jcowgar jcowgar added the 0.kind: bug Something is broken label Nov 30, 2024
@samueltardieu samueltardieu added the 6.topic: darwin Running or building packages on Darwin label Nov 30, 2024
@samueltardieu
Copy link
Contributor

I can't reproduce it on Linux, I've tagged it as a Darwin specific issue.

@jcowgar
Copy link
Author

jcowgar commented Nov 30, 2024

I can't reproduce it on Linux, I've tagged it as a Darwin specific issue.

Just as a note, when discussing the issue on discord, another on macOS user added emacs as a system package and received the same problem. So, very possible it is Darwin.

@bestlem
Copy link

bestlem commented Dec 2, 2024

In my emacs 29 in my setup code so not a simple case.
the error is slightly clearer that it is a Darwin issue. with the -lSystem error.

From Async)native-compile-log

Compiling /Users/mark/.emacs.d/site-lisp/Third-party-modified/lispy-mnemonic.el...
ld: library not found for -lSystem
libgccjit.so: error: error invoking gcc driver
/Users/mark/.emacs.d/site-lisp/Third-party-modified/lispy-mnemonic.el: Error: Internal native compiler error failed to compile
Compilation finished.

@jasonjckn
Copy link

jasonjckn commented Dec 3, 2024

I too am able to reproduce this on Darwin with Nix release 24.11, emacs v30 branch, using emacs-overlay and an M4 processor

Compiling /Users/j/.emacs/fm30/.local/straight/build-30.0.92/inheritenv/inheritenv.el...
Warning (evil-collection): Make sure to set `evil-want-keybinding' to nil before loading evil or evil-collection.

See https://github.com/emacs-evil/evil-collection/issues/60 for more details.
ld: library not found for -lSystem
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/inheritenv/inheritenv.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/inheritenv-4086f0b4-cde89279.eln", "error invoking gcc driver"
ld: library not found for -lSystem
ld: library not found for -lSystem
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/evil-collection/modes/so-long/evil-collection-so-long.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/evil-collection-so-long-e0dc7c2b-74f4ddb9.eln", "error invoking gcc driver"
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/nix-mode/nix.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/nix-0f61d268-a1f916d0.eln", "error invoking gcc driver"
ld: library not found for -lSystem
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/envrc/envrc.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/envrc-aa67a1ba-32efa594.eln", "error invoking gcc driver"
ld: library not found for -lSystem
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/magit-section/magit-section.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/magit-section-cbff8b04-b828c58a.eln", "error invoking gcc driver"
Compilation finished.
Compiling /Users/j/.emacs/fm30/.local/straight/build-30.0.92/evil-nerd-commenter/evil-nerd-commenter.el...
ld: library not found for -lSystem
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/evil-nerd-commenter/evil-nerd-commenter.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/evil-nerd-commenter-378efc80-57d2759d.eln", "error invoking gcc driver"
Compiling /Users/j/.emacs/fm30/.local/straight/build-30.0.92/smartparens/smartparens-html.el...
Compiling /Users/j/.emacs/fm30/.local/straight/build-30.0.92/evil-nerd-commenter/evil-nerd-commenter-sdk.el...
ld: library not found for -lSystem
ld: library not found for -lSystem
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/smartparens/smartparens-html.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/smartparens-html-1b1cbca5-f96d7805.eln", "error invoking gcc driver"
libgccjit.so: error: error invoking gcc driver
/Users/j/.emacs/fm30/.local/straight/build-30.0.92/evil-nerd-commenter/evil-nerd-commenter-sdk.el: Error Internal native compiler error: "failed to compile", "/Users/j/.emacs/fm30/.local/cache/eln/30.0.92-a3adebf0/evil-nerd-commenter-sdk-529dbf54-2e6052f7.eln", "error invoking gcc driver"

@jian-lin jian-lin added the 6.topic: emacs Text editor label Dec 3, 2024
@jian-lin
Copy link
Contributor

jian-lin commented Dec 3, 2024

edit: fixed links

This issue is introduced in this staging cycle: #354201.

The commit before the merge of that PR does not have this issue while the merge commit of that PR does have this issue.

CC darwin experts @reckenrode @emilazy

@reckenrode
Copy link
Contributor

reckenrode commented Dec 4, 2024

Does it work if SDKROOT is exported from the Emacs wrapper on Darwin?

@Godalin
Copy link

Godalin commented Dec 4, 2024

Same problem on MacOS:

  • MacOS Version 14.6.1
  • M3 processer
  • Nix release 24.11
  • nix-darwin 24.11
  • just added the emacs package to home-manager

@reckenrode
Copy link
Contributor

#361752 should fix the issue. Please test and let me know if it does not.

@jian-lin jian-lin closed this as completed Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin 6.topic: emacs Text editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants