emacs-app @29.4_1+nativecomp+rsvg+treesitter+xwidgets ld: library 'emutls_w' not found libgccjit.so: error: error invoking gcc driver
After upgrading to macOS 15.2, Xcode 16.2 and a port migrate, when native compiling some packages on Emacs 29, I get lots of these messages in the *Native-compile-Log* buffer. It appears the trampolines for native compile advices to primitive functions are messed up due to a missing reference to libemutls_w in libgccjit. This problem currently broke native compilation for the emacs packages: lsp-mode, magit, forge, git-modes, multiple-cursors, because they all advise Emacs primitive functions.
git-commit.el:109:2: Error: Native compiler error: (lambda (&rest arg2484) (let ((f #'make-process)) (apply f arg2484))), "Compiling /Users/wyuenho/.emacs.d/eln-cache/29_4-de93b662/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln...
ld: library 'emutls_w' not found
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: \"failed to compile\", \"/Users/wyuenho/.emacs.d/eln-cache/29_4-de93b662/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln\", \"error invoking gcc driver\"
Error: native-ice (\"failed to compile\" \"/Users/wyuenho/.emacs.d/eln-cache/29_4-de93b662/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln\" \"error invoking gcc driver\")
mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode -0xdec7fd7a2512f81>))
debug-early-backtrace()
debug-early(error (native-ice \"failed to compile\" \"/Users/wyuenho/.emacs.d/eln-cache/29_4-de93b662/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln\" \"error invoking gcc driver\"))
comp--compile-ctxt-to-file(\"/Users/wyuenho/.emacs.d/eln-cache/29_4-de93b662/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln\")
comp-compile-ctxt-to-file(\"/Users/wyuenho/.emacs.d/eln-cache/29_4-de93b662/subr--trampoline-6d616b652d70726f63657373_make_process_0.eln\")
comp-final1()
load-with-code-conversion(\"/private/var/folders/sl/zn7bnjxj4cz8zg9jqn3xywhh0000gn/T/emacs-int-comp-subr--trampoline-6d616b652d70726f63657373_make_process_0-gtjPZO.el\" \"/private/var/folders/sl/zn7bnjxj4cz8zg9jqn3xywhh0000gn/T/emacs-int-comp-subr--trampoline-6d616b652d70726f63657373_make_process_0-gtjPZO.el\" nil t)
command-line-1((\"-l\" \"/var/folders/sl/zn7bnjxj4cz8zg9jqn3xywhh0000gn/T/emacs-int-comp-subr--trampoline-6d616b652d70726f63657373_make_process_0-gtjPZO.el\"))
command-line()
normal-top-level()
"
I am also experiencing this issue with a fresh macports installation on an M1 MacBook Air.
Same
emutls_w
andlibgccjit.so: error: error invoking gcc driver
messages.I've managed to circumvent the issue on my end for now by putting this in my .emacs:
(setq native-comp-enable-subr-trampolines nil)