daviderestivo / homebrew-emacs-head

GNU Emacs formula for the Homebrew package manager
GNU General Public License v3.0
297 stars 29 forks source link

native compilation doesn't work on MacOS (12.x/13.x) #169

Closed fkupchik closed 1 year ago

fkupchik commented 1 year ago

I've recently updated the emacs 29 and found that no native compilation is working anymore. The errors I'm seeing in Messages buffer:

Loading /Users/user/.emacs.d/elpa/projectile-20221122.2032/projectile.el (source)...done
Error setting projectile-mode: (native-compiler-error (lambda (arg0 &optional arg1) (let ((f #'delete-file)) (funcall f arg0 arg1))) Compiling /Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-64656c6574652d66696c65_delete_file_0.eln...
ld: library not found for -lemutls_w
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: "failed to compile", "/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-64656c6574652d66696c65_delete_file_0.eln", "error invoking gcc driver"

Error: native-ice ("failed to compile" "/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-64656c6574652d66696c65_delete_file_0.eln" "error invoking gcc driver")
  debug-early-backtrace()
  debug-early(error (native-ice "failed to compile" "/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-64656c6574652d66696c65_delete_file_0.eln" "error invoking gcc driver"))
  comp--compile-ctxt-to-file("/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-64656c6574652d66696c65_delete_file_0.eln")
  comp-compile-ctxt-to-file("/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-64656c6574652d66696c65_delete_file_0.eln")
  comp-final1()
  load-with-code-conversion("/private/var/folders/cj/q5hkwpj14v1cpg8942bk29j80000gt/T/emacs-int-comp-subr--trampoline-64656c6574652d66696c65_delete_file_0-hAG29Q.el" "/private/var/folders/cj/q5hkwpj14v1cpg8942bk29j80000gt/T/emacs-int-comp-subr--trampoline-64656c6574652d66696c65_delete_file_0-hAG29Q.el" nil t)
  command-line-1(("-l" "/var/folders/cj/q5hkwpj14v1cpg8942bk29j80000gt/T/emacs-int-comp-subr--trampoline-64656c6574652d66696c65_delete_file_0-hAG29Q.el"))
  command-line()
  normal-top-level()
)
 stop  Warning (initialization): An error occurred while loading ‘/Users/user/.emacs.d/init.el’:

Native compiler error: (lambda (arg2 &optional) (let ((f #'yes-or-no-p)) (funcall f arg2))), Compiling /Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0.eln...
ld: library not found for -lemutls_w
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: "failed to compile", "/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0.eln", "error invoking gcc driver"

Error: native-ice ("failed to compile" "/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0.eln" "error invoking gcc driver")
  debug-early-backtrace()
  debug-early(error (native-ice "failed to compile" "/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0.eln" "error invoking gcc driver"))
  comp--compile-ctxt-to-file("/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0.eln")
  comp-compile-ctxt-to-file("/Users/user/.emacs.d/eln-cache/29.0.60-2a723e80/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0.eln")
  comp-final1()
  load-with-code-conversion("/private/var/folders/cj/q5hkwpj14v1cpg8942bk29j80000gt/T/emacs-int-comp-subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0-Zc5Drh.el" "/private/var/folders/cj/q5hkwpj14v1cpg8942bk29j80000gt/T/emacs-int-comp-subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0-Zc5Drh.el" nil t)
  command-line-1(("-l" "/var/folders/cj/q5hkwpj14v1cpg8942bk29j80000gt/T/emacs-int-comp-subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0-Zc5Drh.el"))
  command-line()
  normal-top-level()

While googling I came across a few bug reports with advises to recompile gcc and libgccjit few times but that didn't help at all.

The flags I'm using are:

brew reinstall daviderestivo/emacs-head/emacs-head@29  --with-tree-sitter --with-cocoa --with-native-comp

I've tried this on both MacOS 12 and 13 (did the upgrade during the troubleshooting).

daviderestivo commented 1 year ago

Please uninstall completely emacs-head@29, make sure gnutls is installed and the install once again emacs-head@29.

daviderestivo commented 1 year ago

Closing it because of inactivity. Please re-open it if needed.