Closed baskmau closed 2 years ago
% brew config HOMEBREW_VERSION: 3.4.9 ORIGIN: https://github.com/Homebrew/brew HEAD: d0a0bbef8db45cca303c607037338d02d8eaa8ca Last commit: 5 hours ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: c8a327ce86e7dd61c434855528c6d9a96d0237f8 Core tap last commit: 62 minutes ago Core tap branch: master HOMEBREW_PREFIX: /usr/local HOMEBREW_CASK_OPTS: [] HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core HOMEBREW_MAKE_JOBS: 16 Homebrew Ruby: 2.6.8 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/bin/ruby CPU: 16-core 64-bit kabylake Clang: 13.0.0 build 1300 Git: 2.36.0 => /usr/local/bin/git Curl: 7.64.1 => /usr/bin/curl macOS: 11.6.5-x86_64 CLT: 13.2.0.0.1.1638488800 Xcode: 13.2.1
For me the configure
step passes but it fails at make
:
Hunk #7 succeeded at 10236 (offset 178 lines).
==> ./autogen.sh
==> ./configure --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp --infodir=/opt/homebrew/Cellar/emacs-plus@29/
==> make
Last 15 lines from /Users/damien/Library/Logs/Homebrew/emacs-plus@29/03.make:
2022-04-27 11:19:46 +0000
make
If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/d12frosted/homebrew-emacs-plus/issues
These open issues may also help:
brew install emacs-plus@29 --with-native-comp is failing https://github.com/d12frosted/homebrew-emacs-plus/issues/455
Same issue here. I tried reinstalling libgccjit and removing the contents of ~/Library/Caches/Homebrew
but neither changed the error nor fixed the issue:
==> ./configure --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus@29/29.
Last 15 lines from /Users/REDACTED/Library/Logs/Homebrew/emacs-plus@29/02.configure:
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
dirname: missing operand
Try 'dirname --help' for more information.
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.
brew config
HOMEBREW_VERSION: 3.4.9
ORIGIN: https://github.com/Homebrew/brew
HEAD: d0a0bbef8db45cca303c607037338d02d8eaa8ca
Last commit: 13 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 34a3500d70a037969cfd3b4cc7148e92c1fd007b
Core tap last commit: 58 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core
HOMEBREW_EDITOR: vim
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 16
Homebrew Ruby: 2.6.8 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/bin/ruby
CPU: 16-core 64-bit kabylake
Clang: 13.0.0 build 1300
Git: 2.36.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.6.5-x86_64
CLT: 13.2.0.0.1.1638488800
Xcode: N/A
==> ENV
CC: /usr/bin/clang
CXX: /usr/bin/clang++
OBJC: /usr/bin/clang
OBJCXX: /usr/bin/clang++
CFLAGS: -Os -w -pipe -march=nehalem -mmacosx-version-min=11 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include -I/usr/local/opt/gmp/include -I/usr/local/opt/jpeg/include
CXXFLAGS: -Os -w -pipe -march=nehalem -mmacosx-version-min=11 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
CPPFLAGS: -I/usr/local/opt/zlib/include -I/usr/local/opt/icu4c/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include -I/usr/local/opt/libffi/include -F/usr/local/Frameworks -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
LDFLAGS: -L/usr/local/opt/zlib/lib -L/usr/local/opt/icu4c/lib -L/usr/local/opt/sqlite/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libffi/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -L/usr/local/lib/gcc/11 -I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include -I/usr/local/opt/gmp/include -I/usr/local/opt/jpeg/include
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
MAKEFLAGS: -j16
CMAKE_PREFIX_PATH: /usr/local/opt/zlib:/usr/local/opt/gnu-getopt:/usr/local/opt/icu4c:/usr/local/opt/sqlite:/usr/local/opt/openssl@1.1:/usr/local/opt/readline:/usr/local/opt/m4:/usr/local/opt/libffi:/usr/local/opt/texinfo:/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr
CMAKE_FRAMEWORK_PATH: /usr/local/Frameworks:/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks
PKG_CONFIG_PATH: /usr/local/opt/imagemagick/lib/pkgconfig:/usr/local/opt/zlib/share/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/gnu-getopt/share/pkgconfig:/usr/local/opt/gnu-getopt/lib/pkgconfig:/usr/local/opt/icu4c/share/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/sqlite/share/pkgconfig:/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/openssl@1.1/share/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig:/usr/local/opt/readline/share/pkgconfig:/usr/local/opt/readline/lib/pkgconfig:/usr/local/opt/m4/share/pkgconfig:/usr/local/opt/m4/lib/pkgconfig:/usr/local/opt/libffi/share/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/texinfo/share/pkgconfig:/usr/local/opt/texinfo/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/11:/usr/lib/pkgconfig
HOMEBREW_GIT: git
ACLOCAL_PATH: /usr/local/opt/zlib/share/aclocal:/usr/local/opt/gnu-getopt/share/aclocal:/usr/local/opt/icu4c/share/aclocal:/usr/local/opt/sqlite/share/aclocal:/usr/local/opt/openssl@1.1/share/aclocal:/usr/local/opt/readline/share/aclocal:/usr/local/opt/m4/share/aclocal:/usr/local/opt/libffi/share/aclocal:/usr/local/opt/texinfo/share/aclocal
PATH: /usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/zlib/bin:/usr/local/opt/gnu-getopt/bin:/usr/local/opt/icu4c/bin:/usr/local/opt/sqlite/bin:/usr/local/opt/openssl@1.1/bin:/usr/local/opt/readline/bin:/usr/local/opt/m4/bin:/usr/local/opt/libffi/bin:/usr/local/opt/texinfo/bin:/usr/local/Homebrew/Library/Homebrew/shims/shared:/Users/REDACTED/.asdf/shims:/Users/REDACTED/.asdf/bin:/Users/REDACTED/.zplug/repos/zplug/zplug/bin:/Users/REDACTED/.zplug/bin:/Users/REDACTED/.nvm/versions/node/v14.4.0/bin:/usr/local/bin:/Library/TeX/texbin:/Users/REDACTED/.cargo/bin:/Users/REDACTED/.local/bin:/Users/REDACTED/Library/Python/2.7/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Users/REDACTED/Go/bin:/usr/local/opt/go/libexec/bin:/Users/REDACTED/Applications/sonar-scanner/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/fzf/bin:/usr/bin:/bin:/usr/sbin:/sbin
CPATH: /usr/local/include:/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include
❯ ls -al include
total 208
drwxr-xr-x 4 REDACTED admin 128 Apr 21 04:32 .
drwxr-xr-x 14 REDACTED admin 448 Apr 27 09:35 ..
-rw-r--r-- 1 REDACTED admin 51202 Apr 21 04:32 libgccjit++.h
-rw-r--r-- 1 REDACTED admin 50499 Apr 21 04:32 libgccjit.h
❯ ls -al lib/gcc/11
total 69984
drwxr-xr-x 4 REDACTED admin 128 Apr 21 04:32 .
drwxr-xr-x 3 REDACTED admin 96 Apr 21 04:32 ..
-r--r--r-- 1 REDACTED admin 35829360 Apr 27 09:35 libgccjit.0.dylib
lrwxr-xr-x 1 REDACTED admin 17 Apr 21 04:32 libgccjit.dylib -> libgccjit.0.dylib
❯ strings /usr/local/opt/libgccjit/lib/gcc/11/libgccjit.0.dylib | grep -i gcc_jit_context_acquire
%s = gcc_jit_context_acquire ();
I had no libgccjit
installed before and brew install emacs-plus@29 --with-native-comp
succeeded. My wild guess would be - try removing libgccjit
and installing emacs-plus@29
again.
$ brew uninstall emacs-plus@29 # ok to fail
$ brew uninstall libgccjit
$ brew install emacs-plus@29 --with-native-comp
I tried your suggestion but ran into the same error, libgccjit is listed as a dependency of emacs-plus@29 so it got reinstalled.
Yeah, it should be installed. I just thought that maybe something is not linked properly 🤷 Cause for me emacs-plus@29
works with latest libgccjit
from brew
. Let me double check that it's not something on Emacs master branch.
Works with abc92b0d56 Fix previous change in test/Makefile.in
. CI is also green. So looks rather like a local issue, possibly related to libgccjit
update.
Could you try the following?
$ brew uninstall libgccjit # ok to fail
$ brew install libgccjit
$ brew test libgccjit
❯ brew uninstall libgccjit
Uninstalling /usr/local/Cellar/libgccjit/11.3.0... (13 files, 36.4MB)
❯ brew install libgccjit
==> Downloading https://ghcr.io/v2/homebrew/core/libgccjit/manifests/11.3.0
Already downloaded: /Users/AUCM/Library/Caches/Homebrew/downloads/871b114625dff6a9f75b38649df5a014e260dc952386cfbd3d2bc0f6943f263b--libgccjit-11.3.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libgccjit/blobs/sha256:4cce8e0cf231b7d52cb17cdd45af65d340bac1a8b6b2d
Already downloaded: /Users/AUCM/Library/Caches/Homebrew/downloads/964e7187fde9558e672c0eb2f98960273476fbf2347ef1f3859a5c9e4bef2bb5--libgccjit--11.3.0.big_sur.bottle.tar.gz
==> Pouring libgccjit--11.3.0.big_sur.bottle.tar.gz
🍺 /usr/local/Cellar/libgccjit/11.3.0: 13 files, 36.4MB
==> Running `brew cleanup libgccjit`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
❯ brew test --verbose libgccjit
...lots of fetching rubygems output...
==> Testing libgccjit
==> /usr/local/opt/gcc/bin/gcc-11 -I/usr/local/Cellar/libgccjit/11.3.0/include test-libgccjit.c -o test -L/usr/local/lib/gcc/11 -lgccjit
==> ./test
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!
it seems to me that the compiler does not look for lgccjit under /usr/local/lib/gcc/11 when compiling emacs...
I don't know what the defaults are and if anything has changed here with the upgrade of gcc and libgccjit. In any case, it no longer works with me since then.
I tried to compile the hello world example from the libgccjit docs and it only compiles when specifying the libpath via -L/usr/local/lib/gcc/11
. Again I don't know if this is the intended default behavior. But it may help to solve this issue.
@gwbrck interesting :thinking:
Here is the code responsible for making sure required -L
and -I
flags are set
I guess two things may go "wrong":
Formula["gcc"].any_installed_version
could be something else than 11
.HOMEBREW_PREFIX
is not equal to /usr/local/
for some reason.I would appreciate if someone debugs it.
One of the ways is to clone this repo, add some print statements and run ./build 29 --with-native-comp
from the root of repository. This will create an EmacsPlusLocal
from emacs-plus@29
formula and build it without affecting any installed emacs-plus
. Example of things to debug:
p "gcc_ver = #{gcc_ver}"
p "HOMEBREW_PREFIX = #{HOMEBREW_PREFIX}"
p "gcc_lib = #{gcc_lib}"
And I will also try to reproduce it on a different machine.
mhhh maybe my suspicion was wrong. This looks alright:
gcc_ver = 11.3.0
HOMEBREW_PREFIX = /usr/local
gcc_lib = /usr/local/lib/gcc/11
libgccjit_h = /usr/local/opt/libgccjit/include
But still: "checking for gcc_jit_context_acquire in -lgccjit... no configure: error: ELisp native compiler was requested, but libgccjit was not found.".
Thanks for checking.
I checked provided build logs again and noticed these lines related to dirname
.
dirname: missing operand
Try 'dirname --help' for more information.
checking for gcc_jit_context_acquire in -lgccjit... no
Turns out, Emacs has a special libgccjit
check for macOS:
if test "${opsys}" = "darwin"; then
# Ensure libgccjit installed by Homebrew or macports can be found.
if test -n "$BREW"; then
if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then
MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
grep libgccjit.h))"
MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit| \
grep libgccjit.so\$))"
fi
fi
I suspect that this fails here. So can someone with failing build share the output of the following command?
$ brew ls -v libgccjit
I suspect that either libgccjit.h
or libgccjit.so
are missing there.
ok I played arround a little. When I revert this commit https://github.com/d12frosted/homebrew-emacs-plus/commit/edb5b2533c8055242eb40e825d2c8bb011178ea1 everything works again.
EDIT Sorry just saw your answer...
@gwbrck 🤔 That commit has introduced environment change from superenv to standard (env :std
) in order to capture user PATH
. Might be the case. Though would still appreciate output of brew ls -v libgccjit
🙏
the output you asked for:
/usr/local/Cellar/libgccjit/11.3.0/INSTALL_RECEIPT.json
/usr/local/Cellar/libgccjit/11.3.0/.brew/libgccjit.rb
/usr/local/Cellar/libgccjit/11.3.0/ChangeLog
/usr/local/Cellar/libgccjit/11.3.0/include/libgccjit++.h
/usr/local/Cellar/libgccjit/11.3.0/include/libgccjit.h
/usr/local/Cellar/libgccjit/11.3.0/README
/usr/local/Cellar/libgccjit/11.3.0/COPYING.LIB
/usr/local/Cellar/libgccjit/11.3.0/COPYING
/usr/local/Cellar/libgccjit/11.3.0/COPYING.RUNTIME
/usr/local/Cellar/libgccjit/11.3.0/NEWS
/usr/local/Cellar/libgccjit/11.3.0/lib/gcc/11/libgccjit.dylib
/usr/local/Cellar/libgccjit/11.3.0/lib/gcc/11/libgccjit.0.dylib
/usr/local/Cellar/libgccjit/11.3.0/share/info/libgccjit.info
@gwbrck thanks! Indeed, it lacks libgccjit.so
. On my machine I have the following output:
/opt/homebrew/Cellar/libgccjit/11.3.0/INSTALL_RECEIPT.json
/opt/homebrew/Cellar/libgccjit/11.3.0/.brew/libgccjit.rb
/opt/homebrew/Cellar/libgccjit/11.3.0/ChangeLog
/opt/homebrew/Cellar/libgccjit/11.3.0/include/libgccjit++.h
/opt/homebrew/Cellar/libgccjit/11.3.0/include/libgccjit.h
/opt/homebrew/Cellar/libgccjit/11.3.0/README
/opt/homebrew/Cellar/libgccjit/11.3.0/README.md
/opt/homebrew/Cellar/libgccjit/11.3.0/COPYING.LIB
/opt/homebrew/Cellar/libgccjit/11.3.0/COPYING
/opt/homebrew/Cellar/libgccjit/11.3.0/COPYING.RUNTIME
/opt/homebrew/Cellar/libgccjit/11.3.0/lib/gcc/11/libgccjit.so.0
/opt/homebrew/Cellar/libgccjit/11.3.0/lib/gcc/11/libgccjit.so.0.0.1
/opt/homebrew/Cellar/libgccjit/11.3.0/lib/gcc/11/libgccjit.so
/opt/homebrew/Cellar/libgccjit/11.3.0/share/info/libgccjit.info
Found an interesting thing in the libgccjit
formula:
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.
@gwbrck I am still curious, why it works with superenv
. So I played around a little bit with checks that Emacs performs in configure.ac
and two environments provided by brew
.
But before I dive into this, let me comment on configure.ac
code that I quoted. I misunderstood it's purpose. It turns out, it is there to figure out CFLAGS
and LIBS
on macOS if brew
or MacPorts are installed. But then it actually checks if gccjit
can be found.
Now, with superenv
(e.g. before edb5b2533c8055242eb40e825d2c8bb011178ea1) there is no brew
in PATH
. Which means that configure.ac
doesn't try to figure out the values of CFLAGS
and LIBS
. The check works (e.g. call to AC_CHECK_LIB
) because we manually set all the needed flags in formula.
Which kind of means that these lines are redundant if the 'figuring out' part works. But it doesn't because brew
is not in the PATH
. And as far as I understand, this is the reason why some other people's scripts for installing Emacs with native compilation do not require CFLAGS
manipulations.
Now, if we switch to std
environment, it means that user environment is being preserved, meaning that brew
is on the PATH
. And now this 'figuring out' procedure from configuration.ac
enters the scene. And since on M1 there is libgccjit.so
is present, the build works! But since it is missing on Intel, the build fails there with these lines:
dirname: missing operand
Try 'dirname --help' for more information.
checking for gcc_jit_context_acquire in -lgccjit... no
Now... some might say that the obvious solution is to revert edb5b2533c8055242eb40e825d2c8bb011178ea1, but I am not so sure, because it fixes native compilation feature usage for some users. So instead I will search for a better solution. Like, ideally I don't want to use std
environment, but I could not find any other solution to get user PATH
in the formula. If someone knows a better solution, please let me know. Otherwise I will try patching configure.ac
script to work with dlyb
.
I would be grateful if someone could validate if #457 fixes this issue for emacs-plus@29
. And if it does, I will apply it to emacs-plus@28
as well. And then will start looking for a better solution.
It's still failing for me. I have tried reinstalling libgccjit; tried installing libgccjit with --HEAD flag; tried removing it completely; tried reinstalling xcode command line tools. Nothing helped. I still can't install emacs-plus@29 with native comp. Monterey on 2019 Mac (Intel chip).
I would be grateful if someone could validate if #457 fixes this issue for
emacs-plus@29
How do you run install
with a formula in specific branch?
@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.
@gwbrck great to hear, then merging 🤞
@agzam try now :) don't forget to brew update
first
I just cd to the dir which I get from
brew tap-info d12frosted/emacs-plus
and thengit switch fix/intel-native-comp
brew install https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/3d3f9c84f28de9d367990ee3aeba58fb8d4cdda4/Formula/emacs-plus%4029.rb --with-native-comp
should also work, right?
I mean, since it's merged already I don't have to do that anymore, but I'm still curious.
I'm reinstalling libgccjit at the moment, once it's done, I'll try installing emacs-plus@29 again.
@agzam actually idk. But I don't think so.
@d12frosted you said that you wanted to do something similar for emacs@28. Fyi I never had problems installing emacs@28 --with-native-comp.
I would be grateful if someone could validate if #457 fixes this issue for
emacs-plus@29
. And if it does, I will apply it toemacs-plus@28
as well. And then will start looking for a better solution.
@gwbrck ah right, I didn't enable standard env on 28 🤦 so no need.
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.
Hi, I'm still having trouble with emacs-plus@29 - maybe I haven't fetched all the right changes? It may be because this machine is still running macOS 11.6.5 (for now...).
Seems like I've got the new inference patch from #457 (thanks!) but it doesn't apply properly.
$ brew uninstall libgccjit
$ brew update
$ brew install emacs-plus@29 --with-native-comp
<snip>
HEAD is now at faa29fa2c9 Find libgccjit.dylib on Homebrew Macos
==> Installing emacs-plus@29 from d12frosted/emacs-plus
==> Installing dependencies for d12frosted/emacs-plus/emacs-plus@29: libgccjit
==> 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 --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).
==> Applying fix-MAC_LIBS-inference-on-Intel.patch
patching file configure.ac
Hunk #1 FAILED at 4125.
1 out of 1 hunk FAILED -- saving rejects to file configure.ac.rej
configure.ac.rej
contains, if I run the install with --debug
and then view the file:
***************
*** 4125,4132 ****
if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then
MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
grep libgccjit.h))"
- MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit| \
- grep libgccjit.so\$))"
fi
fi
--- 4125,4131 ----
if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then
MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \
grep libgccjit.h))"
+ MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit | grep libgccjit.dylib\$ || $BREW ls -v libgccjit | grep libgccjit.so\$))"
fi
fi
Hi, I'm still having trouble with emacs-plus@29 - maybe I haven't fetched all the right changes? It may be because this machine is still running macOS 11.6.5 (for now...).
Seems like I've got the new inference patch from #457 (thanks!) but it doesn't apply properly.
$ brew uninstall libgccjit $ brew update $ brew install emacs-plus@29 --with-native-comp <snip> HEAD is now at faa29fa2c9 Find libgccjit.dylib on Homebrew Macos ==> Installing emacs-plus@29 from d12frosted/emacs-plus ==> Installing dependencies for d12frosted/emacs-plus/emacs-plus@29: libgccjit ==> 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 --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). ==> Applying fix-MAC_LIBS-inference-on-Intel.patch patching file configure.ac Hunk #1 FAILED at 4125. 1 out of 1 hunk FAILED -- saving rejects to file configure.ac.rej
configure.ac.rej
contains, if I run the install with--debug
and then view the file:*************** *** 4125,4132 **** if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \ grep libgccjit.h))" - MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit| \ - grep libgccjit.so\$))" fi fi --- 4125,4131 ---- if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \ grep libgccjit.h))" + MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit | grep libgccjit.dylib\$ || $BREW ls -v libgccjit | grep libgccjit.so\$))" fi fi
I have the same problem on my M1 macbook. I had to comment out that patch- then it works fine.
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.
Okay, removed my fix. Hope it works for everyone now.
@d12frosted Thanks for the effort!
@d12frosted thanks!!! Can confirm - still works for me!
Ok, seems like the issue is resolved, my hack is not needed anymore. And standard env seems to be working (it just landed in the unfortunate time of new gcc release with a breaking change for Emacs configuration.ac
😹 ).
Thanks everyone for reporting the issue, for helping with debug and for checking them fixes 💯 Glad that everyone can come back to using Emacs in the way they meant to 🎉
Thank you so much! ❤️
Seems like this is broken again 😞
With gcc
and libgccjit
freshly uninstalled, brew install emacs-plus@29 --with-nobu417-big-sur-icon --with-native-comp
:
checking for dladdr... yes
checking for dlfunc... no
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.
@cdlm can you please provide output of brew ls -v libgccjit
?
$ brew ls -v libgccjit
/opt/homebrew/Cellar/libgccjit/11.3.0_1/INSTALL_RECEIPT.json
/opt/homebrew/Cellar/libgccjit/11.3.0_1/.brew/libgccjit.rb
/opt/homebrew/Cellar/libgccjit/11.3.0_1/ChangeLog
/opt/homebrew/Cellar/libgccjit/11.3.0_1/include/libgccjit++.h
/opt/homebrew/Cellar/libgccjit/11.3.0_1/include/libgccjit.h
/opt/homebrew/Cellar/libgccjit/11.3.0_1/README
/opt/homebrew/Cellar/libgccjit/11.3.0_1/COPYING.LIB
/opt/homebrew/Cellar/libgccjit/11.3.0_1/COPYING
/opt/homebrew/Cellar/libgccjit/11.3.0_1/COPYING.RUNTIME
/opt/homebrew/Cellar/libgccjit/11.3.0_1/NEWS
/opt/homebrew/Cellar/libgccjit/11.3.0_1/lib/gcc/11/libgccjit.dylib
/opt/homebrew/Cellar/libgccjit/11.3.0_1/lib/gcc/11/libgccjit.0.dylib
/opt/homebrew/Cellar/libgccjit/11.3.0_1/share/info/libgccjit.info
Just FYI, I can reproduce this too. brew ls -v libgccjit
results in the same output as posted by cdlm.
I haven’t tried to remove libgccjit
, though, because I have Emacs 28 installed, which requires it – by the way, is it OK to have multiple Emacs versions installed with emacs-plus
formulas?
Edit: I removed Emacs 28, removed libgccjit
and tried to install Emacs 29, but I got the same error.
Edit 2: After attempting to install Emacs 29 one more time, it worked! (Emacs 28 was already installed, not sure if this changes things). I don't understand what changed, but it worked 🤷 Ah, I used brew update
too.
Yup… just tried after a few brew upgrade
over the last days and it finally built 🤷🏻♂️
edit: and then it failed again… I'm starting to suspect there's some kind of interaction between emacs-plus@28
and emacs-plus@29
, or between successive builds: I had built 28 as a fallback; 29 failed to find libgccjit
; I unlinked 28, and then 29 built…
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