homebrew-emacs-plus: brew install emacs-plus@29 --with-native-comp is failing

Problem started after a brew update/upgrade. The update/upgrade updated gcc and libgccjit to 11.3.0 and the build of emacs-plus@29 was successful. But starting up emacs-plus@29 failed with error message missing libgccjit.so. Subsequently with brew uninstall/install the failure is during ./configure of emacs-plus@29.

Here is the present state of the problem:

brew install emacs-plus@29 --with-native-comp Running brew update --preinstall… ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> New Formulae hut vcluster ==> Updated Formulae Updated 7 formulae.

==> Downloading https://ghcr.io/v2/homebrew/core/libgccjit/manifests/11.3.0 Already downloaded: /Users/basab.maulik/Library/Caches/Homebrew/downloads/871b114625dff6a9f75b38649df5a014e260dc952386cfbd3d2bc0f6943f263b–libgccjit-11.3.0.bottle_manifest.json ==> Downloading https://ghcr.io/v2/homebrew/core/libgccjit/blobs/sha256:4cce8e0cf231b7d52cb17cdd45af65d340bac1a8b6b2d76c15bab4544f1c778f Already downloaded: /Users/basab.maulik/Library/Caches/Homebrew/downloads/964e7187fde9558e672c0eb2f98960273476fbf2347ef1f3859a5c9e4bef2bb5–libgccjit–11.3.0.big_sur.bottle.tar.gz ==> Downloading https://ghcr.io/v2/homebrew/core/gcc/manifests/11.3.0 Already downloaded: /Users/basab.maulik/Library/Caches/Homebrew/downloads/0967de7d049f61e00cf839bbf696fe9669c869f232e4bde07094dcb2df99ab90–gcc-11.3.0.bottle_manifest.json ==> Downloading https://ghcr.io/v2/homebrew/core/gcc/blobs/sha256:fcbb2d595a2b3a74b6c2877979242f77d87c21f4fbc52916fa7d7fbf531ae661 Already downloaded: /Users/basab.maulik/Library/Caches/Homebrew/downloads/b4252910024416372e76abcd21ea9de6e82b4fe3ac3d90c858d63e929aabdd4b–gcc–11.3.0.big_sur.bottle.tar.gz ==> Cloning https://github.com/emacs-mirror/emacs.git Updating /Users/basab.maulik/Library/Caches/Homebrew/emacs-plus@29–git From https://github.com/emacs-mirror/emacs b568a41a5e…8c2ea3a708 master -> origin/master ==> Checking out branch master Already on ‘master’ Your branch is behind ‘origin/master’ by 1 commit, and can be fast-forwarded. (use “git pull” to update your local branch) HEAD is now at 8c2ea3a708 Avoid change to desktop file format ==> Installing emacs-plus@29 from d12frosted/emacs-plus ==> Installing dependencies for d12frosted/emacs-plus/emacs-plus@29: libgccjit and gcc ==> Installing d12frosted/emacs-plus/emacs-plus@29 dependency: libgccjit ==> Pouring libgccjit–11.3.0.big_sur.bottle.tar.gz 🍺 /usr/local/Cellar/libgccjit/11.3.0: 13 files, 36.4MB ==> Installing d12frosted/emacs-plus/emacs-plus@29 dependency: gcc ==> Pouring gcc–11.3.0.big_sur.bottle.tar.gz 🍺 /usr/local/Cellar/gcc/11.3.0: 2,162 files, 460.7MB ==> Installing d12frosted/emacs-plus/emacs-plus@29 --with-native-comp ==> Patching ==> Applying fix-window-role.patch patching file src/nsterm.m Hunk #1 succeeded at 8747 (offset -21 lines). ==> Applying system-appearance.patch patching file src/frame.h patching file src/nsfns.m Hunk #1 succeeded at 1319 (offset 63 lines). patching file src/nsterm.m Hunk #1 succeeded at 1924 (offset 35 lines). Hunk #2 succeeded at 5459 (offset 64 lines). Hunk #3 succeeded at 5705 (offset 64 lines). Hunk #4 succeeded at 5755 (offset 64 lines). Hunk #5 succeeded at 5981 (offset 64 lines). Hunk #6 succeeded at 9080 (offset 178 lines). Hunk #7 succeeded at 10236 (offset 178 lines). ==> ./autogen.sh ==> ./configure --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus@29/29.0.50/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus@29/29.0 Last 15 lines from /Users/basab.maulik/Library/Logs/Homebrew/emacs-plus@29/02.configure: checking for jansson >= 2.7… yes checking for sys/inotify.h… no checking for libkqueue… no checking for library containing kqueue… none required checking for jpeglib 6b or later… -ljpeg checking for lcms2… yes checking for library containing inflateEnd… -lz checking for dladdr… yes checking for dlfunc… no usage: dirname path checking for gcc_jit_context_acquire in -lgccjit… no configure: error: ELisp native compiler was requested, but libgccjit was not found. Please try installing libgccjit or a similar package. If you are sure you want Emacs be compiled without ELisp native compiler, pass the --without-native-compilation option to configure.

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 42 (20 by maintainers)

Commits related to this issue

Most upvoted comments

Haha. The same fix I did was applied in Emacs master now - https://github.com/emacs-mirror/emacs/commit/faa29fa2c9e9d5a5d7544a1a39b2a89cf57a8439. So removing my patch. Looks like my speculation was correct.

Found an interesting thing in the libgccjit formula:

https://github.com/Homebrew/homebrew-core/blob/b785a45919c2915aa2de3e53390c7a3c4d383a11/Formula/libgccjit.rb#L3-L14

  if Hardware::CPU.arm?
    # Branch from the Darwin maintainer of GCC with Apple Silicon support,
    # located at https://github.com/iains/gcc-darwin-arm64 and
    # backported with his help to gcc-11 branch. Too big for a patch.
    url "https://github.com/fxcoudert/gcc/archive/refs/tags/gcc-11.2.0-arm-20211124.tar.gz"
    sha256 "d7f8af7a0d9159db2ee3c59ffb335025a3d42547784bee321d58f2b4712ca5fd"
    version "11.3.0"
  else
    url "https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.xz"
    mirror "https://ftpmirror.gnu.org/gcc/gcc-11.3.0/gcc-11.3.0.tar.xz"
    sha256 "b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39"
  end

Notice the link for M1, it has gcc-11.2.0 in it:

url "https://github.com/fxcoudert/gcc/archive/refs/tags/gcc-11.2.0-arm-20211124.tar.gz"

I am complete noob when it comes to all those .so and .dlyb files, so I would appreciate comments from someone who understands this better. My guess is that the build is broken because of gcc upgrade. New build uses .dlyb instead of .so and Emacs configure script was not adapted. But it works for M1 machines because the link was not upgraded for M1 🤔

I will need to inspect bottles of 11.3 and 11.2 to understand if it’s really the case.

Also I need to understand why env change breaks the build on non M1 machines.

Few questions that I hope to answer in the next few days.

Thanks everyone for the help with debugging this. I hope to provide a solution soon.

Just wanted to add, I really appreciate you looking at this and the work you’ve put into sharing this brew recipe. You’re awesome!

Woohoo, finally writing this in Emacs. I was very annoyed that I had to lose an entire day of work because of this issue, but I’m very grateful you could address it quickly enough so I didn’t have to go back to using non-native.

It’s fantastic that we have “rebels” who won’t submit to any status quo and would go to extraordinary lengths to figure out things that work on their terms. Thank you @d12frosted.

@agzam I just cd to the dir which I get from brew tap-info d12frosted/emacs-plus and then git switch fix/intel-native-comp. For me #457 works.

Thank you so much! ❤️

@d12frosted thanks!!! Can confirm - still works for me!

@d12frosted Thanks for the effort!

Okay, removed my fix. Hope it works for everyone now.

I tried your suggestion but ran into the same error, libgccjit is listed as a dependency of emacs-plus@29 so it got reinstalled.