d12frosted/homebrew-emacs-plus

Broken installation of Emacs 26.3 when build from sources

albertparedandan opened this issue ยท 43 comments

Describe the bug

See d12frosted's comment for more information.

When i install emacs using the without spacemacs icon argument the resulting emacs is not executable both from Applications folder and terminal. I get a zsh: killed emacs

I can't even run emacs--version or emacs doctor

Command used to install emacs-plus

$ brew install emacs-plus --without-spacemacs-icon

Installation log
Updating Homebrew...
==> Installing emacs-plus from d12frosted/emacs-plus
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or
https://developer.apple.com/download/more/.

==> Downloading https://ftp.gnu.org/gnu/emacs/emacs-26.3.tar.xz
Already downloaded: /Users/albertpare/Library/Caches/Homebrew/downloads/35ddbf65249f3d4c38e087a1fa7606daaf8784b8445fa2c3b4d453ef9b92a18c--emacs-26.3.tar.xz
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/multicolor-fonts.patch
Already downloaded: /Users/albertpare/Library/Caches/Homebrew/downloads/6e0bcfe5f86b21ca9f1bf349995832a6143baac4a74e000dff771b2839b6fa7d--multicolor-fonts.patch
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/fix-window-role.patch
Already downloaded: /Users/albertpare/Library/Caches/Homebrew/downloads/b7046a273c114e23f734df97967f4016486f1d080bad1ba40dbd53a5c86a09e0--fix-window-role.patch
==> Patching
==> Applying multicolor-fonts.patch
patching file src/macfont.m
Hunk #1 succeeded at 2346 with fuzz 2 (offset -27 lines).
==> Applying fix-window-role.patch
patching file src/nsterm.m
Hunk #1 succeeded at 8368 (offset -158 lines).
==> ImageMagick PKG_CONFIG_PATH:
/usr/local/opt/imagemagick@6/lib/pkgconfig
==> ./configure --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus/26.3/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus/26.3 --with-xml2 --without-dbus --with-gnutls --with-imagemagick --with-modules --with-rsvg --with-ns
==> make
==> make install
==> Caveats
Emacs.app was installed to:
/usr/local/opt/emacs-plus

To link the application to default Homebrew App location:
ln -s /usr/local/opt/emacs-plus/Emacs.app /Applications

--natural-title-bar option was removed from this formula, in order to
duplicate its effect add following line to your init.el file
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . dark))
or:
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . light))

To have launchd start d12frosted/emacs-plus/emacs-plus now and restart at login:
brew services start d12frosted/emacs-plus/emacs-plus
Or, if you don't want/need a background service you can just run:
emacs
==> Summary
๐Ÿบ /usr/local/Cellar/emacs-plus/26.3: 3,993 files, 123.6MB, built in 1 minute 58 seconds

running emacs after this gives
zsh: killed emacs

Hello,

I can't reproduce your issue.

I have 2 questions:

  1. How did you get emacs-plus to Applications folder? By default it's not installed there. So you either need to use ln (from the caveats section) or copy it.
  2. What is emacs doctor?

sorry, emacs doctor indeed is not a proper command. but to answer ur 1. i followed the instruction given:
ln -s /usr/local/opt/emacs-plus/Emacs.app /Applications/Emacs.app

Can you please share output of the following commands?

  • brew doctor
  • command -v emacs

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: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or
https://developer.apple.com/download/more/.


Warning: You have uncommitted modifications to Homebrew/homebrew-core.
If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
  cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git stash && git clean -d -f

Uncommitted files:
   D Formula/emacs-clang-complete-async.rb
   D Formula/emacs.rb
   M Formula/fox.rb
  ?? Formula/.DS_Store

command -v emacs
/usr/local/bin/emacs

I see you have modifications for emacs formula, but it's safe.

Oh, and could you please check where does that link?

$ readlink /usr/local/bin/emacs

../Cellar/emacs-plus/26.3/bin/emacs

Does it start if you run with -nw option? E.g.

$ emacs -nw

unfortunately i am not running the emacs-plus --without-spacemacs-icon anymore. I went ahead with just a normal emacs-plus so i can't really try it. at least now all of those things works

Oh, alright. I will try to reproduce it in CI. If someone else runs into this issue, please let me know.

Ok, so I've managed to reproduce.

  1. Make sure that you are on 10.15.4 (19E266) - on previous version everything worked.
  2. brew install emacs-plus --build-from-source
  3. /usr/local/opt/emacs-plus/bin/emacs

And you will see that it's terminated by SIGKILL.

Reproducible with stock emacs formula, e.g. brew install emacs --build-from-source.

It seems that there is an upstream issue with Emacs 26.3 on the latest macos. Can't find any related reports nor in homebrew-core, nor on emacs devel/bug mailing lists.

If someone finds a fresh conversation, please link it here.

P. S. installing from HEAD or using bottle is a workaround.

Also, recently GitHub updated software on their CI, so it breaks there as well now: https://github.com/d12frosted/homebrew-emacs-plus/runs/563887711?check_suite_focus=true#step:4:10

I had this exact same issue. Had a working version of emacs-plus installed. Ran brew uninstall emacs-plus and then brew install --without-spacemacs-icon emacs-plus . Unable to launch from command line or linked Application. Uninstalled and reinstalled without the --without-spacemacs-icon option and everthing works fine. MacOS Catalina 10.15.4.

Confirming I also experienced this issue.

Installed via brew install emacs-plus --without-spacemacs-icon, and zsh immediately terminates with SIGKILL.

Interestingly, uninstalling and then re-installing omitting the --without-spacemacs-icon resolved the issue for me - it now launches as expected.

  • Catalina 10.15.4
  • Reproduced ~10:45AM EST April 10th

Happy to provide any information that might be useful for debugging.

Building without spacemacs icon means that you can't reuse bottle, hence it builds from sources. This is what I meant by 'installing from HEAD or using bottle is a workaround'.

I still don't know how to fix this issue ๐Ÿ˜ž

If it helps for debugging, here's what I'm seeing when attempting to open the GUI from the command line (note error -10810):

Installation info
% brew info emacs-plus
# d12frosted/emacs-plus/emacs-plus: stable 26.3 (bottled), HEAD
# GNU Emacs text editor
# https://www.gnu.org/software/emacs/
# /usr/local/Cellar/emacs-plus/26.3 (3,992 files, 124MB) *
#   Built from source on 2020-04-15 at 14:37:59 with: --without-spacemacs-icon --with-no-titlebar --with-modern-icon --with-no-frame-refocus --with-dbus --with-mailutils
# From: https://github.com/d12frosted/homebrew-emacs-plus/blob/master/Formula/emacs-plus.rb
# ==> Dependencies
# Build: pkg-config โœ”
# Recommended: little-cms2 โœ”, gnutls โœ”, librsvg โœ”, imagemagick@6 โœ”
# Optional: dbus โœ”, mailutils โœ”, jansson โœ˜
# ==> Requirements
# Optional: x11 โœ”
# ==> Options
# [. . .]
#
# ==> Caveats
# Emacs.app was installed to:
#   /usr/local/opt/emacs-plus
#
# To link the application to default Homebrew App location:
#   ln -s /usr/local/opt/emacs-plus/Emacs.app /Applications
#
# [. . .]
% open -a Emacs
# LSOpenURLsWithRole() failed for the application /usr/local/Cellar/emacs-plus/26.3/Emacs.app with error -10810.

% chmod +x  /usr/local/Cellar/emacs-plus/26.3/Emacs.app/Contents/MacOS/Emacs

% xattr -dr com.apple.quarantine  /usr/local/Cellar/emacs-plus/26.3/Emacs.app/Contents/MacOS/Emacs

% open -a Emacs
# LSOpenURLsWithRole() failed for the application /usr/local/Cellar/emacs-plus/26.3/Emacs.app with error -10810.

That's interesting.

LSOpenURLsWithRole() failed for the application /usr/local/Cellar/emacs-plus/26.3/Emacs.app with error -10810.

Didn't try to launch Emacs like this. The error might be helpful.

% xattr -dr com.apple.quarantine /usr/local/Cellar/emacs-plus/26.3/Emacs.app/Contents/MacOS/Emacs

As far as I understand, this is needed if the application is in quarantine for some reason. But when I do

$ xattr -l /usr/local/Cellar/emacs-plus/26.3/Emacs.app/Contents/MacOS/Emacs

I don't get quarantine attribute. So removing application from quarantine doesn't help.

fwiw, I worked around this by installing Emacs 28 and hooooooly cow does it zoom ๐Ÿ˜„
highly recommended: https://github.com/daviderestivo/homebrew-emacs-head

@jmromer yes, as I said,

P. S. installing from HEAD or using bottle is a workaround.

so go ahead and

$ brew install emacs-plus --HEAD [all-your-fav-options]

so go ahead and

$ brew install emacs-plus --HEAD [all-your-fav-options]

No luck with the emacs-plus formula, I'm afraid โ€” possibly something awry with my environment, I'm not sure:

brew install emacs-plus --HEAD
% brew install emacs-plus \
  --HEAD \
  --with-jansson \
  --with-modern-icon \
  --with-no-frame-refocus \
  --with-no-titlebar \
  --with-xwidgets \
  --without-spacemacs-icon

==> Installing emacs-plus from d12frosted/emacs-plus
==> Cloning https://github.com/emacs-mirror/emacs.git
Cloning into '/Users/jmromer/Library/Caches/Homebrew/emacs-plus--git'...
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/no-titlebar-head.patch
######################################################################## 100.0%
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/xwidgets_webkit_in_cocoa.patch
######################################################################## 100.0%
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/no-frame-refocus-cocoa.patch
######################################################################## 100.0%
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/fix-window-role.patch
Already downloaded: /Users/jmromer/Library/Caches/Homebrew/downloads/b7046a273c114e23f734df97967f4016486f1d080bad1ba40dbd53a5c86a09e0--fix-window-role.patch
Error: An exception occurred within a child process:
  ChecksumMismatchError: SHA256 mismatch
Expected: 96f22b2bdf6e5e64b81786eccbf6229f093defa52bcf2ec88c9ec19e1860ee55
  Actual: ae92602a95564efe1aecec85563b116bf4211371a7c1f7e5d9c356107b4adf6d
 Archive: /Users/jmromer/Library/Caches/Homebrew/downloads/b7046a273c114e23f734df97967f4016486f1d080bad1ba40dbd53a5c86a09e0--fix-window-role.patch
To retry an incomplete download, remove the file above.

Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC.

(no difference when removing the patch)

Oh sorry, that might be because I've updated the patches.

Please do as brew is saying and remove the archived patch:

$ rm /Users/jmromer/Library/Caches/Homebrew/downloads/b7046a273c114e23f734df97967f4016486f1d080bad1ba40dbd53a5c86a09e0--fix-window-role.patch

Experienced the same problem with macos 10.15.4 and can verify that installing from head works:

brew install emacs-plus --HEAD --with-no-titlebar
hh commented

Would it be useful to add the ability to specify a tag like 26.3 27.1 or HEAD?

@hh sorry, I didn't get your question.

If you want to install HEAD you need to pass --HEAD option. If you want to install Emacs 27 you need to pass two options: --HEAD --with-emacs-27-branch. Otherwise Emacs 26.3 is installed.

Just a small tip, I sometimes run brew cleanup which can sometimes fix issues.

I'm getting all the same issues, any option I try and use causes an error and emacs-plus fails to load, apart from just emacs-plus --HEAD.

@atanasj yes, Emacs 26.3 is broken on the latest version of macOS unless you install from bottle (so no custom options are allowed). I also updated recently to debug this issue and now have to stick to HEAD.

I still don't know what happened and I am yet to bisect what fixed this issue on HEAD. Any help is appreciated. ๐Ÿ˜ธ

I wish I could help! I was hoping to build --with-native-comp-branch so deleted everything, but alas, my greed for speed cost me my(emacs) house! I hope it's all up and running again soon.

@d12frosted... Is this a brew issue, emacs-plus issue or emacs issue?

@atanasj I feel you regarding broken house haha.

Regarding the root of the issue. I think it's emacs + new version of macOS. You can reproduce this issue even with core emacs formula: brew install emacs.

I'm still on 10.14.6... Hmmm... watch and wait I suppose...

If you really desperate you can experiment...

git clone -b master git://git.sv.gnu.org/emacs.git
make install

@darrylhebbes, I'd love to experiment, but unfortunately for me this often means rabbit holes and dead ends. Do you have a recommended way to build from source with many of the features offered by emacs-plus?

Wait, master branch is Emacs 28, not 26.3 :) The last time I tried building straight from 26.3 branch (with NS/Cocoa) I got broken Emacs as well. Maybe I did something wrong, so would be nice to have someone to try it as well.

If you want to get /any/ version of emacs, just build emacs-plus with --HEAD option :) I am using it every day and we have a CI that checks that it builds.

Nice, now I can't build Emacs from sources at all and it fails during make.

If someone wants to test it (and ideally we should report it to upstream):

$ git clone --depth 1 --branch emacs-26 https://github.com/emacs-mirror/emacs
$ cd emacs
$ ./autogen.sh
$ ./configure --with-ns --disable-ns-self-contained [--without-makeinfo --without-pop]
$ make
$ make install

After that Emacs.app should be in nextstep/Emacs.app.

P. S. I am getting this error:

/bin/sh: line 1:  3490 Killed: 9               EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp --eval '(setq load-prefer-newer t)' -f batch-byte-compile emacs-lisp/macroexp.el
make[3]: *** [emacs-lisp/macroexp.elc] Error 137
make[2]: *** [bootstrap-emacs] Error 2
make[1]: *** [src] Error 2
make: *** [bootstrap] Error 2

If you want to get /any/ version of emacs, just build emacs-plus with --HEAD option :) I am using it every day and we have a CI that checks that it builds.

@d12frosted, yes, that's what I did. Just doesn't have the extra bells and whistles options.

@atanasj apologies if I misunderstood you,

Wild guess, in general this issue might be also related

does that mean that HEAD misses some options that you would love to have? :) if this is the case, can you please elaborate?

If a working emacs-plus v27 is what you need, I got this to work last night.

sudo rm -rf /usr/local/Cellar/emacs-plus
brew cleanup
brew update
brew install emacs-plus --with-emacs-27-branch --HEAD

Above installed GNU Emacs 27.0.91 (build 2, x86_64-apple-darwin19.4.0, NS appkit-1894.40 Version 10.15.4 (Build 19E287))

I am on Mac OS 10.15.4

No, I am trying to get emacs-26 :) I can get working emacs-27 or emacs-28 using emacs-plus formula. The problem only with emacs-26 :(

@d12frosted, yes --HEAD fails with all options too. Sorry, shouldn't really be under this issue I suppose. My usual options are:

brew install emacs-plus --HEAD --without-spacemacs-icon --with-no-titlebar --with-xwidgets --with-jansson --with-no-frame-refocus

But this was failing with all or any option and would usually break on the first one.

@atanasj Hm, just tried your command and it worked. Can you please update your brew (e.g. brew update) and if still doesn't work fire another issue for this?

Update I've revisited issue template, so it now asks to update brew and include output of brew doctor and brew config.

Why I ask to update? Because recently brew broke command line parsing twice and you should be on the latest version of brew to be able to install emacs-plus.

Thanks @d12frosted, that seems to have sorted it!

I have the same issue with brew install emacs-plus --without-spacemacs-icon๏ผŒMac 10.15.4

@jidicula

No, I am trying to get emacs-26 :) I can get working emacs-27 or emacs-28 using emacs-plus formula. The problem only with emacs-26 :(

#195 (comment)