d12frosted / homebrew-emacs-plus

Emacs Plus formulae for the Homebrew package manager
MIT License
2.34k stars 181 forks source link

emacs-{28,29}: fix native-comp #687

Closed d12frosted closed 1 month ago

stradicat commented 2 months ago

Apparently, emacs@29 specifically fails build checks. However, on my machine, the formula built right off Homebrew.

neoheartbeats commented 2 months ago

@stradicat @d12frosted May this have something to do with the built-in gcc on macOS? I failed to build Emacs Plus on my M-chip client if using the built-in gcc but succeeded using the homebrewed gcc-14. I think there may have some conflicts with the built-in gcc and homebrewed libgccjit that Emacs Plus currently uses.

I solved some native-compiled issues by passing the following

(setenv "LIBRARY_PATH" (concat "/opt/homebrew/opt/gcc/lib/gcc/14:"
                               "/opt/homebrew/opt/libgccjit/lib/gcc/14:"
                               "/opt/homebrew/opt/gcc/lib/gcc/14/gcc/aarch64-apple-darwin23/14"))
stradicat commented 2 months ago

@stradicat @d12frosted May this have something to do with the built-in gcc on macOS? I failed to build Emacs Plus on my M-chip client if using the built-in gcc but succeeded using the homebrewed gcc-14. I think there may have some conflicts with the built-in gcc and homebrewed libgccjit that Emacs Plus currently uses.

I solved some native-compiled issues by passing the following

(setenv "LIBRARY_PATH" (concat "/opt/homebrew/opt/gcc/lib/gcc/14:"
                               "/opt/homebrew/opt/libgccjit/lib/gcc/14:"
                               "/opt/homebrew/opt/gcc/lib/gcc/14/gcc/aarch64-apple-darwin23/14"))

You have a point there; I've successfully built emacs@29 on my Intel mac too, with homebrewed gcc and libgccjit; the build checks fail in Github specifically for the version, and the pipeline is probably not running brew-provided gcc and libs (please correct me if I'm wrong, @d12frosted).

neoheartbeats commented 2 months ago

@stradicat @d12frosted May this have something to do with the built-in gcc on macOS? I failed to build Emacs Plus on my M-chip client if using the built-in gcc but succeeded using the homebrewed gcc-14. I think there may have some conflicts with the built-in gcc and homebrewed libgccjit that Emacs Plus currently uses.

I solved some native-compiled issues by passing the following

(setenv "LIBRARY_PATH" (concat "/opt/homebrew/opt/gcc/lib/gcc/14:"
                               "/opt/homebrew/opt/libgccjit/lib/gcc/14:"
                               "/opt/homebrew/opt/gcc/lib/gcc/14/gcc/aarch64-apple-darwin23/14"))

Related:

d12frosted commented 2 months ago

A few random comments.

  1. Modifying LIBRARY_PATH is not a solution 😃 Especially as part of your Emacs configuration.
  2. The issue might be related to usage of standard environment instead of super environment. The key difference is that the former is not sanitized, i.e. user env affects the build. But whatever is installed by brew as part of the formula must have higher priority 🤷 Besides, we explicitly set flags for proper discoverability of liggccjit.
  3. GitHub workflows sometimes use older versions of brew packages, so it doesn't reflect the bleeding edge. Albeit the build fails for a long time, so 🤷