Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libgccjit error with new gcc 14 update #206

Closed
dylanjm opened this issue May 8, 2024 · 9 comments
Closed

Libgccjit error with new gcc 14 update #206

dylanjm opened this issue May 8, 2024 · 9 comments
Assignees

Comments

@dylanjm
Copy link

dylanjm commented May 8, 2024

OS: macOS 14.4.1
image

Not sure if this is a systemic problem with this formula or just on my end, but I am recieving the following error when trying to install emacs-head@30.

I noticed I also had to update my paths this morning after doing a homebrew update. Referenced from d12frosted/homebrew-emacs-plus#323

from:

(setenv "LIBRARY_PATH" "/usr/local/opt/gcc/lib/gcc/11:/usr/local/opt/libgccjit/lib/gcc/11:/usr/local/opt/gcc/lib/gcc/11/gcc/x86_64-apple-darwin21/14")

to:

(setenv "LIBRARY_PATH" "/usr/local/opt/gcc/lib/gcc/14:/usr/local/opt/libgccjit/lib/gcc/14:/usr/local/opt/gcc/lib/gcc/14/gcc/x86_64-apple-darwin23/14")

I am getting the following error/output when trying to run the following command:

brew install emacs-head@30 --with-crash-debug --with-cocoa --with-imagemagick --with-xwidgets --with-native-comp --with-native-full-aot --with-tree-sitter --with-poll --with-infinity-yak-shack
==> Fetching daviderestivo/emacs-head/emacs-head@30
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0011-Poll-30.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/2e14976d1dac931b5efa656ea86e61014642d730ce98dab10fda5d99ca326468--0011-Poll-30.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0005-System-appearance.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/aedf6bcffeb3a805dd1feae35654986fa3062c6d42dd2ccc6e9f105bf60e1db1--0005-System-appearance.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0008-Fix-window-role.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/aa727383a475fe50cd4aa2fdcce43dc2ca41fdf5e3518a2171dbc236c2a1b9c7--0008-Fix-window-role.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0012-BLOCK_ALIGN.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/3cf2fd34471581a23a6015983a100257188a11ada1796098f968c1cb6c493905--0012-BLOCK_ALIGN.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0003-Pdumper-size-increase.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/48b7b584452aaa782a33329cf34cea430a07ab987d772eeb06900e0903f444b1--0003-Pdumper-size-increase.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0005-System-appearance.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/aedf6bcffeb3a805dd1feae35654986fa3062c6d42dd2ccc6e9f105bf60e1db1--0005-System-appearance.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0008-Fix-window-role.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/aa727383a475fe50cd4aa2fdcce43dc2ca41fdf5e3518a2171dbc236c2a1b9c7--0008-Fix-window-role.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0011-Poll-30.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/2e14976d1dac931b5efa656ea86e61014642d730ce98dab10fda5d99ca326468--0011-Poll-30.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/patches/0012-BLOCK_ALIGN.patch
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/3cf2fd34471581a23a6015983a100257188a11ada1796098f968c1cb6c493905--0012-BLOCK_ALIGN.patch
==> Downloading https://raw.githubusercontent.com/daviderestivo/homebrew-emacs-head/master/icons/infinity-yak-shack.icns
Already downloaded: /Users/mcdodj/Library/Caches/Homebrew/downloads/2ac2bec40f006f3539cdc021c9a502d2a6142c16b4907202a545b4cd0e8a8e93--infinity-yak-shack.icns
==> Cloning https://github.com/emacs-mirror/emacs.git
Updating /Users/mcdodj/Library/Caches/Homebrew/emacs-head@30--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at 840c33070dc (repeat-echo-message-string): Reuse 'r-m-c' prompt formatting
==> Installing emacs-head@30 from daviderestivo/emacs-head
==> Patching
==> Applying 0011-Poll-30.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 0005-System-appearance.patch
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.m'
==> Applying 0008-Fix-window-role.patch
patching file 'src/nsterm.m'
==> Applying 0012-BLOCK_ALIGN.patch
patching file 'src/alloc.c'
==> Force full Ahead-of-Time compilation
==> ImageMagick PKG_CONFIG_PATH:
/usr/local/opt/imagemagick/lib/pkgconfig
==> GNU Emacs crash debug enabled. Appending `-g3` to CFLAGS...
==> ./autogen.sh
==> ./configure --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-head@30/30.0.50_1/share/info/emacs --without-x --without-dbus --with-native-compilation --with-imagema
Last 15 lines from /Users/mcdodj/Library/Logs/Homebrew/emacs-head@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/daviderestivo/homebrew-emacs-head/issues
@lotuc
Copy link

lotuc commented May 9, 2024

Encountering the same problem earlier this day. After manually link libs into /usr/local/lib, it compiles now for me:

ln -s /usr/local/Cellar/libgccjit/14.1.0/lib/gcc/14/libgccjit.dylib /usr/local/lib/
ln -s /usr/local/Cellar/libgccjit/14.1.0/lib/gcc/14/libgccjit.0.dylib /usr/local/lib/

ln -s /usr/local/Cellar/gcc/14.1.0/lib/gcc/14/libgcc_s.1.dylib /usr/local/lib/
ln -s /usr/local/Cellar/gcc/14.1.0/lib/gcc/14/libgcc_s.1.1.dylib /usr/local/lib/

@daviderestivo daviderestivo self-assigned this May 9, 2024
@daviderestivo
Copy link
Owner

@dylanjm thanks for spotting this issue. Lemme have a look into it ...

@daviderestivo
Copy link
Owner

daviderestivo commented May 9, 2024

Encountering the same problem earlier this day. After manually link libs into /usr/local/lib, it compiles now for me:

ln -s /usr/local/Cellar/libgccjit/14.1.0/lib/gcc/14/libgccjit.dylib /usr/local/lib/
ln -s /usr/local/Cellar/libgccjit/14.1.0/lib/gcc/14/libgccjit.0.dylib /usr/local/lib/

ln -s /usr/local/Cellar/gcc/14.1.0/lib/gcc/14/libgcc_s.1.dylib /usr/local/lib/
ln -s /usr/local/Cellar/gcc/14.1.0/lib/gcc/14/libgcc_s.1.1.dylib /usr/local/lib/

It worked for me as well. We can consider it as a temporary workaround until I provide a fix :)

daviderestivo added a commit that referenced this issue May 9, 2024
@dylanjm
Copy link
Author

dylanjm commented May 9, 2024

Hello, @lotuc and @daviderestivo the above workaround worked for me as well. Thanks for your time and taking a look at this!

@daviderestivo
Copy link
Owner

I have currently two MacBooks. One with an Intel CPU and another one with an Apple M1. The problem seems to be present only on the Intel CPU.

Apple M1 - WORKING -

  ❯ uname -a
  Darwin xxxxx 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
  ❯ brew unlink --verbose libgccjit
  Unlinking /opt/homebrew/Cellar/libgccjit/14.1.0...
  rm /opt/homebrew/include/libgccjit++.h
  rm /opt/homebrew/include/libgccjit.h
  rm /opt/homebrew/lib/gcc/14/libgccjit.0.dylib
  rm /opt/homebrew/lib/gcc/14/libgccjit.dylib
  rm /opt/homebrew/lib/gcc/current/libgccjit.0.dylib
  rm /opt/homebrew/lib/gcc/current/libgccjit.dylib

  ❯ otool -L /opt/homebrew/Cellar/libgccjit/14.1.0/lib/gcc/14/libgccjit.dylib

  /opt/homebrew/Cellar/libgccjit/14.1.0/lib/gcc/14/libgccjit.dylib:
        /opt/homebrew/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)
        /opt/homebrew/opt/isl/lib/libisl.23.dylib (compatibility version 27.0.0, current version 27.0.0)
        /opt/homebrew/opt/libmpc/lib/libmpc.3.dylib (compatibility version 7.0.0, current version 7.1.0)
        /opt/homebrew/opt/mpfr/lib/libmpfr.6.dylib (compatibility version 9.0.0, current version 9.1.0)
        /opt/homebrew/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)
        /opt/homebrew/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.6)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)

Intel CPU - NOT WORKING -

❯ uname -a
  Darwin xxxxx 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64 x86_64
  ❯ brew unlink --verbose libgccjit
  Unlinking /usr/local/Cellar/libgccjit/14.1.0...
  rm /usr/local/include/libgccjit++.h
  rm /usr/local/include/libgccjit.h
  rm /usr/local/lib/gcc/14/libgccjit.0.dylib
  rm /usr/local/lib/gcc/14/libgccjit.dylib
  rm /usr/local/lib/gcc/current/libgccjit.0.dylib
  rm /usr/local/lib/gcc/current/libgccjit.dylib
  6 symlinks removed.

  ❯ otool -L /usr/local/lib/gcc/current/libgccjit.dylib
  /usr/local/lib/gcc/current/libgccjit.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)

I suppose the issue is related to the fact the while in the Apple M1 then symlink path: /opt/homebrew/lib/gcc/current/libgccjit.dylib

is equal to the one in the dylib

opt/homebrew/opt/libgccjit/lib/gcc/current/libgccjit.0.dylib (compatibility version 0.0.0, current version 26.0.26)

for the Intel CPU this is not the case.

/usr/local/lib/gcc/current/libgccjit.dylib
usr/local/opt/libgccjit/lib/gcc/current/libgccjit.0.dylib (compatibility version 0.0.0, current version 26.0.26)

This could explain while the above workaround helps.

I guess we should report this upstream to the homebrew team. Before doing it I would like to see the otool -L ... output of some of you with the same issue.

@dylanjm @lotuc can you please provide me with such infos?

@adamliter
Copy link

@daviderestivo
Copy link
Owner

daviderestivo commented May 19, 2024

@adamliter The PR is exactly what I had in mind. Long time ago we discussed something similar in Homebrew/brew#10075 and Homebrew/brew#9526.

I guess until this is fixed in homebrew upstream the only solution is the above proposed workaround.

@carlocab
Copy link

This should be fixed now; do brew update && brew reinstall libgccjit. (You may have to wait ~20 minutes for the JSON API to get updated.)

@daviderestivo
Copy link
Owner

I can confirm the issue has been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants