homebrew-emacs-plus: Installs ok - strange function error on first run
Please make sure to follow these steps (and mark the checkboxes):
- run
brew updateand try to reproduce the issue again - run
brew doctor, fix all issues and try to reproduce your issue again - run
brew configandbrew doctorand include their output
What you were trying to do
Install emacs-plus@28 on to a brand new macbook with:
brew install emacs-plus@28 --with-modern-paper-icon --with-xwidgets --with-native-comp --with-no-titlebar --with-mailutils --with-debug
What happened (include command output)
Brew reports it installed correctly
* brew info emacs-plus@28
d12frosted/emacs-plus/emacs-plus@28: stable 28.0.50
/usr/local/Cellar/emacs-plus@28/28.0.50 (4,330 files, 167MB) *
Built from source on 2021-06-27 at 15:31:24 with: --with-no-titlebar --with-debug --with-xwidgets --with-native-comp --with-mailutils --with-modern-paper-icon
From: https://github.com/d12frosted/homebrew-emacs-plus/blob/HEAD/
==> Dependencies
Build: autoconf ✔, gnu-sed ✔, pkg-config ✔, texinfo ✔
Required: gnutls ✔, librsvg ✔, little-cms2 ✔, jansson ✔
Recommended: imagemagick ✔
Optional: dbus ✔, mailutils ✔
==> Options
--with-EmacsIcon1-icon
Using Emacs EmacsIcon1 icon
--with-EmacsIcon2-icon
Using Emacs EmacsIcon2 icon
--with-EmacsIcon3-icon
Using Emacs EmacsIcon3 icon
--with-EmacsIcon4-icon
Using Emacs EmacsIcon4 icon
--with-EmacsIcon5-icon
Using Emacs EmacsIcon5 icon
--with-EmacsIcon6-icon
Using Emacs EmacsIcon6 icon
--with-EmacsIcon7-icon
Using Emacs EmacsIcon7 icon
--with-EmacsIcon8-icon
Using Emacs EmacsIcon8 icon
--with-EmacsIcon9-icon
Using Emacs EmacsIcon9 icon
--with-cacodemon-icon
Using Emacs cacodemon icon
--with-ctags
Don't remove the ctags executable that Emacs provides
--with-dbus
Build with dbus support
--with-debug
Build with debug symbols and debugger friendly optimizations
--with-elrumo1-icon
Using Emacs elrumo1 icon
--with-elrumo2-icon
Using Emacs elrumo2 icon
--with-emacs-card-blue-deep-icon
Using Emacs emacs-card-blue-deep icon
--with-emacs-card-british-racing-green-icon
Using Emacs emacs-card-british-racing-green icon
--with-emacs-card-carmine-icon
Using Emacs emacs-card-carmine icon
--with-emacs-card-green-icon
Using Emacs emacs-card-green icon
--with-gnu-head-icon
Using Emacs gnu-head icon
--with-mailutils
Build with mailutils support
--with-modern-alecive-flatwoken-icon
Using Emacs modern-alecive-flatwoken icon
--with-modern-asingh4242-icon
Using Emacs modern-asingh4242 icon
--with-modern-azhilin-icon
Using Emacs modern-azhilin icon
--with-modern-bananxan-icon
Using Emacs modern-bananxan icon
--with-modern-black-dragon-icon
Using Emacs modern-black-dragon icon
--with-modern-black-gnu-head-icon
Using Emacs modern-black-gnu-head icon
--with-modern-black-variant-icon
Using Emacs modern-black-variant icon
--with-modern-bokehlicia-captiva-icon
Using Emacs modern-bokehlicia-captiva icon
--with-modern-cg433n-icon
Using Emacs modern-cg433n icon
--with-modern-doom-icon
Using Emacs modern-doom icon
--with-modern-doom3-icon
Using Emacs modern-doom3 icon
--with-modern-icon
Using Emacs modern icon
--with-modern-mzaplotnik-icon
Using Emacs modern-mzaplotnik icon
--with-modern-nuvola-icon
Using Emacs modern-nuvola icon
--with-modern-orange-icon
Using Emacs modern-orange icon
--with-modern-paper-icon
Using Emacs modern-paper icon
--with-modern-papirus-icon
Using Emacs modern-papirus icon
--with-modern-pen-3d-icon
Using Emacs modern-pen-3d icon
--with-modern-pen-black-icon
Using Emacs modern-pen-black icon
--with-modern-pen-icon
Using Emacs modern-pen icon
--with-modern-pen-lds56-icon
Using Emacs modern-pen-lds56 icon
--with-modern-purple-flat-icon
Using Emacs modern-purple-flat icon
--with-modern-sexy-v1-icon
Using Emacs modern-sexy-v1 icon
--with-modern-sexy-v2-icon
Using Emacs modern-sexy-v2 icon
--with-modern-sjrmanning-icon
Using Emacs modern-sjrmanning icon
--with-modern-vscode-icon
Using Emacs modern-vscode icon
--with-modern-yellow-icon
Using Emacs modern-yellow icon
--with-native-comp
Build with native compilation
--with-no-frame-refocus
Disables frame re-focus (ie. closing one frame does not refocus another one)
--with-no-titlebar
Experimental: build without titlebar
--with-nobu417-big-sur-icon
Using Emacs nobu417-big-sur icon
--with-retro-emacs-logo-icon
Using Emacs retro-emacs-logo icon
--with-retro-gnu-meditate-levitate-icon
Using Emacs retro-gnu-meditate-levitate icon
--with-retro-sink-bw-icon
Using Emacs retro-sink-bw icon
--with-retro-sink-icon
Using Emacs retro-sink icon
--with-spacemacs-icon
Using Emacs spacemacs icon
--with-x11
Experimental: build with x11 support
--with-xwidgets
Experimental: build with xwidgets support
--without-cocoa
Build a non-Cocoa version of Emacs
--without-imagemagick
Build without imagemagick support
==> Caveats
Emacs.app was installed to:
/usr/local/opt/emacs-plus@28
To link the application to default Homebrew App location:
ln -s /usr/local/opt/emacs-plus@28/Emacs.app /Applications
To have launchd start d12frosted/emacs-plus/emacs-plus@28 now and restart at login:
brew services start d12frosted/emacs-plus/emacs-plus@28
Or, if you don't want/need a background service you can just run:
emacs
✓ ~$
* ln -s /usr/local/opt/emacs-plus@28/Emacs.app /Applications
'/Applications/Emacs.app' -> '/usr/local/opt/emacs-plus@28/Emacs.app'
✓ ~$
>
The problem is when launching it:
✓ ~$
* emacs
emacs: can't find function "F6d656e752d6261722d7570646174652d62756666657273_menu_bar_update_buffers_0" in compilation unit /usr/local/Cellar/emacs-plus@28/28.0.50/libexec/emacs/28.0.50/x86_64-apple-darwin19.6.0/../../../../bin/../lib/emacs/28.0.50/native-lisp/28.0.50-d79ffe10/preloaded/menu-bar-4f46ea94-7781c24c.eln
❌ ~$
also
❌ ~$
* open -a emacs
LSOpenURLsWithRole() failed for the application /usr/local/Cellar/emacs-plus@28/28.0.50/Emacs.app with error -10810.
Output of brew config
$ brew config HOMEBREW_VERSION: 3.2.0 ORIGIN: https://github.com/Homebrew/brew HEAD: 09f7bc27a99469cf947431df4754737dfbadb31d Last commit: 7 days ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 756b091d1d6988bb13926e7bb4116926ea724302 Core tap last commit: 48 minutes ago Core tap branch: master HOMEBREW_PREFIX: /usr/local HOMEBREW_CASK_OPTS: [] HOMEBREW_EDITOR: nvim HOMEBREW_MAKE_JOBS: 12 Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby CPU: dodeca-core 64-bit kabylake Clang: 12.0.0 build 1200 Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 7.64.1 => /usr/bin/curl macOS: 10.15.7-x86_64 CLT: 12.4.0.0.1.1610135815 Xcode: N/A
Output of brew doctor
$ brew doctor Your system is ready to brew.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 19 (13 by maintainers)
running
brew edit emacs-plus@28and changing the line in the formula from,url "https://github.com/emacs-mirror/emacs.git"to:url "https://github.com/emacs-mirror/emacs.git", revision: "4d63a033a726a8da33bda8d18a503e88bfb794fb"(which tells brew to pull the source from the commit just before problems started on the automated builds) allows native comp option to be built without issues.@d12frosted let me know if you would like me to submit a PR for the formula. It’s only a temporary fix, obviously, but it seems like an upstream issue.
This worked, thank you @bienjensu !
@lancelet thanks for the link. That thread already has a patch that fixes the issue. We could use it to fix the build, but instead I simply merged #366 by @bienjensu . Hopefully the fix will land soon and we will be able to unpin. In the worst case scenario, we can simply apply that patch in
emacs-plus@28.Thanks everyone for reporting and investigation! And sorry for my slow response.
I then tried the hack provided by @mkvoya in https://github.com/d12frosted/homebrew-emacs-plus/issues/364#issuecomment-875684667
Which works succesfuly 🎉
I’m now running the latest Emacs from master, thanks @mkvoya !
Right. Once I did the symlinking as described above it worked.
The can’t-find-function issue seems to be caused by the dynlib_id, which should have been fixed by the following code:
https://github.com/d12frosted/homebrew-emacs-plus/blob/6d876cc24da1f3232ceae989e1ad0cdddf433912/Formula/emacs-plus%4028.rb#L177-L186
I checked the file by
and found that the
LC_ID_DYLIBpart’snamefield showsxxxx/fake.so(I can’t remember the exact path). And all other ELN files under the same directory have the sameLC_ID_DYLIBname.Then I found there are two copies of the
native-lispdirectory. One is at/usr/local/Cellar/emacs-plus@28/28.0.50/lib/emacs/28.0.50/native-lisp, in which all ELN files have the sameLC_ID_DYLIBname (i.e.,fake.so). The other one is at/usr/local/Cellar/emacs-plus@28/28.0.50/Emacs.app/Contents/native-lisp, in which all ELN files have differentLC_ID_DYLIBnames. The first copy is installed by themake installscripts of Emacs. The second copy is installed and correctly patched by the formula, but somehow is not used by emacs.A simple, but temporary fix is to delete the
/usr/local/Cellar/emacs-plus@28/28.0.50/lib/emacs/28.0.50/native-lispdirectory and make a newnative-lispsymlink to/usr/local/Cellar/emacs-plus@28/28.0.50/Emacs.app/Contents/native-lisp.There could be better fixes to be applied in the formula but I am not good at ruby. Hope the information helps someone that could fix the issue.
@d12frosted Created a PR #366.
It’s difficult to find anything in the emacs bug reports, but I suspect this might be the upstream issue we’re tracking: https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-06/msg01351.html
It mentions https://github.com/emacs-mirror/emacs/commit/5dd2d50f3d5e65b85c87da86e2e8a6d087fe5767 (the same as mentioned above on this issue) as the commit which introduced the problem. Since the issue is a hash in the
elnfiles related to their location, and clearly impacts non-brew builds, it might be best to wait for the upstream fix. The intermediate solution of pinning the git commit to before the problem was introduced looks like a good solution to me (provided it’s noted somewhere in the README).