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

Installation fails with libgccjit (and possibly gcc) 12.1.0 recent release #485

Closed
3 tasks done
jidicula opened this issue Aug 5, 2022 · 58 comments · Fixed by #489 or #542
Closed
3 tasks done

Installation fails with libgccjit (and possibly gcc) 12.1.0 recent release #485

jidicula opened this issue Aug 5, 2022 · 58 comments · Fixed by #489 or #542
Assignees

Comments

@jidicula
Copy link
Contributor

jidicula commented Aug 5, 2022

Please make sure to follow these steps (and mark the checkboxes):

  • run brew update and try to reproduce the issue again
  • run brew doctor, fix all issues and try to reproduce your issue again
  • run brew config and brew doctor and include their output

What you were trying to do

Brew updating all outdated formulas, which included libgccjit and gcc 11.3.0_1 -> 12.1.0 today. Since emacs-plus is a dependent, it got rebuilt too and failed, so I uninstalled it completely and re-ran the install command below (because its reinstall build is known to not work).

What happened (include command output)

$ brew install emacs-plus@28 --verbose --with-elrumo2-icon --with-mailutils --with-xwidgets --with-native-comp --with-imagemagick --with-no-frame-refocus
Command output

PATH value was changed to:
/opt/homebrew/opt/make/libexec/gnubin
/opt/homebrew/opt/autoconf/libexec/gnubin
/opt/homebrew/opt/gnu-sed/libexec/gnubin
/opt/homebrew/opt/gnu-tar/libexec/gnubin
/opt/homebrew/opt/awk/libexec/gnubin
/opt/homebrew/opt/coreutils/libexec/gnubin
/opt/homebrew/opt/pkg-config/libexec/gnubin
/opt/homebrew/opt/texinfo/libexec/gnubin
/opt/homebrew/opt/gnutls/libexec/gnubin
/opt/homebrew/opt/librsvg/libexec/gnubin
/opt/homebrew/opt/little-cms2/libexec/gnubin
/opt/homebrew/opt/jansson/libexec/gnubin
/opt/homebrew/opt/imagemagick/libexec/gnubin
/opt/homebrew/opt/dbus/libexec/gnubin
/opt/homebrew/opt/mailutils/libexec/gnubin
/opt/homebrew/opt/libgccjit/libexec/gnubin
/opt/homebrew/opt/gcc/libexec/gnubin
/opt/homebrew/opt/gmp/libexec/gnubin
/opt/homebrew/opt/jpeg/libexec/gnubin
/opt/homebrew/opt/zlib/libexec/gnubin
/opt/homebrew/opt/make/bin
/opt/homebrew/opt/autoconf/bin
/opt/homebrew/opt/gnu-sed/bin
/opt/homebrew/opt/gnu-tar/bin
/opt/homebrew/opt/awk/bin
/opt/homebrew/opt/coreutils/bin
/opt/homebrew/opt/pkg-config/bin
/opt/homebrew/opt/texinfo/bin
/opt/homebrew/opt/gnutls/bin
/opt/homebrew/opt/librsvg/bin
/opt/homebrew/opt/little-cms2/bin
/opt/homebrew/opt/jansson/bin
/opt/homebrew/opt/imagemagick/bin
/opt/homebrew/opt/dbus/bin
/opt/homebrew/opt/mailutils/bin
/opt/homebrew/opt/libgccjit/bin
/opt/homebrew/opt/gcc/bin
/opt/homebrew/opt/gmp/bin
/opt/homebrew/opt/jpeg/bin
/opt/homebrew/opt/zlib/bin
/opt/homebrew/Library/Homebrew/shims/shared
/usr/bin
/bin
/usr/sbin
/sbin
==> which tar
/opt/homebrew/opt/gnu-tar/libexec/gnubin/tar
==> which ls
/opt/homebrew/opt/coreutils/libexec/gnubin/ls
PATH value was changed to:
/opt/homebrew/opt/make/libexec/gnubin
/opt/homebrew/opt/autoconf/libexec/gnubin
/opt/homebrew/opt/gnu-sed/libexec/gnubin
/opt/homebrew/opt/gnu-tar/libexec/gnubin
/opt/homebrew/opt/awk/libexec/gnubin
/opt/homebrew/opt/coreutils/libexec/gnubin
/opt/homebrew/opt/pkg-config/libexec/gnubin
/opt/homebrew/opt/texinfo/libexec/gnubin
/opt/homebrew/opt/gnutls/libexec/gnubin
/opt/homebrew/opt/librsvg/libexec/gnubin
/opt/homebrew/opt/little-cms2/libexec/gnubin
/opt/homebrew/opt/jansson/libexec/gnubin
/opt/homebrew/opt/imagemagick/libexec/gnubin
/opt/homebrew/opt/dbus/libexec/gnubin
/opt/homebrew/opt/mailutils/libexec/gnubin
/opt/homebrew/opt/libgccjit/libexec/gnubin
/opt/homebrew/opt/gcc/libexec/gnubin
/opt/homebrew/opt/gmp/libexec/gnubin
/opt/homebrew/opt/jpeg/libexec/gnubin
/opt/homebrew/opt/zlib/libexec/gnubin
/opt/homebrew/opt/make/bin
/opt/homebrew/opt/autoconf/bin
/opt/homebrew/opt/gnu-sed/bin
/opt/homebrew/opt/gnu-tar/bin
/opt/homebrew/opt/awk/bin
/opt/homebrew/opt/coreutils/bin
/opt/homebrew/opt/pkg-config/bin
/opt/homebrew/opt/texinfo/bin
/opt/homebrew/opt/gnutls/bin
/opt/homebrew/opt/librsvg/bin
/opt/homebrew/opt/little-cms2/bin
/opt/homebrew/opt/jansson/bin
/opt/homebrew/opt/imagemagick/bin
/opt/homebrew/opt/dbus/bin
/opt/homebrew/opt/mailutils/bin
/opt/homebrew/opt/libgccjit/bin
/opt/homebrew/opt/gcc/bin
/opt/homebrew/opt/gmp/bin
/opt/homebrew/opt/jpeg/bin
/opt/homebrew/opt/zlib/bin
/opt/homebrew/Library/Homebrew/shims/shared
/usr/bin
/bin
/usr/sbin
/sbin
==> which tar
/opt/homebrew/opt/gnu-tar/libexec/gnubin/tar
==> which ls
/opt/homebrew/opt/coreutils/libexec/gnubin/ls
==> Verifying checksum for 'no-frame-refocus-cocoa.patch'
==> Verifying checksum for 'fix-window-role.patch'
==> Verifying checksum for 'system-appearance.patch'
==> Verifying checksum for 'fix-MAC_LIBS-inference-on-Intel.patch'
==> Verifying checksum for 'elrumo2.icns'
==> Downloading https://ftp.gnu.org/gnu/emacs/emacs-28.1.tar.xz
Already downloaded: /Users/jidicula/Library/Caches/Homebrew/downloads/81fae34a5dbd8042af6a70512829e9d4a11e31e7067bf4da5c5bded31f757129--emacs-28.1.tar.xz
==> Verifying checksum for '81fae34a5dbd8042af6a70512829e9d4a11e31e7067bf4da5c5bded31f757129--emacs-28.1.tar.xz'
==> Installing emacs-plus@28 from d12frosted/emacs-plus
PATH value was changed to:
/opt/homebrew/opt/make/libexec/gnubin
/opt/homebrew/opt/autoconf/libexec/gnubin
/opt/homebrew/opt/gnu-sed/libexec/gnubin
/opt/homebrew/opt/gnu-tar/libexec/gnubin
/opt/homebrew/opt/awk/libexec/gnubin
/opt/homebrew/opt/coreutils/libexec/gnubin
/opt/homebrew/opt/pkg-config/libexec/gnubin
/opt/homebrew/opt/texinfo/libexec/gnubin
/opt/homebrew/opt/gnutls/libexec/gnubin
/opt/homebrew/opt/librsvg/libexec/gnubin
/opt/homebrew/opt/little-cms2/libexec/gnubin
/opt/homebrew/opt/jansson/libexec/gnubin
/opt/homebrew/opt/imagemagick/libexec/gnubin
/opt/homebrew/opt/dbus/libexec/gnubin
/opt/homebrew/opt/mailutils/libexec/gnubin
/opt/homebrew/opt/libgccjit/libexec/gnubin
/opt/homebrew/opt/gcc/libexec/gnubin
/opt/homebrew/opt/gmp/libexec/gnubin
/opt/homebrew/opt/jpeg/libexec/gnubin
/opt/homebrew/opt/zlib/libexec/gnubin
/opt/homebrew/opt/make/bin
/opt/homebrew/opt/autoconf/bin
/opt/homebrew/opt/gnu-sed/bin
/opt/homebrew/opt/gnu-tar/bin
/opt/homebrew/opt/awk/bin
/opt/homebrew/opt/coreutils/bin
/opt/homebrew/opt/pkg-config/bin
/opt/homebrew/opt/texinfo/bin
/opt/homebrew/opt/gnutls/bin
/opt/homebrew/opt/librsvg/bin
/opt/homebrew/opt/little-cms2/bin
/opt/homebrew/opt/jansson/bin
/opt/homebrew/opt/imagemagick/bin
/opt/homebrew/opt/dbus/bin
/opt/homebrew/opt/mailutils/bin
/opt/homebrew/opt/libgccjit/bin
/opt/homebrew/opt/gcc/bin
/opt/homebrew/opt/gmp/bin
/opt/homebrew/opt/jpeg/bin
/opt/homebrew/opt/zlib/bin
/opt/homebrew/Library/Homebrew/shims/shared
/usr/bin
/bin
/usr/sbin
/sbin
==> which tar
/opt/homebrew/opt/gnu-tar/libexec/gnubin/tar
==> which ls
/opt/homebrew/opt/coreutils/libexec/gnubin/ls
PATH value was changed to:
/opt/homebrew/opt/make/libexec/gnubin
/opt/homebrew/opt/autoconf/libexec/gnubin
/opt/homebrew/opt/gnu-sed/libexec/gnubin
/opt/homebrew/opt/gnu-tar/libexec/gnubin
/opt/homebrew/opt/awk/libexec/gnubin
/opt/homebrew/opt/coreutils/libexec/gnubin
/opt/homebrew/opt/pkg-config/libexec/gnubin
/opt/homebrew/opt/texinfo/libexec/gnubin
/opt/homebrew/opt/gnutls/libexec/gnubin
/opt/homebrew/opt/librsvg/libexec/gnubin
/opt/homebrew/opt/little-cms2/libexec/gnubin
/opt/homebrew/opt/jansson/libexec/gnubin
/opt/homebrew/opt/imagemagick/libexec/gnubin
/opt/homebrew/opt/dbus/libexec/gnubin
/opt/homebrew/opt/mailutils/libexec/gnubin
/opt/homebrew/opt/libgccjit/libexec/gnubin
/opt/homebrew/opt/gcc/libexec/gnubin
/opt/homebrew/opt/gmp/libexec/gnubin
/opt/homebrew/opt/jpeg/libexec/gnubin
/opt/homebrew/opt/zlib/libexec/gnubin
/opt/homebrew/opt/make/bin
/opt/homebrew/opt/autoconf/bin
/opt/homebrew/opt/gnu-sed/bin
/opt/homebrew/opt/gnu-tar/bin
/opt/homebrew/opt/awk/bin
/opt/homebrew/opt/coreutils/bin
/opt/homebrew/opt/pkg-config/bin
/opt/homebrew/opt/texinfo/bin
/opt/homebrew/opt/gnutls/bin
/opt/homebrew/opt/librsvg/bin
/opt/homebrew/opt/little-cms2/bin
/opt/homebrew/opt/jansson/bin
/opt/homebrew/opt/imagemagick/bin
/opt/homebrew/opt/dbus/bin
/opt/homebrew/opt/mailutils/bin
/opt/homebrew/opt/libgccjit/bin
/opt/homebrew/opt/gcc/bin
/opt/homebrew/opt/gmp/bin
/opt/homebrew/opt/jpeg/bin
/opt/homebrew/opt/zlib/bin
/opt/homebrew/Library/Homebrew/shims/shared
/usr/bin
/bin
/usr/sbin
/sbin
==> which tar
/opt/homebrew/opt/gnu-tar/libexec/gnubin/tar
==> which ls
/opt/homebrew/opt/coreutils/libexec/gnubin/ls
tar --extract --no-same-owner --file /Users/jidicula/Library/Caches/Homebrew/downloads/81fae34a5dbd8042af6a70512829e9d4a11e31e7067bf4da5c5bded31f757129--emacs-28.1.tar.xz --directory /private/tmp/d20220805-49813-ybrbtl
cp -pR /private/tmp/d20220805-49813-ybrbtl/emacs-28.1/. /private/tmp/emacs-plusA28-20220805-49813-k93k2x/emacs-28.1
chmod -Rf +w /private/tmp/d20220805-49813-ybrbtl
==> Patching
cp -p /opt/homebrew/Library/Taps/d12frosted/homebrew-emacs-plus/patches/emacs-28/no-frame-refocus-cocoa.patch /private/tmp/emacs-plusA28--patch-20220805-49813-18kjlxt/no-frame-refocus-cocoa.patch
==> Applying no-frame-refocus-cocoa.patch
patch -g 0 -f -p1 -i /private/tmp/emacs-plusA28--patch-20220805-49813-18kjlxt/no-frame-refocus-cocoa.patch
patching file src/frame.c
Hunk #1 succeeded at 2118 (offset 62 lines).
cp -p /opt/homebrew/Library/Taps/d12frosted/homebrew-emacs-plus/patches/emacs-28/fix-window-role.patch /private/tmp/emacs-plusA28--patch-20220805-49813-1vhjp6l/fix-window-role.patch
==> Applying fix-window-role.patch
patch -g 0 -f -p1 -i /private/tmp/emacs-plusA28--patch-20220805-49813-1vhjp6l/fix-window-role.patch
patching file src/nsterm.m
Hunk #1 succeeded at 8583 (offset -185 lines).
cp -p /opt/homebrew/Library/Taps/d12frosted/homebrew-emacs-plus/patches/emacs-28/system-appearance.patch /private/tmp/emacs-plusA28--patch-20220805-49813-1qvni9a/system-appearance.patch
==> Applying system-appearance.patch
patch -g 0 -f -p1 -i /private/tmp/emacs-plusA28--patch-20220805-49813-1qvni9a/system-appearance.patch
patching file src/frame.h
patching file src/nsfns.m
Hunk #1 succeeded at 1315 (offset 59 lines).
patching file src/nsterm.m
Hunk #1 succeeded at 1878 (offset -11 lines).
Hunk #2 succeeded at 5389 (offset -6 lines).
Hunk #3 succeeded at 5635 (offset -6 lines).
Hunk #4 succeeded at 5685 (offset -6 lines).
Hunk #5 succeeded at 5911 (offset -6 lines).
Hunk #6 succeeded at 8916 (offset 14 lines).
Hunk #7 succeeded at 10072 (offset 14 lines).
cp -p /opt/homebrew/Library/Taps/d12frosted/homebrew-emacs-plus/patches/emacs-28/fix-MAC_LIBS-inference-on-Intel.patch /private/tmp/emacs-plusA28--patch-20220805-49813-185fy3h/fix-MAC_LIBS-inference-on-Intel.patch
==> Applying fix-MAC_LIBS-inference-on-Intel.patch
patch -g 0 -f -p1 -i /private/tmp/emacs-plusA28--patch-20220805-49813-185fy3h/fix-MAC_LIBS-inference-on-Intel.patch
patching file configure.ac
Hunk #1 succeeded at 3843 (offset -282 lines).
PATH value was changed to:
/opt/homebrew/opt/make/libexec/gnubin
/opt/homebrew/opt/autoconf/libexec/gnubin
/opt/homebrew/opt/gnu-sed/libexec/gnubin
/opt/homebrew/opt/gnu-tar/libexec/gnubin
/opt/homebrew/opt/awk/libexec/gnubin
/opt/homebrew/opt/coreutils/libexec/gnubin
/opt/homebrew/opt/pkg-config/libexec/gnubin
/opt/homebrew/opt/texinfo/libexec/gnubin
/opt/homebrew/opt/gnutls/libexec/gnubin
/opt/homebrew/opt/librsvg/libexec/gnubin
/opt/homebrew/opt/little-cms2/libexec/gnubin
/opt/homebrew/opt/jansson/libexec/gnubin
/opt/homebrew/opt/imagemagick/libexec/gnubin
/opt/homebrew/opt/dbus/libexec/gnubin
/opt/homebrew/opt/mailutils/libexec/gnubin
/opt/homebrew/opt/libgccjit/libexec/gnubin
/opt/homebrew/opt/gcc/libexec/gnubin
/opt/homebrew/opt/gmp/libexec/gnubin
/opt/homebrew/opt/jpeg/libexec/gnubin
/opt/homebrew/opt/zlib/libexec/gnubin
/opt/homebrew/opt/make/bin
/opt/homebrew/opt/autoconf/bin
/opt/homebrew/opt/gnu-sed/bin
/opt/homebrew/opt/gnu-tar/bin
/opt/homebrew/opt/awk/bin
/opt/homebrew/opt/coreutils/bin
/opt/homebrew/opt/pkg-config/bin
/opt/homebrew/opt/texinfo/bin
/opt/homebrew/opt/gnutls/bin
/opt/homebrew/opt/librsvg/bin
/opt/homebrew/opt/little-cms2/bin
/opt/homebrew/opt/jansson/bin
/opt/homebrew/opt/imagemagick/bin
/opt/homebrew/opt/dbus/bin
/opt/homebrew/opt/mailutils/bin
/opt/homebrew/opt/libgccjit/bin
/opt/homebrew/opt/gcc/bin
/opt/homebrew/opt/gmp/bin
/opt/homebrew/opt/jpeg/bin
/opt/homebrew/opt/zlib/bin
/opt/homebrew/opt/gnu-getopt/bin
/opt/homebrew/opt/icu4c/bin
/opt/homebrew/opt/jpeg-turbo/bin
/opt/homebrew/opt/[email protected]/bin
/opt/homebrew/opt/readline/bin
/opt/homebrew/opt/m4/bin
/opt/homebrew/opt/libffi/bin
/opt/homebrew/Library/Homebrew/shims/shared
/Users/jidicula/.rbenv/shims
/opt/homebrew/Cellar/pyenv-virtualenv/1.1.5/shims
/Users/jidicula/.pyenv/shims
/Users/jidicula/.dotnet/tools
/Users/jidicula/.rbenv/bin
/Users/jidicula/.nodenv/shims
/Users/jidicula/.nodenv/bin
/Users/jidicula/.pyenv/bin
/usr/local/opt/openjdk@11/bin
/Users/jidicula/.local/bin
/opt/homebrew/bin
/opt/homebrew/sbin
/usr/local/sbin
/usr/local/bin
/opt/X11/bin
/Library/TeX/texbin
/Users/jidicula/go/bin
/usr/local/plan9/bin
/usr/bin
/bin
/usr/sbin
/sbin
==> which tar
/opt/homebrew/opt/gnu-tar/libexec/gnubin/tar
==> which ls
/opt/homebrew/opt/coreutils/libexec/gnubin/ls
==> ImageMagick PKG_CONFIG_PATH:
/opt/homebrew/opt/imagemagick/lib/pkgconfig
==> ./autogen.sh
Checking whether you have the necessary tools...
(Read INSTALL.REPO for more details on building Emacs)
Checking for autoconf (need at least version 2.65) ... ok
Your system has the required tools.
Running 'autoreconf -fi -I m4' ...
You can now run './configure'.
==> ./configure --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp --infodir=/opt/homebrew/Cellar/emacs-plus@28/28.1/share/info/emacs --prefix=/opt/homebrew/Cellar/emacs-plus@28/28.1 --with-xml2 --with-gnutls --with-native-compilation --without-dbus --with-imagemagick --with-modules --with-rsvg --without-pop --with-xwidgets --with-ns --disable-ns-self-contained
configure: WARNING: unrecognized options: --disable-dependency-tracking
checking for xcrun... xcrun
checking for make... yes
checking for GNU Make... make
checking build system type... aarch64-apple-darwin21.6.0
checking host system type... aarch64-apple-darwin21.6.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /usr/bin/clang accepts -g... yes
checking for /usr/bin/clang option to enable C11 features... none needed
checking whether the compiler is clang... yes
checking for compiler option needed when checking for declarations... -Werror=implicit-function-declaration
checking for ar... ar
checking whether /usr/bin/clang and cc understand -c and -o together... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking for linux/fs.h... no
checking for malloc.h... no
checking for sys/systeminfo.h... no
checking for sys/sysinfo.h... no
checking for coff.h... no
checking for pty.h... no
checking for sys/resource.h... yes
checking for sys/utsname.h... yes
checking for pwd.h... yes
checking for utmp.h... yes
checking for util.h... yes
checking for sanitizer/lsan_interface.h... yes
checking for sys/socket.h... yes
checking for sys/param.h... yes
checking for pthread.h... yes
checking for malloc/malloc.h... yes
checking for sys/un.h... yes
checking for vfork.h... no
checking for dirent.h... yes
checking for execinfo.h... yes
checking for stdio_ext.h... no
checking for sys/vfs.h... no
checking for sys/fs_types.h... no
checking for getopt.h... yes
checking for sys/cdefs.h... yes
checking for sys/time.h... yes
checking for ieee754.h... no
checking for limits.h... yes
checking for sys/select.h... yes
checking for sys/random.h... yes
checking whether it is safe to define EXTENSIONS... yes
checking whether _XOPEN_SOURCE should be defined... no
checking how to run the C preprocessor... /usr/bin/clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for Minix Amsterdam compiler... no
checking for ranlib... ranlib
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether the compiler is clang... yes
checking whether C compiler handles -Werror -Wunknown-warning-option... yes
checking whether C compiler handles -Wno-switch... yes
checking whether C compiler handles -Wno-pointer-sign... yes
checking whether C compiler handles -Wno-string-plus-int... yes
checking whether C compiler handles -Wno-unknown-attributes... yes
checking whether C compiler handles -Wno-initializer-overrides... yes
checking whether C compiler handles -Wno-tautological-compare... yes
checking whether C compiler handles -Wno-tautological-constant-out-of-range-compare... yes
checking for a BSD-compatible install... /opt/homebrew/opt/coreutils/libexec/gnubin/install -c
checking command to symlink files in the same directory... ln -s
checking for install-info... /opt/homebrew/opt/texinfo/bin/install-info
checking for gzip... /opt/homebrew/bin/gzip
checking for 'find' args to delete a file... -delete
checking for brew... brew
checking for makeinfo... /opt/homebrew/opt/texinfo/bin/makeinfo
checking for port... no
checking for -znocombreloc... not needed
checking whether addresses are sanitized... no
checking for library containing sqrt... none required
checking for pkg-config... /opt/homebrew/opt/pkg-config/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for machine/soundcard.h... no
checking for sys/soundcard.h... no
checking for soundcard.h... no
checking for mmsystem.h... no
checking for _oss_ioctl in -lossaudio... no
checking for alsa >= 1.0.0... no
checking for ADDR_NO_RANDOMIZE... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for net/if.h... yes
checking for ifaddrs.h... yes
checking for net/if_dl.h... yes
checking for struct ifreq.ifr_flags... yes
checking for struct ifreq.ifr_hwaddr... no
checking for struct ifreq.ifr_netmask... no
checking for struct ifreq.ifr_broadaddr... yes
checking for struct ifreq.ifr_addr... yes
checking for struct ifreq.ifr_addr.sa_len... yes
checking whether gcc understands -MMD -MF... yes
checking for X... libraries , headers
checking for AppKit/AppKit.h... yes
checking for Mac OS X 10.6 or newer... yes
checking whether the compiler supports GNU Objective C... yes
checking whether /usr/bin/clang accepts -g... yes
checking if the Objective C compiler supports instancetype... yes
checking if the Objective C compiler defaults to C99... yes
checking whether malloc is Doug Lea style... no
checking for sbrk... yes
checking for getpagesize... yes
checking for __lsan_ignore_object... no
checking for fork... yes
checking for vfork... yes
checking for fchmod... yes
checking for canonicalize_file_name... no
checking for faccessat... yes
checking for realpath... yes
checking for lstat... yes
checking for readlinkat... yes
checking for explicit_bzero... no
checking for memset_s... yes
checking for fchmodat... yes
checking for lchmod... yes
checking for fcntl... yes
checking for fdopendir... yes
checking for fstatat... yes
checking for fsync... yes
checking for futimens... yes
checking for getrandom... no
checking for gettimeofday... yes
checking for mkostemp... yes
checking for pipe2... no
checking for pselect... yes
checking for pthread_sigmask... yes
checking for readlink... yes
checking for isblank... yes
checking for iswctype... yes
checking for strtoimax... yes
checking for symlink... yes
checking for localtime_r... yes
checking for timegm... yes
checking for utimensat... yes
checking for getdtablesize... yes
checking for futimes... yes
checking for futimesat... no
checking for lutimes... yes
checking for working mmap... yes
checking for main in -lXbsd... no
checking for pthread library... none needed
checking for thread support... yes
checking for librsvg-2.0 >= 2.14.0... yes
checking for MagickWand >= 7... yes
checking for MagickRelinquishMemory... yes
checking for MagickExportImagePixels... yes
checking for MagickMergeImageLayers... yes
checking for MagickAutoOrientImage... yes
checking for getaddrinfo_a in -lanl... no
checking for lgetfilecon in -lselinux... no
checking for gnutls >= 2.12.2... yes
checking for libsystemd >= 222... no
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
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.

==> Formula
Tap: d12frosted/emacs-plus
Path: /opt/homebrew/Library/Taps/d12frosted/homebrew-emacs-plus/Formula/[email protected]
==> Configuration
HOMEBREW_VERSION: 3.5.8
ORIGIN: https://github.com/Homebrew/brew
HEAD: ff9c2500195cc357d4a06f99d462f8d8a5d37892
Last commit: 2 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 175c052d2f820ae23db10af0fa846c99a014491f
Core tap last commit: 8 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.eZ6nSDv6Ln/org.xquartz:0
HOMEBREW_EDITOR: /usr/bin/env emacs
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 13.1.6 build 1316
Git: 2.37.1 => /opt/homebrew/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.5-arm64
CLT: 13.4.0.0.1.1651278267
Xcode: 13.4.1
Rosetta 2: false
==> ENV
CC: /usr/bin/clang
CXX: /usr/bin/clang++
OBJC: /usr/bin/clang
OBJCXX: /usr/bin/clang++
CFLAGS: -Os -w -pipe -mmacosx-version-min=12 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
CXXFLAGS: -Os -w -pipe -mmacosx-version-min=12 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
CPPFLAGS: -I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/icu4c/include -I/opt/homebrew/opt/jpeg-turbo/include -I/opt/homebrew/opt/[email protected]/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/libffi/include -isystem/opt/homebrew/include -F/opt/homebrew/Frameworks -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
LDFLAGS: -L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/icu4c/lib -L/opt/homebrew/opt/jpeg-turbo/lib -L/opt/homebrew/opt/[email protected]/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/libffi/lib -L/opt/homebrew/lib -F/opt/homebrew/Frameworks -Wl,-headerpad_max_install_names -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
MAKEFLAGS: -j10
CMAKE_PREFIX_PATH: /opt/homebrew/opt/zlib:/opt/homebrew/opt/gnu-getopt:/opt/homebrew/opt/icu4c:/opt/homebrew/opt/jpeg-turbo:/opt/homebrew/opt/[email protected]:/opt/homebrew/opt/readline:/opt/homebrew/opt/m4:/opt/homebrew/opt/libffi:/opt/homebrew/opt/texinfo:/opt/homebrew:/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr
CMAKE_FRAMEWORK_PATH: /opt/homebrew/Frameworks:/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks
PKG_CONFIG_PATH: /opt/homebrew/opt/imagemagick/lib/pkgconfig:/opt/homebrew/opt/zlib/share/pkgconfig:/opt/homebrew/opt/zlib/lib/pkgconfig:/opt/homebrew/opt/gnu-getopt/share/pkgconfig:/opt/homebrew/opt/gnu-getopt/lib/pkgconfig:/opt/homebrew/opt/icu4c/share/pkgconfig:/opt/homebrew/opt/icu4c/lib/pkgconfig:/opt/homebrew/opt/jpeg-turbo/share/pkgconfig:/opt/homebrew/opt/jpeg-turbo/lib/pkgconfig:/opt/homebrew/opt/[email protected]/share/pkgconfig:/opt/homebrew/opt/[email protected]/lib/pkgconfig:/opt/homebrew/opt/readline/share/pkgconfig:/opt/homebrew/opt/readline/lib/pkgconfig:/opt/homebrew/opt/m4/share/pkgconfig:/opt/homebrew/opt/m4/lib/pkgconfig:/opt/homebrew/opt/libffi/share/pkgconfig:/opt/homebrew/opt/libffi/lib/pkgconfig:/opt/homebrew/opt/texinfo/share/pkgconfig:/opt/homebrew/opt/texinfo/lib/pkgconfig
PKG_CONFIG_LIBDIR: /opt/homebrew/lib/pkgconfig:/opt/homebrew/share/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/12:/usr/lib/pkgconfig
HOMEBREW_GIT: git
ACLOCAL_PATH: /opt/homebrew/opt/zlib/share/aclocal:/opt/homebrew/opt/gnu-getopt/share/aclocal:/opt/homebrew/opt/icu4c/share/aclocal:/opt/homebrew/opt/jpeg-turbo/share/aclocal:/opt/homebrew/opt/[email protected]/share/aclocal:/opt/homebrew/opt/readline/share/aclocal:/opt/homebrew/opt/m4/share/aclocal:/opt/homebrew/opt/libffi/share/aclocal:/opt/homebrew/opt/texinfo/share/aclocal
PATH: /opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin:/opt/homebrew/opt/make/bin:/opt/homebrew/opt/autoconf/bin:/opt/homebrew/opt/gnu-sed/bin:/opt/homebrew/opt/gnu-tar/bin:/opt/homebrew/opt/awk/bin:/opt/homebrew/opt/coreutils/bin:/opt/homebrew/opt/pkg-config/bin:/opt/homebrew/opt/texinfo/bin:/opt/homebrew/opt/gnutls/bin:/opt/homebrew/opt/librsvg/bin:/opt/homebrew/opt/little-cms2/bin:/opt/homebrew/opt/imagemagick/bin:/opt/homebrew/opt/dbus/bin:/opt/homebrew/opt/mailutils/bin:/opt/homebrew/opt/gcc/bin:/opt/homebrew/opt/jpeg/bin:/opt/homebrew/opt/gnu-getopt/bin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/jpeg-turbo/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/m4/bin:/opt/homebrew/Library/Homebrew/shims/shared:/Users/jidicula/.rbenv/shims:/opt/homebrew/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/jidicula/.pyenv/shims:/Users/jidicula/.dotnet/tools:/Users/jidicula/.nodenv/shims:/Users/jidicula/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/sbin:/usr/local/bin:/opt/X11/bin:/Library/TeX/texbin:/Users/jidicula/go/bin:/usr/bin:/bin:/usr/sbin:/sbin
CPATH: /opt/homebrew/include:/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include

Error: d12frosted/emacs-plus/emacs-plus@28 28.1 did not build
Logs:
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/02.which
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/04.which
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/00.options.out
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/03.which
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/01.which
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/05.autogen.sh
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/06.configure
/Users/jidicula/Library/Logs/Homebrew/emacs-plus@28/config.log
Do not report this issue to Homebrew/brew or Homebrew/core!

/opt/homebrew/Library/Homebrew/utils/github/api.rb:289:in `raise_error': GitHub API Error: Bad credentials (GitHub::API::AuthenticationFailedError)

Note that the final error about an API token is irrelevant to this issue - I've disabled the GitHub PAT on my machine because of work restrictions.

Output of brew config

$ brew config
HOMEBREW_VERSION: 3.5.8
ORIGIN: https://github.com/Homebrew/brew
HEAD: ff9c2500195cc357d4a06f99d462f8d8a5d37892
Last commit: 2 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 175c052d2f820ae23db10af0fa846c99a014491f
Core tap last commit: 11 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.eZ6nSDv6Ln/org.xquartz:0
HOMEBREW_EDITOR: /usr/bin/env emacs
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 13.1.6 build 1316
Git: 2.37.1 => /opt/homebrew/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.5-arm64
CLT: 13.4.0.0.1.1651278267
Xcode: 13.4.1
Rosetta 2: false

Output of brew doctor

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Putting non-prefixed coreutils in your path can cause GMP builds to fail.

I don't think this warning is relevant, it's a result of my mitigation for #466 .

@jidicula
Copy link
Contributor Author

jidicula commented Aug 5, 2022

I suspect that the libgccjit update breaks something in the emacs-plus formula. For now, I'll try to downgrade libgccjit and attempt rebuilding.

@slidesecurity
Copy link

I just came across this error. Will be looking for your update on downgrading libgccjit.

@jidicula
Copy link
Contributor Author

jidicula commented Aug 5, 2022

Seems to be related to gcc updating to 12.1.0 too in Homebrew/homebrew-core#106755. I'll try downgrading libgccjit, but I suspect I'll also have to downgrade gcc too, which will probably be challenging 😬.

@jidicula
Copy link
Contributor Author

jidicula commented Aug 5, 2022

@slidesecurity here's how to downgrade:

I didn't attempt to not downgrade gcc - I'm betting that gcc 12.1.0 breaks stuff in libgccjit 11.3.0_1 so I opted to downgrade both, re-install emacs-plus, then pin all 3 formulae for now.

brew uninstall emacs-plus
cd "$(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula"
brew uninstall libgccjit gcc # in case you already had the updated gcc and libgccjit installed
git log libgccjit.rb # examine recent commits for libgccjit.rb
git reset --hard 9ae475cc6c82beaa61402dcfffdea5c75f321d4a # reset clone to last known-good commit for libgccjit
git checkout -b libgccjit-downgrade-11.3.0_1 # prevent brew from autorefreshing local master
brew install libgccjit gcc
brew install emacs-plus # with options
brew pin libgccjit gcc emacs-plus
git checkout master
brew update

Generalized answer at https://stackoverflow.com/a/73254186/6310633 (feel free to upvote 😁)

@agzam
Copy link

agzam commented Aug 5, 2022

@jidicula Johanan, you just saved hours of frustration for so many people. Thank you for being so awesome!

@jidicula jidicula changed the title Installation fails with libgccjit 12.1.0 recent release Installation fails with libgccjit (and possibly gcc) 12.1.0 recent release Aug 5, 2022
@maikol-solis
Copy link

@jidicula You are a life saver. I followed your steps and I have Emacs running again. Infinite thanks!

@helinwang
Copy link

helinwang commented Aug 6, 2022

Thanks a lot. I had to run brew uninstall libgccjit gcc instead of brew unlink libgccjit gcc to make it work for me.

@d12frosted
Copy link
Owner

Wow. I just have to say that I am happy to be part of this community 🤗 You folks rock!


@jidicula thanks for sharing your workaround 💯


@bkmit sent a PR that is now in master. It should fix emacs-plus@28 with native comp. Please give it a try and let me know if it doesn't work.


On my side I am upgrading my local machine to be able to test @28 and @29 with native compilation.

@d12frosted
Copy link
Owner

See #492 for similar fix for emacs-plus@29.

@d12frosted
Copy link
Owner

I am pinning this issue untill we fix compilation with nativecomp feature for Emacs 28 and Emacs 29. Fix for Emacs 28 is in master now, fix for Emacs 29 is in #492 (will merge as soon as it becomes green).

I will close once I get enough confirmations that it works for both versions.

Please use this issue to report anything related to libgccjit discovery. I am closing all other duplicates.

@d12frosted
Copy link
Owner

#492 is merged. In order to test it, performa a combination of brew update and brew install emacs-plus@29 --with-native-comp [options]. Let me know if it doesn't work.

@cdlm
Copy link

cdlm commented Aug 9, 2022

Just tried. Failed once and then built on second try of brew uninstall emacs-plus@29; brew install emacs-plus@29 --with-native-comp.

edit: just for fun I tried a couple more times and got two more fails and one build

@roman-rudakov
Copy link

Testing installation of emacs-plus@29.

  • First run: emacs was installed but with the following error:
Error: Failed changing dylib ID of /usr/local/Cellar/emacs-plus@29/29.0.50/Emacs.app/Contents/native-lisp/29.0.50-e74539fe/preloaded/map-ynp-990591b5-b3ff66a7.eln
  from map-ynp-990591b5-b3ff66a7.eln
    to /usr/local/opt/emacs-plus@29/Emacs.app/Contents/native-lisp/29.0.50-e74539fe/preloaded/map-ynp-990591b5-b3ff66a7.eln
Error: Failed to fix install linkage
The formula built, but you may encounter issues using it or linking other
formulae against it.
  • Second run: emacs wasn't installed:
==> ./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/
Last 15 lines from /Users/romanrudakov/Library/Logs/Homebrew/emacs-plus@29/02.configure:
checking for libsystemd >= 222... no
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
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.

Do not report this issue to Homebrew/brew or Homebrew/core!

These open issues may also help:
Could not install emacs-plus@28 because tar can't find xz  https://github.com/d12frosted/homebrew-emacs-plus/issues/481
  • third run: the same as the first one.

Despite linkage error, emacs seems to be working fine.

@liangyungong
Copy link

Same for me.

Despite linkage error, emacs seems to be working fine

@d12frosted
Copy link
Owner

Thanks for testing. Frankly I am disapointed by flakiness and amount of errors related to native compilation.

Will check the linkage error in the evening. Just curious of it's M1 or Intel. Seems like Intel to me.

@roman-rudakov
Copy link

@d12frosted I'm on Intel

@ngn999
Copy link

ngn999 commented Aug 10, 2022

It works on Apple Silicon here.

@d12frosted
Copy link
Owner

@roman-rudakov that's what I though. I am on M1 and it works for me like it works for @ngn999. Will try to get my hands on an intel mac to fix linking there as well.

@liangyungong
Copy link

➕ Intel.

@cdlm
Copy link

cdlm commented Aug 10, 2022

Flakiness on M1 here 😅

@maikol-solis
Copy link

I have an Intel Mac. I unpinned gcc, libgccjit and uninstalled emacs-plus 28.
When I tried to install emacs, I had the problem with the gcc linking. My workaround was brew uninstall gcc --ignore-dependencies and then install again gcc with the newest formula.

Then, reinstall, libgccjit, xz and install emacs-plus with your favorite flags.

For the moment everything is working fine so far.

@codevbus
Copy link

codevbus commented Oct 5, 2022

Meanwhile, I am really curious, does anyone notice real performance improvements with native comp?

For me, native-comp offers noticeable improvements in performance when opening files or working in larger codebases, particularly with any hooks, linting etc...

I understand we can downgrade the gcc toolchain but this shouldn't really be considered a viable option as it will break any tools on your system that have been built against the current installed version.

@d1egoaz
Copy link

d1egoaz commented Oct 19, 2022

I uninstalled my previous emacs-plus@28 and installed newer version using:
brew install emacs-plus@29 --with-native-comp --with-xwidgets --with-no-frame-refocus --verbose

When I opened emacs, the buffer *Async-native-compile-log* got populated with some info:

Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-git.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/emacs-lock.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-rcs.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-cvs.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-svn.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-sccs.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-src.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-bzr.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/vc-hg.el...
Compiling /opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/emacs/29.0.50/lisp/vc/add-log.el...
Compilation finished.
...
Compiling /Users/diegoalvarez/.emacs.d/straight/build-29.0.50/consult/consult.el...
Compiling /Users/diegoalvarez/.emacs.d/straight/build-29.0.50/consult/consult-vertico.el...
Compiling /Users/diegoalvarez/.emacs.d/straight/build-29.0.50/consult-yasnippet/consult-yasnippet.el...
Compiling /Users/diegoalvarez/.emacs.d/straight/build-29.0.50/consult-flycheck/consult-flycheck.el...
Compilation finished.

However, I'm not seeing the functions being native compiled:

vc-dir is an autoloaded, interactive and byte-compiled function
defined in vc-dir.el.
...
consult-find is an autoloaded, interactive and byte-compiled function
defined in consult.el.

My config, running on M1:

HOMEBREW_VERSION: 3.6.6
ORIGIN: https://github.com/Homebrew/brew
HEAD: 978a452ea7ccdff1ed7377f88add3ff0513ba2b7
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 3bf56a42447b961de9f9677e65ab06b19f1f47a5
Core tap last commit: 5 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: emacsclient -t
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.38.0 => /opt/homebrew/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.6-arm64
CLT: 14.0.0.0.1.1661618636
Xcode: N/A
Rosetta 2: false

@d1egoaz
Copy link

d1egoaz commented Oct 19, 2022

It looks like I just got bad luck and got hit by this issue https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-10/msg01805.html

Fix is already on master, will try again later, as I'm currently building Emacs from source (no emacs-plus)

@gf3
Copy link

gf3 commented Nov 9, 2022

hi all, i was able to get emacs 29 with native comp built on an M1 mac running Ventura with the following:

Clean up existing installation and build artifacts

brew uninstall emacs-plus@29
rm -rf ~/Library/Caches/Homebrew/emacs-plus@29--git

Install latest libgccjit and symlink

Note: this is using libgccjit version 12 at the time of writing.

brew install -s libgccjit
cd (brew --prefix)/lib
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.dylib ./
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.0.dylib ./

Install emacs-plus

set -x LIBRARY_PATH (brew --prefix)/lib
brew install emacs-plus@29 --with-native-comp --with-xwidgets --with-imagemagick --with-poll --with-no-frame-refocus --with-modern-sjrmanning-icon --verbose

@MatthieuBrouillard
Copy link

MatthieuBrouillard commented Nov 9, 2022

I confirm the above steps also worked for me on a M1 Mac running Ventura.

@andrew-hm
Copy link

andrew-hm commented Nov 14, 2022

This worked for me. I had to add ignore-dependencies to keep awk from being installed since I use gnu awk instead.

brew uninstall \
    --ignore-dependencies \
    libgccjit \
    gcc \
    emacs-plus
brew install \
    --ignore-dependencies \
    --build-from-source \
    libgccjit \
    gcc
cd "$(brew --prefix)/lib"
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.dylib ./
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.0.dylib ./
cd -
LIBRARY_PATH="$(brew --prefix)/lib" \
    HOMEBREW_NO_INSTALL_CLEANUP=1 \
    brew install \
    --ignore-dependencies \
    emacs-plus@29 \
    --with-native-comp \
    --with-xwidgets \
    --with-imagemagick \
    --with-mailutils \
    --with-poll \
    --with-no-frame-refocus \
    --with-spacemacs-icon

I'm not sold on the ln -s being required or not. Try to build first without performing the soft links in Cellar.

@ghost
Copy link

ghost commented Nov 20, 2022

Ended up downgrading to 28 for a while and just tried again. Failing install using the most recent approach (symlinking libgccjit & install with LIBRARY_PATH set): LIBRARY_PATH="$(brew --prefix)/lib" brew install emacs-plus@29 --with-native-comp --without-cocoa

The install hangs while cloning for about 30 minutes at which point I just cancelled.

==> Downloading https://ghcr.io/v2/homebrew/core/make/manifests/4.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/make/blobs/sha256:5d70e49b345e2
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:8e9fa0d7d946f7c
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.71
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/blobs/sha256:a3d366c98
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gnu-sed/manifests/4.9
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gnu-sed/blobs/sha256:20ae3f853a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gnu-tar/manifests/1.34_1-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gnu-tar/blobs/sha256:d30acbafc1
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/awk/manifests/20220122
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/awk/blobs/sha256:65041e32f93bb2
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/coreutils/manifests/9.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/coreutils/blobs/sha256:6a9a4988
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:2af9bce
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/texinfo/manifests/7.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/texinfo/blobs/sha256:83e127cc70
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2022-
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:1b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/bdw-gc/manifests/8.2.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/bdw-gc/blobs/sha256:01693d25c01
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libtool/manifests/2.4.7
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libtool/blobs/sha256:5f92327e52
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/blobs/sha256:b8b2f
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:9406afa0f
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/guile/manifests/3.0.8_2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/guile/blobs/sha256:56fc54551418
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.21.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:356b52e24b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libidn2/manifests/2.3.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libidn2/blobs/sha256:38eed5a97a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libtasn1/manifests/4.19.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libtasn1/blobs/sha256:cf95a18e2
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/nettle/manifests/3.8.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/nettle/blobs/sha256:f2fa03ad566
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/p11-kit/manifests/0.24.1_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/p11-kit/blobs/sha256:092795b583
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1s
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:c11b17
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libevent/manifests/2.1.12
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libevent/blobs/sha256:4867e07fe
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libnghttp2/manifests/1.50.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libnghttp2/blobs/sha256:ff36afd
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/unbound/manifests/1.17.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/unbound/blobs/sha256:cd06e5b7f6
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gnutls/manifests/3.7.8
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gnutls/blobs/sha256:2de64828679
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libpng/manifests/1.6.38
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libpng/blobs/sha256:f2be24349bf
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/freetype/manifests/2.12.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/freetype/blobs/sha256:3e190f2fa
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fontconfig/manifests/2.14.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fontconfig/blobs/sha256:decbdcc
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.40
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:18b810bc5ddb
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/glib/manifests/2.74.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/glib/blobs/sha256:08af01b696f9a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libpthread-stubs/manifests/0.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libpthread-stubs/blobs/sha256:0
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xorgproto/manifests/2022.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xorgproto/blobs/sha256:d6deb2e4
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxau/manifests/1.0.10
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxau/blobs/sha256:c01ab4cba7b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxdmcp/manifests/1.1.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxdmcp/blobs/sha256:9714ed9df
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxcb/manifests/1.15-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxcb/blobs/sha256:0cdfcc16885
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libx11/manifests/1.8.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libx11/blobs/sha256:8d08dd29849
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxext/manifests/1.3.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxext/blobs/sha256:4f194ef26f
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxrender/manifests/0.9.10
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libxrender/blobs/sha256:fc2e9e3
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/lzo/manifests/2.10
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/lzo/blobs/sha256:e16072e8ef7a88
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pixman/manifests/0.40.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pixman/blobs/sha256:3dbb0582d3c
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/cairo/manifests/1.16.0_5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/cairo/blobs/sha256:50feaae83e93
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg-turbo/manifests/2.1.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg-turbo/blobs/sha256:c9dbfe3
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libtiff/manifests/4.4.0_1-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libtiff/blobs/sha256:b48b8b5166
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gdk-pixbuf/manifests/2.42.10
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gdk-pixbuf/blobs/sha256:5062e2c
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fribidi/manifests/1.0.12
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fribidi/blobs/sha256:e213623dac
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/graphite2/manifests/1.3.14
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/graphite2/blobs/sha256:2254ea02
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/71.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:0bf3c66f005e
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/harfbuzz/manifests/5.3.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/harfbuzz/blobs/sha256:803fcb07d
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pango/manifests/1.50.12
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pango/blobs/sha256:7dc6606472b2
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/librsvg/manifests/2.55.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/librsvg/blobs/sha256:7677c86c5a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/little-cms2/manifests/2.14
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/little-cms2/blobs/sha256:ae03cf
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jansson/manifests/2.14
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jansson/blobs/sha256:f8a132e116
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gcc/manifests/12.2.0-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gcc/blobs/sha256:f37b8d3764f63e
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg/manifests/9e
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg/blobs/sha256:5d4520a90181d
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/manifests/1.2.13
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/blobs/sha256:27b22a6738cbf
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Cloning https://github.com/emacs-mirror/emacs.git
Cloning into '/Users/$USER/Library/Caches/Homebrew/emacs-plus@29--git'...

@d12frosted
Copy link
Owner

@sm0b0 might be your internet connection. Try to manually clone https://github.com/emacs-mirror/emacs.git and see if it works.

@ghost
Copy link

ghost commented Nov 20, 2022

I'll try that, but not sure when - already reinstalled 28 (with native comp is still working there 👍). That also seems to indicate that it's not an internet problem, but who knows.

@otherjoel
Copy link

otherjoel commented Nov 20, 2022

The method @andrew-hm gave recently in #485 (comment) above worked for me yesterday on an M1 mac (Big Sur Montery) with Emacs 29 and Xcode 13.4.1. I did not do the symlinking step.

@jgrey4296
Copy link

jgrey4296 commented Dec 1, 2022

TLDR: check for libgccjit simlinks of .dylib and .h in /usr/local/lib and /usr/local/include, and add those locations to your CPATH and LIBRARY_PATH.

So I was running into this problem, but i'm on MacOS 10.15, which brew keeps telling me is ancient, so i went looking for myself.
Results below in case it helps anyone:

./configure was working fine from a cloned emacs repo,
and the brew clone of 29,
just... not from coming through brew itself.

looking in the logs in ~/library/logs/homebrew/emacs-plus@29/02.configure, it helpfully prints out the C test program for libgccjit, and the clang call that fails.

Removing unecessary -l[lib] calls, it looks like (1) applied to (2), see below.
Even though libgccjit was installled, and brew ls -v libgccjit was finding the locations correctly... clang wasn't getting the arguments as can be seen in (1).

Looking in /usr/local/lib I noticed there wasn't a symlink to the .dylib, so i made one (reinstalling libgcc may be helping people with that bit),
and while there also wasn't a symlink to libgccjit.h in /usr/local/include, clang wasn't getting a -I/usr/local/include argument anyway. I created the symlink all the same.
Calling (1) with -I/usr/local/include added in, and the test file compiled.

So one brew edit emacs-plus@29 later, to add:

  ENV.append "CPATH", "/usr/local/include"
  ENV.append "LIBRARY_PATH", "/usr/local/lib"

on lines 126 and 127, and brew install emacs-plus@29 --with-native-comp worked.

  1. The offensive clang call:
/usr/bin/clang
-o conftest
-Os
-w
-pipe
-march=nehalem
-mmacosx-version-min=10.15
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
-DFD_SETSIZE=10000
-DDARWIN_UNLIMITED_SELECT
-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/ffi
-F/usr/local/Frameworks
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
-L/usr/local/lib
-F/usr/local/Frameworks
-Wl,-headerpad_max_install_names
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk 
conftest.c
-lgccjit

  1. conftest.c file for the above clang call:
    (but you can get away with just a main that calls gcc_jit_context_acquire and the #include... probably)
#include <libgccjit.h>
#include <stdlib.h>
#include <stdio.h>
int main (int argc, char **argv)
{
  gcc_jit_context *ctxt;
  gcc_jit_result *result;
  ctxt = gcc_jit_context_acquire ();
  if (!ctxt)
    exit (1);
  gcc_jit_type *int_type =
    gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
  gcc_jit_function *func =
    gcc_jit_context_new_function (ctxt, NULL,
                                  GCC_JIT_FUNCTION_EXPORTED,
                                  int_type, "foo", 0, NULL, 0);
  gcc_jit_block *block = gcc_jit_function_new_block (func, "foo");
  gcc_jit_block_end_with_return (
                                 block,
                                 NULL,
                                 gcc_jit_context_new_rvalue_from_int (ctxt, int_type, 1));
  result = gcc_jit_context_compile (ctxt);
  if (!result)
    exit (1);
  typedef int (*fn_type) (void);
  fn_type foo =
    (fn_type)gcc_jit_result_get_code (result, "foo");
  if (!foo)
    exit (1);
  if (foo () != 1)
    exit (1);
  gcc_jit_context_release (ctxt);
  gcc_jit_result_release (result);
  return 0;
}

@rprimus
Copy link

rprimus commented Dec 22, 2022

Thu 22 Dec 2022 10:22:52 GMT

With the upgrade to gcc 12, libgccjit is located in ${HOMEBREW_PREFIX}/lib/gcc/current (and no longer in .../lib - where configure expects it).

EDITOR=vim brew edit emacs-plus@29:
At line 124, adding the following:

ENV.append "LIBRARY_PATH", "#{HOMEBREW_PREFIX}/lib/gcc/current" if build.with? "native-comp"

Results in:

checking for gcc_jit_context_acquire in -lgccjit... yes                                                                                                         

HTH.

@Aoterra
Copy link

Aoterra commented Dec 24, 2022

If you have migrated to an Apple silicon machine (like me), you are likely to have brought your homebrew install from its previous location (under /usr/local). Under Apple silicon, homebrew is installed under /opt. I resolved the libgccjit issue by reinstalling homebrew to the proper location - (from https://docs.brew.sh/Common-Issues, copied here for convenience).

To do so, run brew bundle dump, uninstall, reinstall and run brew bundle install.

After everything was reinstalled, I did the following:

brew install -s libgccjit
cd (brew --prefix)/lib
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.dylib ./
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.0.dylib ./

then,

set -x LIBRARY_PATH (brew --prefix)/lib

lastly, running,
brew install emacs-plus@29 --with-native-comp --with-xwidgets --with-imagemagick --with-modern-pen-icon
worked perfectly, no issues.

@ghost
Copy link

ghost commented Dec 25, 2022

Update from me: brew install emacs-plus@30 --with-native-comp --without-cocoa succeeds on a fresh install of MacOS Ventura 13.1 without any additional steps 👍

@jidicula
Copy link
Contributor Author

jidicula commented Dec 26, 2022

Worked on M1 Mac with:

brew uninstall --ignore-dependencies libgccjit gcc
brew install libgccjit --build-from-source --force
brew uninstall emacs-plus
LIBRARY_PATH="$(brew --prefix)/lib" brew install emacs-plus@28 --verbose --with-elrumo2-icon --with-mailutils --with-xwidgets --with-native-comp --with-imagemagick --with-no-frame-refocus

The last step fails when it isn't passed LIBRARY_PATH. I suppose I should add this variable setting to my dotfiles 😁

edit: doesn't seem to work consistently on all my machines... continuing to troubleshoot, but the above at least worked on one of my machines

I followed @jgrey4296's tip but with the paths modified for the M1 macOS Homebrew install location (/opt/homebrew) instead of /usr/local.

  1. Reinstall libgccjit and gcc:
brew reinstall gcc libgccjit
  1. Unlink and relink libgccjit (not 100% sure this step is necessary):
brew unlink -v libgccjit
brew link -v libgccjit
  1. I linked the .dylib files to $HOMEBREW_PREFIX/lib:
cd $(brew --prefix)/lib
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.dylib ./
ln -s ../Cellar/libgccjit/12.2.0/lib/gcc/12/libgccjit.0.dylib ./
  1. EDITOR=nano brew edit emacs-plus@28 and added these lines in line 129:
    ENV.append "CPATH", "#{HOMEBREW_PREFIX}/include"
    ENV.append "LIBRARY_PATH", "#{HOMEBREW_PREFIX}/lib"
  1. Then ran
brew install emacs-plus@28 --verbose --with-elrumo2-icon --with-mailutils --with-xwidgets --with-native-comp --with-imagemagick --with-no-frame-refocus

and it built!


@d12frosted Does this mean there's something broken with the libgccjit formula and what post-install linkage happens (maybe another symlink creation call is needed somewhere around here, but to $HOMEBREW_PREFIX/lib and $HOMEBREW_PREFIX/include)? And once that's fixed, I suppose the emacs-plus formulae need to be patched to append Homebrew's lib and include directories to LIBRARY_PATH?

edit: draft PR for the additional symlink step in the libgccjit formula Homebrew/homebrew-core#119176

@jidicula
Copy link
Contributor Author

jidicula commented Dec 26, 2022

Actually, I think it may be more straightforward to just modify the formulae here with something like:

    ENV.append "CPATH", "#{HOMEBREW_PREFIX}/include"  if build.with? "native-comp"
    ENV.append "LIBRARY_PATH", "#{HOMEBREW_PREFIX}/lib/gcc/current" if build.with? "native-comp"

rather than modifying the homebrew-core libgccjit formula to add an extra linkage step.

I also just did a re-read of this thread and realized that @rprimus already found this solution 🙂

@d12frosted
Copy link
Owner

@jidicula PR is welcome :)

jidicula added a commit to jidicula/homebrew-emacs-plus that referenced this issue Dec 27, 2022
When installed with Homebrew, libgccjit 12 writes header files to the Homebrew
`include` directory and DLLs to Homebrew's `lib/gcc/current` directory. If these
locations are not added to CPATH and LIBRARY_PATH, respectively, the Emacs build
toolchain is unable to locate libgccjit, leading to the build failure described
in d12frosted#485.

This change appends those libgccjit paths to CPATH and LIBRARY_PATH for all
Emacs versions that support the native compilation build flag.

Resolves: d12frosted#485
jidicula added a commit to jidicula/homebrew-emacs-plus that referenced this issue Dec 27, 2022
Since this PR addresses the breakage with native compilation build flags, we can
now re-enable this flag in the CI build matrix to verify the fix.

Related to d12frosted#485
d12frosted pushed a commit that referenced this issue Dec 28, 2022
When installed with Homebrew, libgccjit 12 writes header files to the Homebrew
`include` directory and DLLs to Homebrew's `lib/gcc/current` directory. If these
locations are not added to CPATH and LIBRARY_PATH, respectively, the Emacs build
toolchain is unable to locate libgccjit, leading to the build failure described
in #485.

This change appends those libgccjit paths to CPATH and LIBRARY_PATH for all
Emacs versions that support the native compilation build flag.

Resolves: #485
d12frosted pushed a commit that referenced this issue Dec 28, 2022
Since this PR addresses the breakage with native compilation build flags, we can
now re-enable this flag in the CI build matrix to verify the fix.

Related to #485
@d12frosted
Copy link
Owner

Thanks to @jidicula we have a fix in master. Please do brew update and give it a try. Thanks everyone!

@AtomicNess123
Copy link

I am on a new Ventura machine Macbook Air M1, and am not able ti get my smooth emacs flow...

§ set -x LIBRARY_PATH (brew --prefix)/lib
zsh: no matches found: (brew --prefix)/lib

Any help appreciated!

@AtomicNess123
Copy link

My problem is that my init is not being properly read, it spits problems everywhere of the type Wrong type arguments: markerp, nil, when with my Catalina installation there were any errors. I have to comment lines like (setq lpr-switches '("-Myprinter-Canon")) because it would spit out that error.

@otherjoel
Copy link

Shouldn’t there be a $ in front of (brew --prefix)?

echo $(brew --prefix)
/opt/homebrew

❯ echo (brew --prefix) 
zsh: unknown file attribute: b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment