Homebrew-emacs-plus: Could not install feature/native-comp 39bc9bc770

Created on 5 Apr 2021  ยท  10Comments  ยท  Source: d12frosted/homebrew-emacs-plus

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

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

What you were trying to do

Hi, trying to recompile emacs-plus@28 --with-no-titlebar --with-native-comp --with-dbus --with-modern-icon

It builds fine, but the latest commit 39bc9bc770 for feature/native-comp results in this error when trying to run emacs from CLI:

emacs: can't find function "F6d656e752d6261722d7570646174652d62756666657273_menu_bar_update_buffers_0" in compilation unit /usr/local/Cellar/emacs-plus@28/28.0.50/Emacs.app/Contents/MacOS/../native-lisp/28.0.50-8cd70b02/preloaded/menu-bar-4f46ea94-7194396e.eln

I was going to try rolling with an older commit, but I'm not sure how to make it happen.

What happened (include command output)

$ brew install emacs-plus@28 --with-no-titlebar --with-native-comp --with-dbus --with-modern-icon


Command output

==> Installing emacs-plus@28 from d12frosted/emacs-plus
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/emacs-28/no-titlebar.patch

################################################################## 100.0%

==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/emacs-28/fix-window-role.patch
Already downloaded: /Users/orchid/Library/Caches/Homebrew/downloads/fe10dba71a5a9f8fef6f4534268970b2b0ae0f941e515daed7ae88465083c287--fix-window-role.patch
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/emacs-28/system-appearance.patch
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/aaa0da80d33eac9e551adf7faf404e565c71e86c02ea4659200474fd6d899f5a--system-appearance.patch
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/icons/modern.icns
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/793faf4d8801cdcff99373bedbad455953884ba9c17937b7823a66e5b4982398--modern.icns
==> Cloning https://github.com/emacs-mirror/emacs.git
Updating /Users/user/Library/Caches/Homebrew/emacs-plus@28--git
==> Checking out branch feature/native-comp
Already on 'feature/native-comp'
Your branch is up to date with 'origin/feature/native-comp'.
HEAD is now at 39bc9bc770 * src/comp.c (fixup_eln_load_path): Fix parameter name.
==> Patching
==> Applying no-titlebar.patch
patching file src/nsterm.m
Hunk #1 succeeded at 441 (offset -32 lines).
Hunk #2 succeeded at 1968 (offset -15 lines).
Hunk #3 succeeded at 7526 (offset -11 lines).
Hunk #4 succeeded at 7563 with fuzz 1 (offset -12 lines).
==> Applying fix-window-role.patch
patching file src/nsterm.m
Hunk #1 succeeded at 8883 (offset 115 lines).
==> Applying system-appearance.patch
patching file src/frame.h
patching file src/nsfns.m
Hunk #1 succeeded at 1277 (offset 24 lines).
patching file src/nsterm.m
Hunk #1 succeeded at 2183 (offset -11 lines).
Hunk #2 succeeded at 5679 (offset -72 lines).
Hunk #3 succeeded at 5925 (offset -72 lines).
Hunk #4 succeeded at 5975 (offset -72 lines).
Hunk #5 succeeded at 6201 (offset -72 lines).
Hunk #6 succeeded at 9214 (offset 82 lines).
Hunk #7 succeeded at 10300 (offset 286 lines).
==> ImageMagick PKG_CONFIG_PATH:
/usr/local/opt/imagemagick/lib/pkgconfig
==> ./autogen.sh
==> ./configure --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-plus@28/28.0.50/share/info/emacs --prefix=/usr/local/Cellar/emacs-plus@28/
==> make
==> make install
==> Change dylib_id of ELN files before post_install phase
==> Change dylib_id of ELN files before post_install phase
==> Change dylib_id of ELN files before post_install phase
==> Change dylib_id of ELN files before post_install phase
==> Change dylib_id of ELN files before post_install phase
==> Change dylib_id of ELN files before post_install phase
==> Change dylib_id of ELN files before post_install phase
==> Change dylib_id of ELN files before post_install phase
==> 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
==> Summary
๐Ÿบ /usr/local/Cellar/emacs-plus@28/28.0.50: 4,184 files, 155.4MB, built in 13 minutes 15 seconds


Output of brew config

$ brew config
HOMEBREW_VERSION: 3.0.10-224-g698c490
ORIGIN: https://github.com/Homebrew/brew
HEAD: 698c49067dbff69a44b13ab87c828d79a66dc543
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: aa4e0aadb7723893b984d7dfa57266d9231c15ba
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: :0
HOMEBREW_EDITOR: nano
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ANALYTICS: set
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit kabylake
Clang: 12.0 build 1200
Git: 2.31.1 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.1-x86_64
CLT: 12.4.0.0.1.1610135815
Xcode: N/A
XQuartz: 2.7.11 => /opt/X11

Output of brew doctor

$ brew doctor
Your system is ready to brew.
install error

Most helpful comment

Fantastic news!

All 10 comments

CI found the same issue. Will check if upstream is aware of this.

Current state - I have pinned native-comp feature to a specific version, instead of the latest. But we need to find a fix, or contact maintainer of this feature.

Unfortunately I am very limited in time this month, so I doubt that I will have time for this issue, so if someone wants to help, this is a good opportunity :)

The fix by pinning version is causing following issue

==> Cloning https://github.com/emacs-mirror/emacs.git
Updating /Users/deepu.puthrote/Library/Caches/Homebrew/emacs-plus@28--git
==> Checking out revision 978afd788fd0496540f715b83f18ed390ca8d5a4
fatal: reference is not a tree: 978afd788fd0496540f715b83f18ed390ca8d5a4
Error: Failed to download resource "emacs-plus@28"
Failure while executing; `git checkout -f 978afd788fd0496540f715b83f18ed390ca8d5a4 --` exited with 128. Here's the output:
fatal: reference is not a tree: 978afd788fd0496540f715b83f18ed390ca8d5a4

Link to my reply. And here is a copy:

Well, it's there :) https://github.com/emacs-mirror/emacs/commit/978afd788fd0496540f715b83f18ed390ca8d5a4

From homebrew docs:

To use a specific commit, tag, or branch from a repository, specify head with the :tag and :revision, :revision, or :branch option, like so:

class Foo < Formula
  head "https://github.com/some/package.git", :revision => "090930930295adslfknsdfsdaffnasd13"
                                         # or :branch => "develop" (the default is "master")
                                         # or :tag => "1_0_release",
                                         #    :revision => "090930930295adslfknsdfsdaffnasd13"
end

I though that means that revision is enough. According to CI it is.

Thank you for your quick reply.

I tried manually running git checkout -f 978afd788fd0496540f715b83f18ed390ca8d5a4 in ~/Library/Caches/Homebrew/emacs-plus@28--git - gets the same error โŒ

So I did the following

# did not work on master branch
โœ— ๐Ÿค• git checkout 978afd788fd0496540f715b83f18ed390ca8d5a4
fatal: reference is not a tree: 978afd788fd0496540f715b83f18ed390ca8d5a4

# checkout feature/native-comp
โœ— ๐Ÿค• git checkout feature/native-comp
Updating files: 100% (618/618), done.
Switched to branch 'feature/native-comp'

โžœ ๐Ÿ˜ƒ git checkout -f 978afd788fd0496540f715b83f18ed390ca8d5a4
fatal: reference is not a tree: 978afd788fd0496540f715b83f18ed390ca8d5a4

# did not work from feature/native-comp without pulling first

โœ— ๐Ÿค• git pull origin feature/native-comp
remote: Enumerating objects: 9939, done.

โžœ ๐Ÿ˜ƒ git checkout -f 978afd788fd0496540f715b83f18ed390ca8d5a4
HEAD is now at 978afd788f * src/comp.h (unload_comp_unit): Define for vanilla build (warning removal).

# worked after pulling

After I that's done manually, brew is able to continue โœ…

==> Cloning https://github.com/emacs-mirror/emacs.git
Updating /Users/deepu.puthrote/Library/Caches/Homebrew/emacs-plus@28--git
==> Checking out revision 978afd788fd0496540f715b83f18ed390ca8d5a4
HEAD is now at 978afd788f * src/comp.h (unload_comp_unit): Define for vanilla build (warning removal).
HEAD is now at 978afd788f * src/comp.h (unload_comp_unit): Define for vanilla build (warning removal).

Nice! Thanks for providing steps to manually fix that. I wll check in the evening if it's possible to combine branch and revision. Though if you wish, you can go ahead and prepare a PR :) To test, you need to remove emacs-plus@28--git from Library and use ./build 28 --with-native-comp from the root of homebrew-emacs-plus repository ๐Ÿ˜ธ

Thank you.

Tried combinations of these but unsuccessful :(

  if build.with? "native-comp"
    url "https://github.com/emacs-mirror/emacs.git", :branch => "feature/native-comp"
    url "https://github.com/emacs-mirror/emacs.git", :revision => "978afd788fd0496540f715b83f18ed390ca8d5a4"
    system_command "git" "checkout" "-f" "978afd788fd0496540f715b83f18ed390ca8d5a4"
  else
    url "https://github.com/emacs-mirror/emacs.git"
  end

Tried this, but it just stayed on feature/native-comp branch.

  if build.with? "native-comp"
    url "https://github.com/emacs-mirror/emacs.git",
        :branch => "feature/native-comp",
        :revision => "978afd788fd0496540f715b83f18ed390ca8d5a4"
  else
    url "https://github.com/emacs-mirror/emacs.git"
  end

I loe the idea of calling git, but it needs to be called a little bit later, afaiu in this block you are not located in directory. So you need to move it to install function, but then it means that patches will be reverted.

@WarFox can you please share output of brew config? Maybe there is a difference between versions?

It turned out that I am on the outdated version of brew, but could not reproduce even after upgrade. Here is my output.

$ brew config
HOMEBREW_VERSION: 3.0.11-70-gb9abcd8
ORIGIN: https://github.com/Homebrew/brew
HEAD: b9abcd8490fa1d62132be960ed0984d93a52325a
Last commit: 45 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 6b3b83da5cf79d959b8e3dc577e4ff1544b2dbdb
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.3g2F4r0B9t/org.macosforge.xquartz:0
HOMEBREW_EDITOR: emacsclient
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ANALYTICS: set
HOMEBREW_NO_AUTO_UPDATE: set
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit haswell
Clang: 12.0 build 1200
Git: 2.30.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.0.1-x86_64
CLT: 12.3.0.0.1.1607026830
Xcode: 12.4
XQuartz: 2.7.11 => /opt/X11

Thanks to @daviderestivo it's fixed now! ๐ŸŽ‰

@WarFox no hacks are needed anymore :)

Fantastic news!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

agzam picture agzam  ยท  6Comments

d12frosted picture d12frosted  ยท  6Comments

d12frosted picture d12frosted  ยท  8Comments

d12frosted picture d12frosted  ยท  5Comments

jonathanj picture jonathanj  ยท  3Comments