Coder Social home page Coder Social logo

build-emacs-for-macos's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

build-emacs-for-macos's Issues

Cannot find libgccjit.h

Here is my step to repo this issue:

git clone https://github.com/jimeh/build-emacs-for-macos
cd build-emacs-for-macos
brew bundle
./build-emacs-for-macos feature/native-comp

Here is the error message

checking for gcc_jit_context_acquire in -lgccjit... yes
checking libgccjit.h usability... no
checking libgccjit.h presence... no
checking for libgccjit.h... no
configure: error: elisp native compiler requested but libgccjit header files were
not found.

I checked that libgccjit is already installed by homebrew, here is the result of brew info libgccjit.

❯ brew info libgccjit
libgccjit: stable 10.2.0 (bottled), HEAD
JIT library for the GNU compiler collection
https://gcc.gnu.org/
/usr/local/Cellar/libgccjit/10.2.0 (14 files, 34.6MB) *
  Poured from bottle on 2020-11-18 at 13:10:54
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libgccjit.rb
License: GPL-3.0-or-later with GCC-exception-3.1
==> Dependencies
Required: gmp ✔, isl ✔, libmpc ✔, mpfr ✔
==> Options
--HEAD
	Install HEAD version

Improve CLI integration

I believe CLI integration to get a emacs command for use in terminals can be
improved over the current alias method suggested in the readme.

Essentially, add a shell script called emacs into
Emacs.app/Contents/MacOS/bin, where emacsclient is already located. The
script would need to resolve it's own absolute path on disk, then execute
Emacs from the parent folder passing in -nw arguments.

Then making emacs and emacsclient available in the terminal would simply be
a matter of adding the bin path:

if [ -d "/Applications/Emacs.app/Contents/MacOS/bin" ]; then
  export PATH="/Applications/Emacs.app/Contents/MacOS/bin:$PATH"
fi

As for the emacs shell script in question, I believe this should work:

#!/usr/bin/env bash

resolve_link() {
  "$(type -p greadlink readlink | head -1)" "$1"
}

abs_dirname() {
  local path="$1"
  local name
  local cwd
  cwd="$(pwd)"

  while [ -n "$path" ]; do
    cd "${path%/*}" || exit 1
    name="${path##*/}"
    path="$(resolve_link "$name" || true)"
  done

  pwd
  cd "$cwd" || exit 1
}

exec "$(dirname "$(abs_dirname "$0")")/Emacs" -nw "$@"

I will need to perform a bit of testing to ensure such a wrapper script doesn't
introduce any issues before adding it, but I believe it'll work just fine :)

install_name_tool error while embedding libraries

command -

./build-emacs-for-macos --no-xwidgets --native-full-aot --posix-spawn emacs-28
==> INFO: Embedding libraries for 1504 *.eln files within Emacs.app
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: changing install names or rpaths can't be redone for: /Users/mymac/Documents/build-emacs-for-macos/builds/Emacs.2021-11-10.8d81ab3.emacs-28.macOS-11.x86_64/Emacs.app/Contents/Frameworks/native-lisp/28_0_60-120224af/tag-write-5b235879-c4998f91.eln (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: changing install names or rpaths can't be redone for: /Users/mymac/Documents/build-emacs-for-macos/builds/Emacs.2021-11-10.8d81ab3.emacs-28.macOS-11.x86_64/Emacs.app/Contents/Frameworks/native-lisp/28_0_60-120224af/sendmail-bcf4df3f-e639e570.eln (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
==> INFO: Embedding libgccjit into Emacs.app

Ruby error when creating symlinks for native-comp

I ran ./build-emacs-for-macos --git-sha 33b8ce865fcfd58538ae2d7c3fff04998fcd3330 feature/native-comp and received the following error:

==> INFO: Creating symlinks within Emacs.app needed for native-comp
Traceback (most recent call last):
	6: from ./build-emacs-for-macos:814:in `<main>'
	5: from ./build-emacs-for-macos:99:in `build'
	4: from ./build-emacs-for-macos:360:in `symlink_internals'
	3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:128:in `cd'
	2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:128:in `chdir'
	1: from ./build-emacs-for-macos:365:in `block in symlink_internals'
./build-emacs-for-macos:365:in `basename': no implicit conversion of nil into String (TypeError)

Zero byte sized *.eln files

Sometimes when quitting Emacs while native compilation is running, it will leave
one or more *.eln files behind with a size of zero bytes. These files will
prevent Emacs from launching until they're deleted either manually, or via the
suggested configuration snippet above in the Configuration section.

Currently I work around this issue by finding and deleting any *.eln files in
my eln-cache directory at startup, along with also setting a custom eln-cache
directory:

(when (boundp 'comp-eln-load-path)
  (let ((eln-cache-dir (expand-file-name "cache/eln-cache/"
                                         user-emacs-directory))
        (find-exec (executable-find "find")))
    (setcar comp-eln-load-path eln-cache-dir)
    ;; Quitting emacs while native compilation in progress can leave zero byte
    ;; sized *.eln files behind. Hence delete such files during startup.
    (when find-exec
      (call-process find-exec nil nil nil eln-cache-dir
                    "-name" "*.eln" "-size" "0" "-delete" "-or"
                    "-name" "*.eln.tmp" "-size" "0" "-delete"))))

libgccjit is not bundled into Emacs.app properly

TL;DR: native-comp builds are not fully self-contained at the moment.

It seems that the library embedding mechanism that's in place is not enough to
get libgccjit working for native comp purposes, as it still seems to depend on
the patched gcc Homebrew formula being on disk under
/usr/local/Cellar/gcc/<version>/.

This is easy to test by temporarily renaming the
/usr/local/Cellar/gcc/<version> directory to something else.

I don't know enough about how libgccjit works to even have a rough plan for how
to fix this right now. Any updates or further info I find will be posted here.

Can I build emacs 27.1 with native-comp?

I run doom emacs, and they only support up to emacs 27, readme says that native-comp installs eamcs 28.

What's the difference between these:

  • ./build-emacs-for-macos emacs-27.1 --native-comp
  • ./build-emacs-for-macos feature/native-comp

Emacs won't open: LSOpenURLsWithRole() failed with error -10810

I've been using the a45aed9 build for a few weeks (and before that, have used several previous builds to get native-comp for the past year or so -- thanks for your work!).
I am running macOS 10.14.6 Mojave. Today, after a reboot and installing a Safari 14.1.2 security upgrade, when I started Emacs, it failed.

../Emacs.2021-07-25.a45aed9.master.macOS-10-14.x86_64 $ open Emacs.app
LSOpenURLsWithRole() failed with error -10810 for the file /Users/william/scm/sandinmyjoints/build-emacs-for-macos/builds/Emacs.2021-07-25.a45aed9.master.macOS-10-14.x86_64/Emacs.app.

I deleted the build and sources, then rebuilt with ./build-emacs-for-macos --git-sha a45aed9479f610bcbc7a171b60d915fefc9b586a master but got the same result.

I don't know if this is something that can be fixed on your end. Perhaps it's related to me running an older version of macOS and my only option is to upgrade. But thought I'd post here in case others run into it and/or have any ideas.

configure fails with `error: The following required libraries were not found: gnutls`

For some reason build-emacs-for-macos started failing recently during the Emacs configure phase -- not being able to find gnutls:

bash-5.1$ ./build-emacs-for-macos --git-sha 8ed46b7646de7166aa8bbd3b5d29a4947316c900 feature/native-comp
==> INFO: Fetching info for git ref: 8ed46b7646de7166aa8bbd3b5d29a4947316c900
==> INFO: emacs-mirror-emacs-8ed46b7.tgz already exists locally, attempting to use.
==> INFO: emacs-mirror-emacs-8ed46b7 source tree exists, attempting to use.
==> CMD: ./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'.
==> INFO: Detecting native-comp support: Supported
==> INFO: Compiling from source. This will take a while...
==> INFO: Compiling with native-comp enabled
==> CMD: ./configure --with-ns --with-modules --enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp --with-xwidgets --with-native-compilation --without-rsvg
checking for xcrun... xcrun
...
...
...
checking for GifMakeMapObject in -lgif... yes
configure: error: The following required libraries were not found:
     gnutls
Maybe some development libraries/packages are missing?
To build anyway, give:
     --with-gnutls=ifavailable
as options to configure.
ERROR: Exit code: 1

However it's definitely installed, it's listed in the Brewfile and I've manually reinstalled it:

bash-5.1$ brew list | grep gnutls
gnutls
bash-5.1$ pkg-config --list-all | grep gnutls
gnutls                              GnuTLS - Transport Security Layer implementation for the GNU system
gnutls-dane                         GnuTLS-DANE - DANE security library for the GNU system

This is macOS 10.15 Catalina with Xcode 12.4 and an up-to-date homebrew install:

bash-5.1$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H524

Maybe need add `libwebp.7.dylib` to `Frameworks` folder?

Problems:

After build the emacs, and codesign (#64). My mac return me the panic report that:

dyld[16543]: Library not loaded: @rpath/libwebp.7.dylib
  Referenced from: <8B34F8AD-74B5-371E-AED8-5F8BC7340372> /Applications/Emacs.app/Contents/Frameworks/libwebpdemux.2.dylib
  Reason: tried: '/Applications/Emacs.app/Contents/Frameworks/../lib/libwebp.7.dylib' (no such file), '/Applications/Emacs.app/Contents/Frameworks/libwebp.7.dylib' (no such file), '/Applications/Emacs.app/Contents/Frameworks/libwebp.7.dylib' (no such file), '/usr/local/lib/libwebp.7.dylib' (no such file), '/usr/lib/libwebp.7.dylib' (no such file, not in dyld cache)

Temporary solution:

After some research and debugging, I find it the @rpath value is path @executable_path/../Frameworks (offset 12). After I add homebrew's lib path to @rpath by install_name_tool -add_rpath /opt/homebrew/lib /Applications/Emacs.app/Contents/MacOS/Emacs. The problem is solved. It can get the libwebp.7.dylib now.

I checked the code and find line 170 define extra_libs which copy to Frameworks in embed (maybe? I don't know Ruby).

Maybe we can also copy libwebp.7.dylib too? Thanks!

My env:

macOS 13.4.1
M2 Max
GNU Emacs master branch

cconv.el.gz fails to compile due to missing libgcc_ext.10.5

Currently cconv.el.gz that's part of Emacs fails to natively compile for me,
leading to a error/warning at start up. It also leaves a zero byte sized *.eln
file behind, which can be dealt by with the work around in #3.

As far as I can tell this doesn't seem to actually break anything or prevent
things from working correctly though.

Details

The compile log error:

Compiling /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/cconv.el.gz...
uncompressing cconv.el.gz...
uncompressing cconv.el.gz...done
ld: library not found for -lgcc_ext.10.5
libgccjit.so: error: error invoking gcc driver

Initially I thought it was simply missing the libgcc_ext.10.5.dylib from GCC,
as other libs are bundled into Emacs.app, but libgcc_ext was not. However
manually adding it to the libs to embed/bundle yields this error:

fatal error: /Library/Developer/CommandLineTools/usr/bin/install_name_tool: input file: /Users/jimeh/Projects/build-emacs-for-macos/sources/emacs-mirror-emacs-c818c29/nextstep/Emacs.app/Contents/MacOS/lib-x86_64-10.15/libgcc_ext.10.5.dylib is Mach-O dynamic shared library stub file and can't be changed

Sadly some googling for information about this kind of error and possible
workarounds didn't yield much.

So I tried not bundling libgccjit into Emacs.app, and instead referencing it
from the homebrew install path, but that didn't solve the issue either.

For now I'm out of ideas for how to fix or workaround this.

Update: It seems that cconv.el.gz compiles just fine on my machine if I
launch Emacs into terminal mode:

/Applications/Emacs.app/Contents/MacOS/Emacs -nw

I'll try and dig into why it fails when launched with GUI, but doesn't in
terminal.

lisp-mode eln image not found error

I have built native comp emacs successfully using your script and using the latest git hash that you flagged as working but when launching it I get:

emacs: dlopen(/Applications/Emacs.app/Contents/MacOS/../native-lisp/28.0.50-x86_64-apple-darwin19.6.0-919382e94fb290efe3ee4a93fd4035d3/lisp-mode-0189ba85598c041b7504f0a916c04219-1738806322de892570d69dfc55b437c2.eln, 1): image not found

Any help would be appreciated!

Emacs 27.1 and later builds with SVG image support enabled may crash Emacs on startup

When launching Emacs via Finder, Emacs crashes when trying to determine if it
should use the fancy startup screen or not. Because of this SVG support is no
longer enabled by default, but must instead be explicitly enabled with the
--rsvg flag.

If you do need SVG image support, the work around is to disable the startup
screen as early as possible in your config with:

(setq inhibit-startup-screen t)

I have tracked the issue down to the use-fancy-splash-screens-p function
which runs on startup to determine if the fancy (with images) startup screen
should show or not. It is specifically this call to image-size which
causes it to crash.

The crash can be re-produced in a *scratch* buffer with:

(setq frame (fancy-splash-frame))
(setq img (create-image (fancy-splash-image-file)))
(image-size img nil frame)

Update: Thanks to @zzkt it looks like SVG support does work on macOS 10.14.x
if you disable XWidgets:

./build-emacs-for-macos --rsvg --no-xwidgets feature/native-comp

This does not seem to work on macOS 10.15.x however.

Use emacs repo instead of source files?

Have you considered using a git repo for the source instead of downloading large files for each build? It seems like it would be easier in the long run to use something like submodules. Then building a different commit would be as simple as a git checkout.

I realize this is probably one of those things that will be harder than it sounds when you get into it, but it seems like it might make things easier later.

Runtime native compiled \*.eln files link against libgcc dylib with absolute path

All *.eln files compiled by Emacs at runtime, get linked against
/usr/local/lib/gcc/11/libgcc_s.1.dylib, which doesn't exist unless the gcc
homebrew formula is installed.

I'm not sure where that path comes from, I'm assuming it's hard-coded somewhere
in gcc or libgccjit from the homebrew installed versions.

Manually re-linking a *.eln file against
@executable_path/lib/gcc/11/libgcc_s.1.dylib fixes the issue, but that's a not
really a viable solution.

Ideally I'll need to figure out where that path comes from, and if it can be
changed so @executable_path is used by default. Or worth case potentially some
elisp advising to automatically execute install_name_tool -change to re-link
*.eln files right after creation, but before attempting to load them.

Pure GTK branch

I managed to get feature/pgtk built on my MBP and it works, but it's not great yet. The build didn't work out of the box with this tool though.

configure_flags = [
'--with-ns',
'--with-modules',
'--enable-locallisppath=' \
'/Library/Application Support/Emacs/${version}/site-lisp:' \
'/Library/Application Support/Emacs/site-lisp'
]

I manually tweaked the configure flags but got errors when the Makefile started trying to write to /usr/local/libexec. make install on this branch writes to some glib paths and doesn't seem to honour whatever sandboxing this script does to capture the build in Emacs.app

I didn't dig in too far since the resulting build wasn't really usable yet but thought it was worth an issue in case someone who knows Ruby better than I do wants to try fix the build process.

Can't install patched gcc

Hi, in the .install-patched-gcc step I get the below brew error:

sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
	    -e 's/\(GCC[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*_H\)/_GLIBCXX_\1/g' \
	    -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
	    -e 's/\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*USE_WEAK\)/_GLIBCXX_\1/g' \
	    -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
	    < /private/tmp/gcc-20200828-97942-1gx0d4h/gcc-10.2.0/libstdc++-v3/../libgcc/gthr-posix.h > x86_64-apple-darwin19/bits/gthr-default.h
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

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

Traceback (most recent call last):
	26: from /usr/local/Homebrew/Library/Homebrew/build.rb:226:in `<main>'
	25: from /usr/local/Homebrew/Library/Homebrew/build.rb:137:in `install'
	24: from /usr/local/Homebrew/Library/Homebrew/utils.rb:492:in `with_env'
	23: from /usr/local/Homebrew/Library/Homebrew/build.rb:142:in `block in install'
	22: from /usr/local/Homebrew/Library/Homebrew/formula.rb:1180:in `brew'
	21: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2149:in `stage'
	20: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/forwardable.rb:230:in `stage'
	19: from /usr/local/Homebrew/Library/Homebrew/resource.rb:82:in `stage'
	18: from /usr/local/Homebrew/Library/Homebrew/resource.rb:107:in `unpack'
	17: from /usr/local/Homebrew/Library/Homebrew/resource.rb:197:in `mktemp'
	16: from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `run'
	15: from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `chdir'
	14: from /usr/local/Homebrew/Library/Homebrew/mktemp.rb:57:in `block in run'
	13: from /usr/local/Homebrew/Library/Homebrew/resource.rb:112:in `block in unpack'
	12: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2169:in `block in stage'
	11: from /usr/local/Homebrew/Library/Homebrew/utils.rb:492:in `with_env'
	10: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2170:in `block (2 levels) in stage'
	 9: from /usr/local/Homebrew/Library/Homebrew/formula.rb:1187:in `block in brew'
	 8: from /usr/local/Homebrew/Library/Homebrew/build.rb:174:in `block (2 levels) in install'
	 7: from /Users/luca/git/build-emacs-for-macos/Formula/gcc.rb:89:in `install'
	 6: from /usr/local/Homebrew/Library/Homebrew/formula.rb:2083:in `mkdir'
	 5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:128:in `cd'
	 4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:128:in `chdir'
	 3: from /Users/luca/git/build-emacs-for-macos/Formula/gcc.rb:95:in `block in install'
	 2: from /usr/local/Homebrew/Library/Homebrew/formula.rb:1963:in `system'
	 1: from /usr/local/Homebrew/Library/Homebrew/formula.rb:1963:in `open'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2025:in `block in system': Failed executing: make BOOT_LDFLAGS=-Wl,-headerpad_max_install_names (BuildError)
	5: from /usr/local/Homebrew/Library/Homebrew/brew.rb:148:in `<main>'
	4: from /usr/local/Homebrew/Library/Homebrew/brew.rb:160:in `rescue in <main>'
	3: from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:407:in `dump'
	2: from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:353:in `issues'
	1: from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:357:in `fetch_issues'
/usr/local/Homebrew/Library/Homebrew/utils/github.rb:305:in `issues_for_formula': undefined method `full_name' for nil:NilClass (NoMethodError)

Any idea why? Thank you very much!

`brew bundle` doesn't work…

Hello everyone 👋🏼,

After cloning the project, I followed the installation procedure described in README.md. As of it now, brew bundle doesn't work for me. Particularly, the following error message has been shown:

==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################## 100.0%
Error: key not found: "osx-cross/arm/arm-gcc-bin@8"
Did you mean?  "osx-cross/arm/arm-gcc-bin@10"

Please see the attached screenshot with the complete stack trace
Screenshot 2023-04-02 at 19 33 24

I tried my best to google for workarounds for the installation of arm-gcc-bin@8-2019-q3-update, since there is no available formula for it
Screenshot 2023-04-02 at 19 38 11

Furthermore, the current version seems to be $12.2$
Screenshot 2023-04-02 at 19 40 33

Thus, my question is if I have been missing something of requirements, or it is an actual issue to be reported?

Many thanks in advance!
Cheers, 🍻

P.S.: I have MacBook Pro 2019's version with Ventura 13.2.1 (22D68) running.

`libgccjit.so`: error invoking gcc driver

Hi there! I want to say huge thanks for this project, I've been using it since December on my m1 pro to periodically build native-comp emacs apps. Just recently, I started to get issues with the new builds when actually running my built emacs app using libgccjit, here is how I build it (using the last good commit hash for demonstration purposes):

./build-emacs-for-macos -j8 --native-comp --native-full-aot --git-sha 7be75f17e79b547dc03e26e3980d4ce75bfa668d master

However, when actually launching emacs, I get the following error:

Error (use-package): lsp-pyright/:catch: Native compiler error: (lambda (arg409 &optional arg410 arg411) (let ((f #'describe-buffer-bindings)) (funcall f arg409 arg410 arg411))), "Compiling /Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/subr--trampoline-64657363726962652d6275666665722d62696e64696e6773_describe_buffer_bindings_0.eln...
ld: library not found for -lgcc_s.1.1
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice \"failed to compile\" \"/Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/...\" \"error invoking gcc driver\")
  comp--compile-ctxt-to-file(\"/Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/...\")
  comp-compile-ctxt-to-file(\"/Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/...\")
  comp-final1()
  load-with-code-conversion(\"/private/var/folders/7d/4s6h974n48l1l3v09q2fz9mc00...\" \"/private/var/folders/7d/4s6h974n48l1l3v09q2fz9mc00...\" nil t)
  command-line-1((\"-l\" \"/var/folders/7d/4s6h974n48l1l3v09q2fz9mc0000gn/T/e...\"))
  command-line()
  normal-top-level()

" Disable showing Disable logging
Warning (initialization): An error occurred while loading ‘/Users/thecsw/.emacs’:

Native compiler error: (lambda (arg485 &optional arg486) (let ((f #'delete-file)) (funcall f arg485 arg486))), Compiling /Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/subr--trampoline-64656c6574652d66696c65_delete_file_0.eln...
ld: library not found for -lgcc_s.1.1
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice "failed to compile" "/Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/..." "error invoking gcc driver")
  comp--compile-ctxt-to-file("/Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/...")
  comp-compile-ctxt-to-file("/Users/thecsw/.emacs.d/eln-cache/28.0.50-a0772fdf/...")
  comp-final1()
  load-with-code-conversion("/private/var/folders/7d/4s6h974n48l1l3v09q2fz9mc00..." "/private/var/folders/7d/4s6h974n48l1l3v09q2fz9mc00..." nil t)
  command-line-1(("-l" "/var/folders/7d/4s6h974n48l1l3v09q2fz9mc0000gn/T/e..."))
  command-line()
  normal-top-level()



To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace. Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /Users/thecsw/.emacs.d/elpa/s-20210616.619/s.el: Error: Internal native compiler error failed to compile Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /Users/thecsw/.emacs.d/elpa/f-20210624.1103/f.el: Error: Internal native compiler error failed to compile Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /Users/thecsw/.emacs.d/elpa/markdown-mode-20210616.122/markdown-mode.el: Error: Internal native compiler error failed to compile Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /Users/thecsw/.emacs.d/elpa/lsp-mode-20210630.1507/lsp-protocol.el: Error: Internal native compiler error failed to compile Disable showing Disable logging
Warning (comp): lsp-mode.el:50:1: Warning: Package cl is deprecated Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /Users/thecsw/.emacs.d/elpa/lsp-mode-20210630.1507/lsp-mode.el: Error: Internal native compiler error failed to compile Disable showing Disable logging
Warning (comp): libgccjit.so: error: error invoking gcc driver Disable showing Disable logging
Warning (comp): /Users/thecsw/.emacs.d/elpa/company-20210618.2105/company.el: Error: Internal native compiler error failed to compile Disable showing Disable logging

...

(goes on)

For some reason, even though my compiler built emacs with libgccjit, when emacs itself tries to compile the package into native .eln, something happens with the gcc driver.

By any chance anyone has encountered a similar error?

Thank you

Update: Forgot to mention that the build itself is finishing without errors. This has been built for arm64, uname -m returns arm64. However, if I switch to x86_64 using rosetta, the error is the same as the above.

Use of wrapper script in app bundle on Catalina complicates app switching

Hi,

I just switched to Catalina, and it seems like the new wrapper script in the app bundle causes problems to switch to the emacs 28 (native compilation) app bundle using Spotlight, Alfred or by double-clicking in Finder, similar to described here for emacsformacosx: https://spin.atomicobject.com/2019/12/12/fixing-emacs-macos-catalina.

Basically, once opened, Spotlight/Alfred do not change focus to the opened app instance, while I even had Finder opening multiple app instances instead of switching the open one.

There is a workaround using Applescript, see;: https://www.alfredforum.com/topic/13807-upgrade-macos-catalina-and-alfred-4-alfred-couldnt-switch-the-window-to-emacs/, that makes pre-Catalina app switch behaviour work again, but it feels like a clutch.

Is there any way the wrapper script (which sets the right paths, for example to find GCC) could be integrated into init.el, such that it could be discarded?

PS: BTW, the app bundle I created on 10.13 worked without a hitch on 10.15, except for the above issue.

Improve native-comp-env-setup patch

The native-comp-env-setup patch has always been a rather horrible first draft hack. There's a number of fragile areas which can be improved, and also finding a better way to ensure it runs before any native compilation starts would be great. The current advice-add/advice-remove solution for it is horrible.

Additionally it seems like it might be at least partially responsible for Emacs bug #45701.

Improvements:

  • Let the build script explicitly write out the GCC directory paths into the patch, as the build script already knows what they are. This will leave the elisp patch only responsible for dynamically looking up the invocation-directory and concatenating it with the explicit paths. This will yield much less logic in the elisp patch itself, and hence much less chance of it breaking anything. (#30)
  • Figure out a better way to run the env setup before any native compilation starts.

Problem embedding libraries into Emacs.app

After running ./build-emacs-for-macos --git-sha fd9e9308d27138a16e2e93417bd7ad4448fea40a feature/native-comp, everything seems to compile alright, but then I get the following error:

==> INFO: Embedding libraries into Emacs.app
Traceback (most recent call last):
	17: from ./build-emacs-for-macos:814:in `<main>'
	16: from ./build-emacs-for-macos:101:in `build'
	15: from ./build-emacs-for-macos:589:in `embed'
	14: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:139:in `cd'
	13: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:139:in `chdir'
	12: from ./build-emacs-for-macos:591:in `block in embed'
	11: from ./build-emacs-for-macos:631:in `copy_extra_libs'
	10: from ./build-emacs-for-macos:631:in `each'
	 9: from ./build-emacs-for-macos:636:in `block in copy_extra_libs'
	 8: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:429:in `cp'
	 7: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:1587:in `fu_each_src_dest'
	 6: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:1603:in `fu_each_src_dest0'
	 5: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:1589:in `block in fu_each_src_dest'
	 4: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:430:in `block in cp'
	 3: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:511:in `copy_file'
	 2: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:1414:in `copy_file'
	 1: from /usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:1414:in `open'
/usr/local/Cellar/ruby/2.7.2/lib/ruby/2.7.0/fileutils.rb:1414:in `initialize': No such file or directory @ rb_sysopen - /usr/local/opt/libiconv/lib/libiconv.2.dylib (Errno::ENOENT)

ruby --version: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]

I found the compiled app; the app itself launches just fine, but I get an error message on opening:

File is missing: Opening directory, No such file or directory, /Users/ashton/Sync/repos/build-emacs-for-macos/sources/emacs-mirror-emacs-fd9e930/nextstep/Emacs.app/Contents/MacOS/lib/gcc

(Also, my .emacs didn't load.)

Add instructions for linking to a native-comp build from the command line.

If possible, it would be useful to provide some basic instructions in the README about how to execute the built Emacs.app from the command line. My naive attempts to do this failed.

I successfully built Emacs.app against feature/native-comp yesterday. I symlinked the built Emacs.app into /Applications/Emacs.app and then tried to link to underlying executable as follows, but have issues with dynamic linkage:

# symlink attempt
❯ ln -sf /Applications/Emacs.d/Content/MacOS/Emacs ~/.local/bin/emacs
❯ emacs --version
emacs: dlopen(/usr/local/bin/../native-lisp/28.0.50-x86_64-apple-darwin19.6.0-204614f4bb50514fa29682e34b0741bf/lisp-mode-0189ba85598c041b7504f0a916c04219-1738806322de892570d69dfc55b437c2.eln, 1): image not found

# hardlink attempt
❯ ln -f /Applications/Emacs.d/Content/MacOS/Emacs ~/.local/bin/emacs
❯ emacs --version
dyld: Library not loaded: @executable_path/lib-x86_64-10_15/libgccjit.so.0
  Referenced from: /Users/shawn.ohare/bin/emacs
  Reason: image not found
zsh: abort      emacs --version

# directly calling the symlinked Emacs.app executable:
❯ /Applications/Emacs.app/Contents/MacOS/Emacs --version
GNU Emacs 28.0.50
Copyright (C) 2020 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

I appear to be able to open emacs via Spotlight just fine, but can't successfully run a doom-emacs install since the linked emacs executable fails.

One obvious solution, which I dislike, is to just modify PATH to include the built emacs executable. Is there another way? In either case I'm sure a few sentences in the README would help.

How to disable building with dbus?

Hi @jimeh,

Thanks for your great project.

I use ./build-emacs-for-macos to build emacs 29, but will got these warning:

dbus[86536]: Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!loaded

Because I don't use dbus on macOS, is there an option to disable it?

Known good commits for native-comp

Native-comp is now in the master branch of Emacs. The latest commit on the
master branch is not always stable/reliable though.

Below is a list of known "good" commits, which yielded builds that worked for me
on my machine, with my config, typically for at least a day or two of regular
work without issues. Your mileage may vary.

Known good commits from the master branch:

  • eec1142acdde9d10781c781e7890c2d26f7e6b2d (2023-12-01):
  • 16ac377aab257d635918dd0188dcdf630e75757c (2023-11-19):
  • ecc1d990d9e9d006838ca514213ea5e46a459363 (2023-05-30):
  • 5e5f5b28e92a3bb927bb03c783c426c6c3baeadc (2023-04-06):
  • 8febda46c458f11270350d0b68c69d8a58b59f8d (2023-01-22):
  • 7939184f8e0370e7a3397d492812c6d202c2a193 (2022-11-28):
  • 05f5d978ae70c4849a5c47865d62301d27317a8a (2022-11-02):
  • e09872ccb3c4d190ba668b47512abf1c28c992d7 (2022-09-06):
  • 37073492fdf382af2e642a4c80a9153891260374 (2022-08-12):
  • ec2bd7dd5c68510130e7abf7e76361d776c4fe22 (2022-08-09):
  • 004ee6b0460c450308c83dffc567fb1b8672777c (2022-07-26):
  • 113a6a0a885c8bfb1f3c75a8a985a73686662113 (2022-07-12):
  • c00ffe263d9ffeb4d2a5e13cc124c786152137db (2022-05-24):
  • 454caf858d92a87dc781bc35b421d5014a312bb9 (2022-05-12):
  • a35639015c532c1fe418420cb8cb1da9053b4162 (2022-05-04):
  • 0a151b7c29c46ae67ae92d0960e199ae84b3a48b (2022-04-25):
  • 48cb9c4aaadfe7bd50c13f658a6e8e9e97587867 (2022-04-10):
  • 8c8093aa6f20a7a4f3799cbdb9270cac013ef71d (2022-03-02):
  • 6a10a3e8d489d7b4dcffd6b4c63cee77e73e2535 (2022-02-27):
  • ca9f2fc2a4c62981ef28f0b6c64e069f49230729 (2022-02-23):
  • bd07d4fac9da40cecf6a5936fd4b4c8ebb751586 (2022-02-13):
  • 667e212048a1443b6f72647176aec701d18474c9 (2022-01-24):
  • 10083e788f7349fa363d100687dc3d94bea88f57 (2022-01-20):
  • 53dba3202205b5fab078a47da77be4140b7f93b1 (2022-01-13):
  • 762aa25fe70dbcd0d00ba6152c53c44f8808e7c1 (2022-01-08):
  • c8df4d1ca350e421adf49fb533627a6b1ef565bc (2021-11-28):
  • 73754bc54c0d9d390ae76ab0ccf18f63db16bc1f (2021-11-21):
  • 5b250ca79b9aeeeea0b521db9645882240f08c9f (2021-11-15):
  • e4f8ce78183e95bfbe649fb2ac43f3fe3492c782 (2021-11-12):
  • d3ccf0895dbb18ac04e1e2e0c6624af43d467c1b (2021-11-10):
  • a45aed9479f610bcbc7a171b60d915fefc9b586a (2021-07-25):
  • d672d576ff6c3ac3c7ee1fa4db13c7e0a4974aa3 (2021-07-12):
  • e762864b9d501cfbc15fd20f403fc435bbdc580e (2021-07-07):
  • 0aee54a54beebedee20466b23ab99ae48f61259c (2021-07-03):
  • f2729dd8ee0cad67ea2ab0411526f9bc4a7b2c9a (2021-06-25):
  • 7be75f17e79b547dc03e26e3980d4ce75bfa668d (2021-06-23):
  • 15c57fc4cc031cc6aca7eabd74706538fd6bfa22 (2021-06-03):
  • 3f8b303ec087ba3d0bd524c7fc8c628ef15a3e4a (2021-05-24):
  • 19c14be04fec3ae958bd14623ca2f8f84a53915f (2021-05-23):
  • 6ae3f7e889434eb8f76cc376d2939c66eb470855 (2021-05-19):
  • 28bed069a7cc0f9d6937276b5a1eec949abc280a (2021-05-10):
  • 25c775b4e964aaa2cbf17997c0479dfc2ecf33e2 (2021-05-09):
  • bb8b8d717f91a85ca41de9e82246e6975e1ed719 (2021-05-08):
  • 83a915d3dfafd5f3d737afe1e13b75e4dd3aef96 (2021-04-25):
    • Build from source:
      ./build-emacs-for-macos --git-sha 83a915d3dfafd5f3d737afe1e13b75e4dd3aef96 master
      

Known good commits from the deprecated feature/native-comp branch:

  • f9c1008ced59f003d48dd7be39e9ec4aa0f02484 (2021-04-16):
    ./build-emacs-for-macos --git-sha f9c1008ced59f003d48dd7be39e9ec4aa0f02484 feature/native-comp
    
  • b064ddd3f600ed28e62b09d556ecced5f80d9883 (2021-04-13):
    ./build-emacs-for-macos --git-sha b064ddd3f600ed28e62b09d556ecced5f80d9883 feature/native-comp
    
  • 8ed46b7646de7166aa8bbd3b5d29a4947316c900 (2021-04-07):
    ./build-emacs-for-macos --git-sha 8ed46b7646de7166aa8bbd3b5d29a4947316c900 feature/native-comp
    
  • 39bc9bc77066c0c40d2e5fd0769ce3701055a10b (2021-04-04):
    ./build-emacs-for-macos --git-sha 39bc9bc77066c0c40d2e5fd0769ce3701055a10b feature/native-comp
    
  • 978afd788fd0496540f715b83f18ed390ca8d5a4 (2021-04-01):
    ./build-emacs-for-macos --git-sha 978afd788fd0496540f715b83f18ed390ca8d5a4 feature/native-comp
    
  • 8d550700c535dbcd4721cc65c0a11decbf070abb (2021-03-31):
    ./build-emacs-for-macos --git-sha 8d550700c535dbcd4721cc65c0a11decbf070abb feature/native-comp
    
  • 79b8b6ca45ad707d86244882430e275efd95cdb9 (2021-03-26):
    ./build-emacs-for-macos --git-sha 79b8b6ca45ad707d86244882430e275efd95cdb9 feature/native-comp
    
  • 5e4ec4d3c944f586892e08ea4fb7715e0f6ac365 (2021-03-14):
    ./build-emacs-for-macos --git-sha 5e4ec4d3c944f586892e08ea4fb7715e0f6ac365 feature/native-comp
    
  • 0144764d1dde8a2f1d413d042d46cea3e10a7d0a (2021-03-12):
    ./build-emacs-for-macos --git-sha 0144764d1dde8a2f1d413d042d46cea3e10a7d0a feature/native-comp
    
  • 552ef6d6c0733b864bcb14eeb6183d7e64df3b80 (2021-03-05):
    ./build-emacs-for-macos --git-sha 552ef6d6c0733b864bcb14eeb6183d7e64df3b80 feature/native-comp
    
  • 31416495ad9b2c84473f72ad99e2adc87dd66e5a (2021-02-14):
    ./build-emacs-for-macos --git-sha 31416495ad9b2c84473f72ad99e2adc87dd66e5a feature/native-comp
    
  • 0ffb3dfaa483b0c5cf1f7f367efcb5e9c041ab53 (2021-01-19):
    ./build-emacs-for-macos --git-sha 0ffb3dfaa483b0c5cf1f7f367efcb5e9c041ab53 feature/native-comp
    
  • 33b8ce865fcfd58538ae2d7c3fff04998fcd3330 (2021-01-06):
    ./build-emacs-for-macos --git-sha 33b8ce865fcfd58538ae2d7c3fff04998fcd3330 feature/native-comp
    
  • 8ad983c4acef60a80e8d6b6ba891b1ef957f2d7c (2021-01-04):
    ./build-emacs-for-macos --git-sha 8ad983c4acef60a80e8d6b6ba891b1ef957f2d7c feature/native-comp
    
  • bd693ccea7ba4a6aafda103f7a9166f76363c86b (2020-12-25):
    ./build-emacs-for-macos --git-sha bd693ccea7ba4a6aafda103f7a9166f76363c86b feature/native-comp
    
  • be907b0ba82c2a65e0468d50653cae8a7cf5f16b (2020-12-07):
    ./build-emacs-for-macos --git-sha be907b0ba82c2a65e0468d50653cae8a7cf5f16b feature/native-comp
    
  • 7a8370ed0f1b1d62657e385789ee2f81c5607ec5 (2020-11-23):
    ./build-emacs-for-macos --git-sha 7a8370ed0f1b1d62657e385789ee2f81c5607ec5 feature/native-comp
    
  • fd9e9308d27138a16e2e93417bd7ad4448fea40a (2020-10-26):
    ./build-emacs-for-macos --git-sha fd9e9308d27138a16e2e93417bd7ad4448fea40a feature/native-comp
    
  • d5791ba5feeb5500433ca43506dda13c7c67ce14 (2020-10-17):
    ./build-emacs-for-macos --git-sha d5791ba5feeb5500433ca43506dda13c7c67ce14 feature/native-comp
    
  • 03dfa83dc35738c9228b66b3d3f72753b344f939 (2020-10-15):
    ./build-emacs-for-macos --git-sha 03dfa83dc35738c9228b66b3d3f72753b344f939 feature/native-comp
    
  • feed53f8b5da0e58cce412cd41a52883dba6c1be (2020-10-10):
    ./build-emacs-for-macos --git-sha feed53f8b5da0e58cce412cd41a52883dba6c1be feature/native-comp
    
  • c3bc348f5edefa4231d38b6d3967f0c8f0bb5e6d (2020-10-07):
    ./build-emacs-for-macos --git-sha c3bc348f5edefa4231d38b6d3967f0c8f0bb5e6d feature/native-comp
    
  • 323200044f0c3f716f8f78a6f5e39349fe039117 (2020-10-05):
    ./build-emacs-for-macos --git-sha 323200044f0c3f716f8f78a6f5e39349fe039117 feature/native-comp
    
  • 825e85b393a3d78ba43176ecc5bc1a9595d0fbea (2020-10-02):
    ./build-emacs-for-macos --git-sha 825e85b393a3d78ba43176ecc5bc1a9595d0fbea feature/native-comp
    
  • 89f064104c25f8b4362ef54d28fd4bce18f6af3b (2020-09-29):
    ./build-emacs-for-macos --git-sha 89f064104c25f8b4362ef54d28fd4bce18f6af3b feature/native-comp
    
  • dc0cf16c7a60f36aafcf9b56513a855cefa7e1ad (2020-09-26):
    ./build-emacs-for-macos --git-sha dc0cf16c7a60f36aafcf9b56513a855cefa7e1ad feature/native-comp
    
  • 4a50f541447eddefcca3ebc6bedb110ac0041f90 (2020-09-22):
    ./build-emacs-for-macos --git-sha 4a50f541447eddefcca3ebc6bedb110ac0041f90 feature/native-comp
    
  • 5b41545f1be367837d9ac717ea67fba19a4c24d4 (2020-09-15):
    ./build-emacs-for-macos --git-sha 5b41545f1be367837d9ac717ea67fba19a4c24d4 feature/native-comp
    
  • 21021e56ad609a459ec117bcfc60b2802176a9a7 (2020-09-13):
    ./build-emacs-for-macos --git-sha 21021e56ad609a459ec117bcfc60b2802176a9a7 feature/native-comp
    
  • cb293cfb929dfbecb3057dde2115399b89350a9b (2020-09-10):
    ./build-emacs-for-macos --git-sha cb293cfb929dfbecb3057dde2115399b89350a9b feature/native-comp
    
  • 15acd27d1c0de8b56bab61daa0a8fcd4fef0fdc4 (2020-09-08):
    ./build-emacs-for-macos --git-sha 15acd27d1c0de8b56bab61daa0a8fcd4fef0fdc4 feature/native-comp
    
  • eb8742598874d9bd4c84ff54730527c52d29d7ff (2020-09-06):
    ./build-emacs-for-macos --git-sha eb8742598874d9bd4c84ff54730527c52d29d7ff feature/native-comp
    
  • 3023eb569213a3dd5183640f6e322acd00ea536a (2020-09-01):
    ./build-emacs-for-macos --git-sha 3023eb569213a3dd5183640f6e322acd00ea536a feature/native-comp
    
  • aa526c9470d679e9144af55d9e56928a111d2ceb (2020-08-26):
    ./build-emacs-for-macos --git-sha aa526c9470d679e9144af55d9e56928a111d2ceb feature/native-comp
    
  • 337367a733e107df1ecb89955f0a249491bc62d9 (2020-08-23):
    ./build-emacs-for-macos --git-sha 337367a733e107df1ecb89955f0a249491bc62d9 feature/native-comp
    
  • c818c29771d3cb51875643b2f6c894073e429dd2 (2020-08-20):
    ./build-emacs-for-macos --git-sha c818c29771d3cb51875643b2f6c894073e429dd2 feature/native-comp
    
  • fc9b68636b1aec69295726d2b3be2b520911f40b (2020-08-18):
    ./build-emacs-for-macos --git-sha fc9b68636b1aec69295726d2b3be2b520911f40b feature/native-comp
    

dlopen image not found error for building feature/native-comp

I download and run build-emacs-for-macos on my computer this morning. Everything looks good until step symlink_internals.

==> INFO: Creating symlinks within Emacs.app needed for native-comp
Traceback (most recent call last):
	6: from ./build-emacs-for-macos:821:in `<main>'
	5: from ./build-emacs-for-macos:99:in `build'
	4: from ./build-emacs-for-macos:360:in `symlink_internals'
	3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:128:in `cd'
	2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:128:in `chdir'
	1: from ./build-emacs-for-macos:365:in `block in symlink_internals'
./build-emacs-for-macos:365:in `basename': no implicit conversion of nil into String (TypeError)

After this, I chdir into nextstep/Emacs.app/Contents/ and run ./MacOS/Emacs manually. It return me

emacs: dlopen(/Users/Me/Desktop/build-emacs-for-macos/sources/emacs-mirror-emacs-bd693cc/nextstep/Emacs.app/Contents/MacOS/../native-lisp/28.0.50-x86_64-apple-darwin20.2.0-1702cf8430b129cccc53f34c8ae4a27d/mouse-15f283fa50e83fc2aec8714353ada84c-a3299a7c327de804acf70c9bee1124bb.eln, 1): image not found

Is there any solutions of this error? Or I did something wrong with my env?

My Env:
MacBook Pro
macOS 11.1

Thank you

*.eln files bundled into Emacs.app are ignored

After the changes in Update 11
to gccemacs, the native *.eln files are cached with a hash. This hash seems to
be in part based on the absolute file path of the lisp file in question. As
Emacs.app is self-contained, the absolute path at build time and will not be the
same as once it's installed into /Applications.

This means that all the natively compiled *.eln files bundled into Emacs.app
will not be used, and instead all lisp sources will be natively compiled and
cached in the the user cache (~/.emacs.d/eln-cache/ by default). Native
compilation status can be viewed in the *Async-native-compile-log* buffer.

Because of this, NATIVE_FAST_BOOT is enabled by default ensuring as fast a
build as possible, with as little native compilation as possible at build time.

Ability to Add "All Features"

Just wanted to say this script is great - worked out well for me!

However, when looking at the the feature list from the emacs-build repository, I notice there really isn't way to add "--with-all". For reference, the feature list includes the following (ignoring mingw):

xpm
jpeg
tiff
gif
png
rsvg
cairo (not sure if needed)
harfbuzz (not sure if needed)
json
lcms2
xml2
gnutls
zlib
native-compilation

Locally, I edited the script to include these features, also including imagemagick. I tested to see if this would work, and it appears it can! It would be a nice to have to have the ability to add some of these features. I would also argue that --with-json would be a could default as well.

If you think its a good idea, maybe I could add flags to the script that would could append these options to the build.

Getting the ERROR: Failed to get commit info about

Current OS: MacOS Big Sur 11.2.3
git version 2.24.3 (Apple Git-128)

Trying to run the script on the following ruby versions:

  • ruby-2.4.2 [ x86_64 ]
  • ruby-2.5.3 [ x86_64 ]
  • ruby-2.7.2 [ x86_64 ]

and getting the error

➜  build-emacs-for-macos git:(master) ✗ ./build-emacs-for-macos
ERROR: Failed to get commit info about:

Not sure what exact info about my setup I should provide to help to debug this

M1 support

Hi, as libgccjit is now available for m1 MacBooks, it should be possible to compile emacs master for apple silicon. The emacs-plus@28 --native-comp works fine, but it was a bit buggy,

trying to build using the following command ./build-emacs-for-macos --git-sha 3f8b303ec087ba3d0bd524c7fc8c628ef15a3e4a master results in this output:

build-emacs-for-macos on  master via  v2.6.3
❯ ./build-emacs-for-macos --git-sha 3f8b303ec087ba3d0bd524c7fc8c628ef15a3e4a master

==> INFO: Fetching info for git ref: 3f8b303ec087ba3d0bd524c7fc8c628ef15a3e4a
==> INFO: Downloading tarball from GitHub. This could take a while, please be patient.
==> CMD: curl -L https://github.com/emacs-mirror/emacs/tarball/3f8b303ec087ba3d0bd524c7fc8c628ef15a3e4a -o /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/tarballs/emacs-mirror-emacs-3f8b303.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   167  100   167    0     0    893      0 --:--:-- --:--:-- --:--:--   893
100 40.8M    0 40.8M    0     0  4090k      0 --:--:--  0:00:10 --:--:-- 4492k
==> INFO: Extracting tarball...
==> CMD: tar -xzf /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/tarballs/emacs-mirror-emacs-3f8b303.tgz -C /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources
==> CMD: mkdir -p /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/fix-window-role.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/fix-window-role.patch -o /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303/macos_patches/patch-001.diff
############################################################################################################################################################################################## 100.0%
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303/macos_patches/patch-001.diff
patching file src/nsterm.m
Hunk #1 succeeded at 8881 (offset 113 lines).
==> CMD: mkdir -p /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/system-appearance.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/system-appearance.patch -o /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303/macos_patches/patch-002.diff
############################################################################################################################################################################################## 100.0%
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303/macos_patches/patch-002.diff
patching file src/frame.h
patching file src/nsfns.m
Hunk #1 succeeded at 1260 (offset 7 lines).
patching file src/nsterm.m
Hunk #1 succeeded at 2173 (offset -21 lines).
Hunk #2 succeeded at 5669 (offset -82 lines).
Hunk #3 succeeded at 5915 (offset -82 lines).
Hunk #4 succeeded at 5965 (offset -82 lines).
Hunk #5 succeeded at 6191 (offset -82 lines).
Hunk #6 succeeded at 9212 (offset 80 lines).
Hunk #7 succeeded at 10298 (offset 284 lines).
==> CMD: ./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.
Building aclocal.m4 ...
Running 'autoreconf -fi -I m4' ...
You can now run './configure'.
==> INFO: Detecting native-comp support: Supported
==> INFO: Compiling from source. This will take a while...
==> INFO: Compiling with native-comp enabled
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303/macos_patches/native-comp-env-setup.diff
patching file lisp/emacs-lisp/comp.el
==> CMD: ./configure --with-ns --with-modules --enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp --with-xwidgets --with-native-compilation
checking for xcrun... xcrun
checking for make... yes
checking for GNU Make... make
checking build system type... aarch64-apple-darwin20.4.0
checking host system type... aarch64-apple-darwin20.4.0
checking whether the C compiler works... no
configure: error: in `/Users/shauryasingh/IdeaProjects/build-emacs-for-macos/sources/emacs-mirror-emacs-3f8b303':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: Exit code: 77

Perhaps a patch is needed?

Build failing while retriving patches

==> CMD: patch -f -p1 -i /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-003.diff
patching file 'src/frame.c'
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.h'
patching file 'src/nsterm.m'
1 out of 3 hunks failed--saving rejects to 'src/nsterm.m.rej'
ERROR: Exit code: 1

Command used -

./build-emacs-for-macos --native-full-aot --git-sha 5e5f5b28e92a3bb927bb03c783c426c6c3baeadc master

entire logs

==> INFO: Fetching info for git ref: 5e5f5b28e92a3bb927bb03c783c426c6c3baeadc
==> INFO: Downloading tarball from GitHub. This could take a while, please be patient.
==> CMD: curl -H "Authorization: Token $GITHUB_TOKEN" -L https://github.com/emacs-mirror/emacs/tarball/5e5f5b28e92a3bb927bb03c783c426c6c3baeadc -o /Users/ckoneru/Documents/build-emacs-for-macos/tarballs/emacs-mirror-emacs-5e5f5b2.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 44.8M    0 44.8M    0     0  3635k      0 --:--:--  0:00:12 --:--:-- 4878k
==> INFO: Extracting tarball...
==> CMD: tar -xzf /Users/ckoneru/Documents/build-emacs-for-macos/tarballs/emacs-mirror-emacs-5e5f5b2.tgz -C /Users/ckoneru/Documents/build-emacs-for-macos/sources
==> CMD: mkdir -p /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-30/fix-window-role.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-30/fix-window-role.patch -o /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-001.diff
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                                                                                                                                                                           -#O=- #      #          #                                                                                                                                                                                                                                      -=O#-   #        #           #                                                                                                                                                                                                                                 -=O=-#      #        #  ######################################################################################################################################################################################################################################################### 100.0%
==> INFO: patch is symlink to ../emacs-28/fix-window-role.patch
==> CMD: mkdir -p /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/fix-window-role.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/fix-window-role.patch -o /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-001.diff
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                                                                                                                                                                           -#O=- #      #          #                                                                                                                                                                                                                                      -=O#-   #        #           #                                                                                                                                                                                                                                 -=O=-#      #        #  ######################################################################################################################################################################################################################################################### 100.0%
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-001.diff
patching file 'src/nsterm.m'
==> CMD: mkdir -p /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-30/system-appearance.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-30/system-appearance.patch -o /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-002.diff
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                                                                                                                                                                           -#O=- #      #          #                                                                                                                                                                                                                                      -=O#-   #        #           #                                                                                                                                                                                                                                 -=O=-#      #        #  ######################################################################################################################################################################################################################################################### 100.0%
==> INFO: patch is symlink to ../emacs-28/system-appearance.patch
==> CMD: mkdir -p /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/system-appearance.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/system-appearance.patch -o /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-002.diff
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                                                                                                                                                                           -#O=- #      #          #                                                                                                                                                                                                                                      -=O#-   #        #           #                                                                                                                                                                                                                                 -=O=-#      #        #  ######################################################################################################################################################################################################################################################### 100.0%
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-002.diff
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.m'
==> CMD: mkdir -p /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-30/round-undecorated-frame.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-30/round-undecorated-frame.patch -o /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-003.diff
#=#=-  #       #                                                                                                                                                                                                                                               #=O#-     #        #                                                                                                                                                                                                                                           -#O=- #      #          #                                                                                                                                                                                                                                      -=O#-   #        #           #                                                                                                                                                                                                                                 -=O=-#      #        #  ######################################################################################################################################################################################################################################################### 100.0%
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/ckoneru/Documents/build-emacs-for-macos/sources/emacs-mirror-emacs-5e5f5b2/macos_patches/patch-003.diff
patching file 'src/frame.c'
patching file 'src/frame.h'
patching file 'src/nsfns.m'
patching file 'src/nsterm.h'
patching file 'src/nsterm.m'
1 out of 3 hunks failed--saving rejects to 'src/nsterm.m.rej'
ERROR: Exit code: 1

Error in #major method

./build-emacs-for-macos feature/native-comp

==> INFO: Downloading tarball from GitHub. This could take a while, please be patient.
==> CMD: curl -L https://github.com/emacs-mirror/emacs/tarball/15acd27d1c0de8b56bab61daa0a8fcd4fef0fdc4 -o /Users/jsmestad/code/github/build-emacs-for-macos/tarballs/emacs-mirror-emacs-15acd27.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   167    0   167    0     0    530      0 --:--:-- --:--:-- --:--:--   530
100 40.3M    0 40.3M    0     0  1185k      0 --:--:--  0:00:34 --:--:-- 1118k
==> INFO: Extracting tarball...
==> CMD: tar -xzf /Users/jsmestad/code/github/build-emacs-for-macos/tarballs/emacs-mirror-emacs-15acd27.tgz -C /Users/jsmestad/code/github/build-emacs-for-macos/sources
==> CMD: mkdir -p /Users/jsmestad/code/github/build-emacs-for-macos/sources/emacs-mirror-emacs-15acd27/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/fix-window-role.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/fix-window-role.patch -o /Users/jsmestad/code/github/build-emacs-for-macos/sources/emacs-mirror-emacs-15acd27/macos_patches/patch-001.diff
################################################################################################### 100.0%################################################################################################### 100.0%
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/jsmestad/code/github/build-emacs-for-macos/sources/emacs-mirror-emacs-15acd27/macos_patches/patch-001.diff
patching file src/nsterm.m
Hunk #1 succeeded at 8762 (offset -6 lines).
==> CMD: mkdir -p /Users/jsmestad/code/github/build-emacs-for-macos/sources/emacs-mirror-emacs-15acd27/macos_patches
==> INFO: Downloading patch: https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/system-appearance.patch
==> CMD: curl -L# https://github.com/d12frosted/homebrew-emacs-plus/raw/master/patches/emacs-28/system-appearance.patch -o /Users/jsmestad/code/github/build-emacs-for-macos/sources/emacs-mirror-emacs-15acd27/macos_patches/patch-002.diff
################################################################################################### 100.0%
==> INFO: Applying patch...
==> CMD: patch -f -p1 -i /Users/jsmestad/code/github/build-emacs-for-macos/sources/emacs-mirror-emacs-15acd27/macos_patches/patch-002.diff
patching file src/frame.h
patching file src/nsfns.m
Hunk #1 succeeded at 1253 (offset -16 lines).
patching file src/nsterm.m
Hunk #1 succeeded at 2217 (offset 14 lines).
Hunk #2 succeeded at 5712 (offset 28 lines).
Hunk #3 succeeded at 5958 (offset 28 lines).
Hunk #4 succeeded at 6003 (offset 28 lines).
Hunk #5 succeeded at 6211 (offset 28 lines).
Hunk #6 succeeded at 9070 (offset 21 lines).
Hunk #7 succeeded at 9952 (offset 21 lines).
==> CMD: ./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.
Building aclocal.m4 ...
Running 'autoreconf -fi -I m4' ...
You can now run './configure'.
==> INFO: Detecting native-comp support: Supported
==> INFO: Compiling from source. This will take a while...
==> INFO: Compiling with native-comp enabled

Traceback (most recent call last):
	7: from ./build-emacs-for-macos:871:in `<main>'
	6: from ./build-emacs-for-macos:103:in `build'
	5: from ./build-emacs-for-macos:249:in `compile_source'
	4: from /Users/jsmestad/.asdf/installs/ruby/2.7.1/lib/ruby/2.7.0/fileutils.rb:139:in `cd'
	3: from /Users/jsmestad/.asdf/installs/ruby/2.7.1/lib/ruby/2.7.0/fileutils.rb:139:in `chdir'
	2: from ./build-emacs-for-macos:285:in `block in compile_source'
	1: from ./build-emacs-for-macos:53:in `to_s'
./build-emacs-for-macos:57:in `major': undefined method `[]' for nil:NilClass (NoMethodError)

Indicate necessary ruby version

You may want to specify the necessary ruby version, as the macos pre-installed one is too old to work with the script. Thanks for setting this all up!

How to compile with Harfbuzz and Cairo?

I am using build-emacs-for-macos for a while and it's really nice.

However, I didn't manage to compile with Cairo and Harfbuzz. They should be default, but even if I explicitly pass --with-harfbuzz and --with-cairo to configFlags it won't be compiled with them.

How may I compile with Harfbuzz and Cairo?

Instructions for producing a signed app

The README says that code sign instructions are coming soon. Even a pointer to what you have to set up and pass to the go run ./cmd/emacs-builder package would be great!

I'm building on an M1 machine, otherwise I would slack off and use the Homebrew cask.

Recent "Known Good Commits" not working for me in Big Sur

I have tried numerous "Known Good Commits" to no avail on Big Sur. I did a clean install of Big Sur, installed homebrew (using the bundle), and most of the builds succeed in compilation, but launching emacs results in:

Native compiler error: (lambda (arg1 &optional) (let ((f #'yes-or-no-p)) (funcall f arg1))), Compiling /Users/powellb/.config/emacs/eln-cache/28.0.50-x86_64-apple-darwin20.1.0-49f57b89165c34ed2376cdf316ba8250/subr--trampoline-7965732d6f722d6e6f2d70_yes_or_no_p_0.eln...
ld: library not found for -lgcc_ext.10.5
libgccjit.so: error: error invoking gcc driver

The interesting thing is that fd9e9308d27138a16e2e93417bd7ad4448fea40a works fine. After that, none of them work for me.

I am invoking them exactly as in jimeh's list:

./build-emacs-for-macos --git-sha be907b0ba82c2a65e0468d50653cae8a7cf5f16b feature/native-comp

Everything proceeds and works as normal; however, once launched, when emacs tries to use the native-compiler it fails with the above.

Any one else experiencing this? Why would the one commit work but the others fail?

As an aside, libgccjit seems to be working fine. I have built the standard smoketest without issue, etc. It is only the commits after fd9e9308d27138a16e2e93417bd7ad4448fea40a that fail for me.

App crashes using MacOS 14.0 Sonoma unless signed

Not sure if this happens to others but giving a heads up that my build on arm64 Sonoma crashed until I signed the app using the included go signer. Maybe Apple changed something in this latest version related to unsigned apps. Maybe want to add that in docs if others are experiencing this.

Anyway, I'm up and running now. Thanks for this awesome script! Love the speed of native compilation and that this is a pure edition.

insert-directory: Listing directory failed but ‘access-file’ worked

Hi there!
I have built Emacs from source using your script, concretely one of your "Known good commits".
As is common with MacOS, after Catalina, there is a ton more security involved in folder handling, and for Emacs there is no exception. When trying to access any folder (dired really) using "Emacs.app", emacsclient or emacs commands, I get following error:
insert-directory: Listing directory failed but ‘access-file’ worked

The emacs --version command outputs:

GNU Emacs 28.0.50
Copyright (C) 2021 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Following the subsequent resources, I have tried the following:

  • Give full disk access to Emacs.app: reddit post
  • Give full disk access to Ruby (both /usr/bin/ruby and /usr/local/opt/ruby/bin/ruby)

There is also Chris' post, but the workaround cannot be applied, considering we do not have any binary (besides Emacs) in the /Applications/Emacs.app/Contents/MacOS folder.

I would love some comment on this issue. It has surprised my not seeing any active issues on the matter in the repo, does anyone has had trouble with this?

Emacs.app not found in /Applications

Hi there,

I have a currently working Emacs master build running the main script, and I can run the application from spotlight. Nevertheless, I don't see an Emacs.app in the /Applications folder. Where is this linked from? My questions comes from not having the emacs and emacsclient cli commands available.

I'll provide additional details as necessary.
Thanks for your work.

source-directory is "/Users"

Hi! Thanks for this nice and easy to use tool, I replaced my shell script with it :)

I wanted to look into the code of kill-buffer and got an error that sources could not be found.
I saw this in site-start.el

;; Allow Emacs to find bundled C sources.
(setq source-directory (expand-file-name ".."))

So it seems when this gets executed the working directory is my user directory. ("/Users/name")

Undefined method `gsub' for nil:NilClass when building native-comp

Running the command

./build-emacs-for-macos --git-sha 7a8370ed0f

compiled Emacs successfully AFAICT but failed here:

==> INFO: Creating symlinks within Emacs.app needed for native-comp
==> INFO: Embedding libraries into Emacs.app
==> INFO: Embedding libgccjit into Emacs.app
./build-emacs-for-macos:369:in `archive_app': undefined method `gsub' for nil:NilClass (NoMethodError)
        from ./build-emacs-for-macos:104:in `build'
        from ./build-emacs-for-macos:814:in `<main>'

I was able to work around it with the following patch, but this is kludgy and probably not a desirable solution:

diff --git a/build-emacs-for-macos b/build-emacs-for-macos
index e22f413..c88ae60 100755
--- a/build-emacs-for-macos
+++ b/build-emacs-for-macos
@@ -366,14 +366,14 @@ class Build
     FileUtils.mkdir_p(builds_dir)

     metadata = [
-      ref.gsub(/\W/, '-'),
+      ref&.gsub(/\W/, '-'),
       meta[:date],
       meta[:sha][0..6],
       "macOS-#{OS.version}",
       OS.arch
     ]

-    filename = "Emacs.app-[#{metadata.join('][')}].tbz"
+    filename = "Emacs.app-[#{metadata.compact.join('][')}].tbz"
     target = "#{builds_dir}/#{filename}"

     app_base = File.basename(app)

Error: libexpat.1.dylib

Hello, after running ./build-emacs-for-macos I got this:

cp: cannot stat '/opt/homebrew/opt/expat/lib/libexpat.1.dylib': No such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.