d12frosted / homebrew-emacs-plus

Emacs Plus formulae for the Homebrew package manager
MIT License
2.24k stars 175 forks source link

[Build Failure]: Build with `--with-native-comp` fails #680

Closed balakrishnanc closed 1 month ago

balakrishnanc commented 1 month ago

Version

emacs-plus@30

Make sure to follow these steps before submitting the issue

What happened?

$ brew install emacs-plus --with-native-comp --with-modern-purple-flat-icon --with-cocoa --with-mailutils --with-imagemagick --with-poll --with-xwidgets
Command output

==> Fetching d12frosted/emacs-plus/emacs-plus@30
==> Cloning https://github.com/emacs-mirror/emacs.git
...
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
==> Installing emacs-plus@30 from d12frosted/emacs-plus
==> Patching
==> Applying fix-window-role.patch
patching file 'src/nsterm.m'
==> Applying system-appearance.patch
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.m'
==> Applying poll.patch
patching file configure.ac
patching file 'src/nsterm.m'
patching file 'src/process.c'
patching file 'src/sysdep.c'
patching file 'src/syspoll.h'
patching file 'src/sysselect.h'
==> Applying round-undecorated-frame.patch
patching file 'src/frame.c'
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.h'
patching file 'src/nsterm.m'
==> ImageMagick PKG_CONFIG_PATH:
/usr/local/opt/imagemagick/lib/pkgconfig
==> ./autogen.sh
==> ./configure --disable-silent-rules --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/
Last 15 lines from /Users/balac/Library/Logs/Homebrew/emacs-plus@30/02.configure:
checking for library containing inflateEnd... -lz
checking for dladdr... yes
checking for dlfunc... no
checking for gcc_jit_context_acquire in -lgccjit... yes
checking for libgccjit.h... yes
configure: error: The installed libgccjit failed to compile and run a test program using
the libgccjit library; see config.log for the details of the failure.
The test program can be found here:
.
You can try compiling it yourself to investigate the issues.
Please report the issue to your distribution if libgccjit was installed
through that.
  

brew doctor output

Warning: You have unlinked kegs in your Cellar. Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on those kegs to fail to run properly once built. Run brew link on these: ghostscript

Warning: You have an unnecessary local Cask tap. This can cause problems installing up-to-date casks. Please remove it by running: brew untap homebrew/cask

Warning: You have an unnecessary local Core tap! This can cause problems installing up-to-date formulae. Please remove it by running: brew untap homebrew/core

brew config output

HOMEBREW_VERSION: 4.2.21 ORIGIN: https://github.com/Homebrew/brew HEAD: 82c2e743a5bcea725f9ca1429e3e21c3088ff904 Last commit: 4 days ago Core tap HEAD: bfbcc8e5b9375eb91cf9eb53a1d4b759d236cfe5 Core tap last commit: 47 minutes ago Core tap JSON: 09 May 22:23 UTC Core cask tap HEAD: 7d8f1aed2f73b1d39022b4ec64e3eb0ac4873286 Core cask tap last commit: 16 minutes ago Core cask tap JSON: 09 May 22:23 UTC HOMEBREW_PREFIX: /usr/local HOMEBREW_CASK_OPTS: [] HOMEBREW_EDITOR: emacsclient -n HOMEBREW_MAKE_JOBS: 12 HOMEBREW_NO_ENV_HINTS: set Homebrew Ruby: 3.1.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby CPU: dodeca-core 64-bit kabylake Clang: 15.0.0 build 1500 Git: 2.39.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git Curl: 8.4.0 => /usr/bin/curl macOS: 14.4.1-x86_64 CLT: 15.3.0.0.1.1708646388 Xcode: 15.3

Any extra information

No response

jhorology commented 1 month ago

I had the same issue that seems to be introduced after update libgccjt 14.1.0 and only happen on Intel mac. The cause of issue is gcc dynamic library linked via @rpath.

$ otool -L /usr/local/opt/libgccjit/lib/gcc/current/libgccjit.0.dylib
/usr/local/opt/libgccjit/lib/gcc/current/libgccjit.0.dylib:
    /usr/local/opt/libgccjit/lib/gcc/current/libgccjit.0.dylib (compatibility version 0.0.0, current version 26.0.26)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /usr/local/opt/isl/lib/libisl.23.dylib (compatibility version 27.0.0, current version 27.0.0)
    /usr/local/opt/libmpc/lib/libmpc.3.dylib (compatibility version 7.0.0, current version 7.1.0)
    /usr/local/opt/mpfr/lib/libmpfr.6.dylib (compatibility version 9.0.0, current version 9.1.0)
    /usr/local/opt/gmp/lib/libgmp.10.dylib (compatibility version 16.0.0, current version 16.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
    /usr/local/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.6)
    @rpath/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)

Workaround:

brew install gcc
cd /usr/local/opt/libgccjit/lib/gcc/current
ln -s /usr/local/lib/gcc/current/libgcc_s.1.1.dylib .
pawelEr commented 1 month ago

Same error on 29.3 and same workaround works.

balakrishnanc commented 1 month ago

@jhorology, Thanks a ton! It works now.

rhstanton commented 1 month ago

I used the workaround above and still get an error:

$ brew install emacs-plus@30 --with-native-comp --with-modern-purple-flat-icon --with-cocoa --with-mailutils --with-imagemagick --with-poll --with-xwidgets

[...]

==> ./autogen.sh
==> ./configure --disable-silent-rules --enable-locallisppath=/usr/local/share/e
Last 15 lines from /Users/stanton/Library/Logs/Homebrew/emacs-plus@30/02.configure:
checking for library containing inflateEnd... -lz
checking for dladdr... yes
checking for dlfunc... no
checking for gcc_jit_context_acquire in -lgccjit... yes
checking for libgccjit.h... yes
configure: error: The installed libgccjit failed to compile and run a test program using
the libgccjit library; see config.log for the details of the failure.
The test program can be found here:
<https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
You can try compiling it yourself to investigate the issues.
Please report the issue to your distribution if libgccjit was installed
through that.
You can find the instructions on how to compile and install libgccjit from
source on this site:
<https://gcc.gnu.org/wiki/JIT>.

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  https://github.com/d12frosted/homebrew-emacs-plus/issues