jimeh / emacs-builds

Self-contained Emacs.app builds for macOS, with native-compilation support.
https://github.com/jimeh/emacs-builds/releases
321 stars 7 forks source link

Error with 29.3 #28

Open maikol-solis opened 3 months ago

maikol-solis commented 3 months ago

Hi, after installing the new 29.3 version, I got this problem if I want to sync in doom.

I haven't had these errors on 29.2.

$ sh ~/.emacs.d/bin/doom sync -u

Error: doom-core-error ("/Users/maikol/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln...
ld: library not found for -lemutls_w
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"

Error: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd1f2f239c512f81>))
  debug-early-backtrace()
  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))
  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")
  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")
  comp-final1()
  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" nil t)
  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\"))
  command-line()
  normal-top-level()
"))
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd1f2f239c512f81>))
  debug-early-backtrace()
  debug-early(error (doom-core-error "/Users/maikol/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln...\nld: library not found for -lemutls_w\nlibgccjit.so: error: error invoking gcc driver\nInternal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"\n\nError: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")\n  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd1f2f239c512f81>))\n  debug-early-backtrace()\n  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))\n  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-final1()\n  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" nil t)\n  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\"))\n  command-line()\n  normal-top-level()\n")))
  signal(doom-core-error ("/Users/maikol/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln...\nld: library not found for -lemutls_w\nlibgccjit.so: error: error invoking gcc driver\nInternal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"\n\nError: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")\n  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd1f2f239c512f81>))\n  debug-early-backtrace()\n  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))\n  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-final1()\n  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" nil t)\n  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\"))\n  command-line()\n  normal-top-level()\n")))
  (condition-case e (load path noerror 'nomessage) ((debug doom-error) (signal (car e) (cdr e))) ((debug error) (setq path (locate-file path load-path (get-load-suffixes))) (signal (cond ((not (and path (featurep 'doom))) 'error) ((file-in-directory-p path (expand-file-name "cli" doom-core-dir)) 'doom-cli-error) ((file-in-directory-p path doom-core-dir) 'doom-core-error) ((file-in-directory-p path doom-user-dir) 'doom-user-error) ((file-in-directory-p path doom-profile-dir) 'doom-profile-error) ((file-in-directory-p path doom-modules-dir) 'doom-module-error) ('doom-error)) (list path e))))
  doom-load("doom-cli" nil)
  (or (featurep feature subfeature) (doom-load (if subfeature (file-name-concat doom-core-dir (string-remove-prefix "doom-" (symbol-name feature)) (symbol-name filename)) (symbol-name feature)) noerror))
  (let ((subfeature (if (symbolp filename) filename))) (or (featurep feature subfeature) (doom-load (if subfeature (file-name-concat doom-core-dir (string-remove-prefix "doom-" (symbol-name feature)) (symbol-name filename)) (symbol-name feature)) noerror)))
  doom-require(doom-cli)
  (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start)))
  (let (file-name-handler-alist) (let ((command-line-args (if noninteractive nil command-line-args)) (profile (or (car (cdr (member "--profile" command-line-args))) (getenv-internal "DOOMPROFILE")))) (if (null profile) (let ((init-dir (or (car (cdr (member "--init-directory" command-line-args))) (getenv-internal "EMACSDIR")))) (if (null init-dir) (if noninteractive (progn (setq user-emacs-directory (file-name-directory (file-truename load-file-name))))) (setq command-switch-alist (cons (cons "--init-directory" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setq user-emacs-directory (expand-file-name init-dir)))) (setq command-switch-alist (cons (cons "--profile" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setenv "DOOMPROFILE" profile) (or (load (expand-file-name (format (let ((lfile (getenv-internal "DOOMPROFILELOADFILE"))) (if lfile (concat (let ((suffix ".el")) (if (string-suffix-p suffix lfile) (substring lfile 0 (- (length lfile) (length suffix))) lfile)) ".%d.elc") "profiles/load.%d.elc")) emacs-major-version) user-emacs-directory) 'noerror (not init-file-debug) 'nosuffix) (user-error "Profiles not initialized yet; run 'doom sync' first")))) (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start))))
  (or (let (file-name-handler-alist) (let ((command-line-args (if noninteractive nil command-line-args)) (profile (or (car (cdr (member "--profile" command-line-args))) (getenv-internal "DOOMPROFILE")))) (if (null profile) (let ((init-dir (or (car (cdr (member "--init-directory" command-line-args))) (getenv-internal "EMACSDIR")))) (if (null init-dir) (if noninteractive (progn (setq user-emacs-directory (file-name-directory (file-truename load-file-name))))) (setq command-switch-alist (cons (cons "--init-directory" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setq user-emacs-directory (expand-file-name init-dir)))) (setq command-switch-alist (cons (cons "--profile" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setenv "DOOMPROFILE" profile) (or (load (expand-file-name (format (let ((lfile (getenv-internal "DOOMPROFILELOADFILE"))) (if lfile (concat (let ((suffix ".el")) (if (string-suffix-p suffix lfile) (substring lfile 0 (- (length lfile) (length suffix))) lfile)) ".%d.elc") "profiles/load.%d.elc")) emacs-major-version) user-emacs-directory) 'noerror (not init-file-debug) 'nosuffix) (user-error "Profiles not initialized yet; run 'doom sync' first")))) (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start)))) (load user-init-file 'noerror (not init-file-debug) nil 'must-suffix))
  load-with-code-conversion("/Users/maikol/.emacs.d/early-init.el" "/Users/maikol/.emacs.d/early-init.el" nil t)
  load("/Users/maikol/.emacs.d/early-init.el" nil nomessage nosuffix)
  (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom))
  (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file))
  (let* ((bin-dir (file-name-directory (file-truename load-file-name))) (init-file (expand-file-name "../early-init.el" bin-dir))) (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file)))
  (condition-case e (let* ((bin-dir (file-name-directory (file-truename load-file-name))) (init-file (expand-file-name "../early-init.el" bin-dir))) (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file))) (user-error (message "Error: %s" (car (cdr e))) (kill-emacs 2)))
  load-with-code-conversion("/Users/maikol/.emacs.d/bin/doom" "/Users/maikol/.emacs.d/bin/doom" nil t)
  command-line-1(("--load" "/Users/maikol/.emacs.d/bin/doom" "--" "sync" "-u"))
  command-line()
  normal-top-level()
Unexpected error in Doom’s core: "/Users/maikol/.emacs.d/lisp/doom-cli.el", (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln...
ld: library not found for -lemutls_w
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"

Error: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd1f2f239c512f81>))
  debug-early-backtrace()
  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))
  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")
  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_3-6a5f6b0e/subr--trampoline-6d657373616765_message_0.eln\")
  comp-final1()
  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\" nil t)
  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-Howewe.el\"))
  command-line()
  normal-top-level()
")

For the moment, I reinstalled 29.2.

jimeh commented 3 months ago

That's an interesting error. I can't reproduce it locally, even tried on a fresh macOS VM with nothing except Xcode Command Line Tools installed. Generally searching for info online hasn't yielded much answers either.

The best I can guess, is that maybe doom-emacs is messing with the LIBRARY_PATH environment variable within Emacs, which prevents native-compilation from finding the bundled GCC libraries inside of the Emacs.app bundle.

Basically, the builds all include a custom site-start.el file under Contents/Resources/lisp, which modifies LIBRARY_PATH to enable native compilation to discover and use GCC and libgccjit that's included in the app. Otherwise the end user would be requires to install gcc and libgccjit via Homebrew to get native compilation to work.

If you run (getenv "LIBRARY_PATH"), what are your results?

For the x86_64 build, it should be something like this:

"/Applications/Emacs.app/Contents/Frameworks/gcc/13:/Applications/Emacs.app/Contents/Frameworks/gcc/13/gcc/x86_64-apple-darwin21/13:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"

Or for the arm64 build, I would expect something like:

"/Applications/Emacs.app/Contents/Frameworks/gcc/13:/Applications/Emacs.app/Contents/Frameworks/gcc/13/gcc/aarch64-apple-darwin22/13:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"

The important path is the one that matches */Contents/Frameworks/gcc/13/gcc/*-apple-darwin*/13, as that folder contains libemutls_w.a.

As for why you're having this problem on 29.3, but not 29.2 however, I have no clue :(

One potential thing you could test, is to install gcc and libgccjit via Homebrew. If that fixes it, the issue is most likely related to something in your config messing with LIBRARY_PATH.

joobus commented 3 months ago

I had the same error as @maikol-solis . I found this issue and was able to get past this issue by adding the following to ~/.config/emacs/early-init.el:

(setenv "LIBRARY_PATH" "/usr/local/lib/gcc/current:/usr/local/lib/gcc/current/gcc/x86_64-apple-darwin23/13/")

Your path may be different depending on which processor you have.

jimeh commented 3 months ago

@joobus that's weird, what does Contents/Resources/lisp/site-start.el inside your Emacs.app look like?

Also what does (getenv "LIBRARY_PATH") return if you comment out that work around?

The site-start.el file should be setting up LIBRARY_PATH to point to gcc that's bundled into Emacs.app.

joobus commented 3 months ago

@jimeh I think I only had to add that to get doom to run the first time. Once doom ran once, the env file was updated with LIBRARY_PATH pointing to the gcc inside emacs. I think I can probably remove the workaround now.

jimeh commented 3 months ago

Ah, interesting, I might need to investigate doom-emacs, cause it sounds like it messes with the LIBRARY_PATH env var.

maikol-solis commented 3 months ago

Hi!

If you run (getenv "LIBRARY_PATH"), what are your results?

For me, it is this path.

"/Applications/Emacs.app/Contents/Frameworks/gcc/13:/Applications/Emacs.app/Contents/Frameworks/gcc/13/gcc/x86_64-apple-darwin21/13:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib:/Applications/Emacs.app/Contents/Frameworks/gcc/13:/Applications/Emacs.app/Contents/Frameworks/gcc/13/gcc/x86_64-apple-darwin21/13:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
maikol-solis commented 5 days ago

There are still issues with 29.4

Error: doom-core-error ("/Users/maikol/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln...
ld: library not found for -lemutls_w
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"

Error: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd137a2a72512f81>))
  debug-early-backtrace()
  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))
  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")
  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")
  comp-final1()
  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" nil t)
  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\"))
  command-line()
  normal-top-level()
"))
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd137a2a72512f81>))
  debug-early-backtrace()
  debug-early(error (doom-core-error "/Users/maikol/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln...\nld: library not found for -lemutls_w\nlibgccjit.so: error: error invoking gcc driver\nInternal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"\n\nError: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")\n  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd137a2a72512f81>))\n  debug-early-backtrace()\n  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))\n  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-final1()\n  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" nil t)\n  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\"))\n  command-line()\n  normal-top-level()\n")))
  signal(doom-core-error ("/Users/maikol/.emacs.d/lisp/doom-cli.el" (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln...\nld: library not found for -lemutls_w\nlibgccjit.so: error: error invoking gcc driver\nInternal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"\n\nError: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")\n  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd137a2a72512f81>))\n  debug-early-backtrace()\n  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))\n  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")\n  comp-final1()\n  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" nil t)\n  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\"))\n  command-line()\n  normal-top-level()\n")))
  (condition-case e (load path noerror 'nomessage) ((debug doom-error) (signal (car e) (cdr e))) ((debug error) (setq path (locate-file path load-path (get-load-suffixes))) (signal (cond ((not (and path (featurep 'doom))) 'error) ((file-in-directory-p path (expand-file-name "cli" doom-core-dir)) 'doom-cli-error) ((file-in-directory-p path doom-core-dir) 'doom-core-error) ((file-in-directory-p path doom-user-dir) 'doom-user-error) ((file-in-directory-p path doom-profile-dir) 'doom-profile-error) ((file-in-directory-p path doom-modules-dir) 'doom-module-error) ('doom-error)) (list path e))))
  doom-load("doom-cli" nil)
  (or (featurep feature subfeature) (doom-load (if subfeature (file-name-concat doom-core-dir (string-remove-prefix "doom-" (symbol-name feature)) (symbol-name filename)) (symbol-name feature)) noerror))
  (let ((subfeature (if (symbolp filename) filename))) (or (featurep feature subfeature) (doom-load (if subfeature (file-name-concat doom-core-dir (string-remove-prefix "doom-" (symbol-name feature)) (symbol-name filename)) (symbol-name feature)) noerror)))
  doom-require(doom-cli)
  (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start)))
  (let (file-name-handler-alist) (let ((command-line-args (if noninteractive nil command-line-args)) (profile (or (car (cdr (member "--profile" command-line-args))) (getenv-internal "DOOMPROFILE")))) (if (null profile) (let ((init-dir (or (car (cdr (member "--init-directory" command-line-args))) (getenv-internal "EMACSDIR")))) (if (null init-dir) (if noninteractive (progn (setq user-emacs-directory (file-name-directory (file-truename load-file-name))))) (setq command-switch-alist (cons (cons "--init-directory" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setq user-emacs-directory (expand-file-name init-dir)))) (setq command-switch-alist (cons (cons "--profile" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setenv "DOOMPROFILE" profile) (or (load (expand-file-name (format (let ((lfile (getenv-internal "DOOMPROFILELOADFILE"))) (if lfile (concat (let ((suffix ".el")) (if (string-suffix-p suffix lfile) (substring lfile 0 (- (length lfile) (length suffix))) lfile)) ".%d.elc") "profiles/load.%d.elc")) emacs-major-version) user-emacs-directory) 'noerror (not init-file-debug) 'nosuffix) (user-error "Profiles not initialized yet; run 'doom sync' first")))) (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start))))
  (or (let (file-name-handler-alist) (let ((command-line-args (if noninteractive nil command-line-args)) (profile (or (car (cdr (member "--profile" command-line-args))) (getenv-internal "DOOMPROFILE")))) (if (null profile) (let ((init-dir (or (car (cdr (member "--init-directory" command-line-args))) (getenv-internal "EMACSDIR")))) (if (null init-dir) (if noninteractive (progn (setq user-emacs-directory (file-name-directory (file-truename load-file-name))))) (setq command-switch-alist (cons (cons "--init-directory" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setq user-emacs-directory (expand-file-name init-dir)))) (setq command-switch-alist (cons (cons "--profile" #'(lambda (_) (car-safe (prog1 argv (setq argv (cdr argv)))))) command-switch-alist)) (setenv "DOOMPROFILE" profile) (or (load (expand-file-name (format (let ((lfile (getenv-internal "DOOMPROFILELOADFILE"))) (if lfile (concat (let ((suffix ".el")) (if (string-suffix-p suffix lfile) (substring lfile 0 (- (length lfile) (length suffix))) lfile)) ".%d.elc") "profiles/load.%d.elc")) emacs-major-version) user-emacs-directory) 'noerror (not init-file-debug) 'nosuffix) (user-error "Profiles not initialized yet; run 'doom sync' first")))) (if (let ((load-suffixes '(".elc" ".el"))) (condition-case _ (load (expand-file-name "lisp/doom" user-emacs-directory) nil (not init-file-debug) nil 'must-suffix) ((debug file-missing) (prog1 (defalias 'startup--load-user-init-file@reroute-to-profile #'(lambda (args) (list #'(lambda nil (expand-file-name "init.el" user-emacs-directory)) nil (nth 2 args)))) (advice-add 'startup--load-user-init-file :filter-args #'startup--load-user-init-file@reroute-to-profile)) (setq user-init-file (expand-file-name "early-init" user-emacs-directory)) (setq load-prefer-newer t) (setq gc-cons-threshold (* 16 1024 1024)) nil))) (doom-require (if noninteractive 'doom-cli 'doom-start)))) (load user-init-file 'noerror (not init-file-debug) nil 'must-suffix))
  load-with-code-conversion("/Users/maikol/.emacs.d/early-init.el" "/Users/maikol/.emacs.d/early-init.el" nil t)
  load("/Users/maikol/.emacs.d/early-init.el" nil nomessage nosuffix)
  (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom))
  (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file))
  (let* ((bin-dir (file-name-directory (file-truename load-file-name))) (init-file (expand-file-name "../early-init.el" bin-dir))) (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file)))
  (condition-case e (let* ((bin-dir (file-name-directory (file-truename load-file-name))) (init-file (expand-file-name "../early-init.el" bin-dir))) (or (and (load init-file nil 'nomessage 'nosuffix) (featurep 'doom)) (user-error "Failed to load Doom from %s" init-file))) (user-error (message "Error: %s" (car (cdr e))) (kill-emacs 2)))
  load-with-code-conversion("/Users/maikol/.emacs.d/bin/doom" "/Users/maikol/.emacs.d/bin/doom" nil t)
  command-line-1(("--load" "/Users/maikol/.emacs.d/bin/doom" "--" "install"))
  command-line()
  normal-top-level()
Unexpected error in Doom’s core: "/Users/maikol/.emacs.d/lisp/doom-cli.el", (native-compiler-error (lambda (arg3 &rest arg4) (let ((f #'message)) (apply f arg3 arg4))) "Compiling /Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln...
ld: library not found for -lemutls_w
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: \"failed to compile\", \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\", \"error invoking gcc driver\"

Error: native-ice (\"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xd137a2a72512f81>))
  debug-early-backtrace()
  debug-early(error (native-ice \"failed to compile\" \"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\" \"error invoking gcc driver\"))
  comp--compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")
  comp-compile-ctxt-to-file(\"/Users/maikol/.emacs.d/.local/cache/eln/29_4-65ab8681/subr--trampoline-6d657373616765_message_0.eln\")
  comp-final1()
  load-with-code-conversion(\"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" \"/private/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\" nil t)
  command-line-1((\"-l\" \"/var/folders/4d/qj4qr8zx1n36td0hlt0p7x_h0000gn/T/emacs-int-comp-subr--trampoline-6d657373616765_message_0-sQHTN9.el\"))
  command-line()
  normal-top-level()
")
jimeh commented 5 days ago

@maikol-solis Apologies, this one slipped through the cracks for me. I should have some spare time this weekend to try and reproduce it with a fresh doom-emacs setup.

Your LIBRARY_PATH does look correct, though it contains the correct paths twice which is interesting.

rkben commented 2 days ago

A workaround for anyone coming across this issue is to update the LIBRARY_PATH then doom install.

Ensure you don't just copy and paste below as the paths can vary as mentioned in https://github.com/jimeh/emacs-builds/issues/28#issuecomment-2035670137

export LIBRARY_PATH="$LIBRARY_PATH:/Applications/Emacs.app/Contents/Frameworks/gcc/14/gcc/aarch64-apple-darwin22/14"
doom install

Edit: doom env or similar, within doom that updates emacs/.local/env, will retain LIBRARY_PATH, so should only be needed for the initial install.