Homebrew-emacs-plus: Linker library load error on master branch (emacs-plus@28 --with-xwidgets --with-native-comp)

Created on 31 Jan 2021  路  9Comments  路  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
  • [ ] run brew doctor, fix all issues and try to reproduce your issue again
    (The warnings seems unrelated to this, will try to fix all if that seems like an issue.)
  • [x] run brew config and brew doctor and include their output

What you were trying to do

Installing and opening emacs gives me bunch of these errors

ld: library not found for -lgcc_ext.10.5
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice \"failed to compile\" \"/Users/umar/.config/emacs/eln-cache/28.0.50-x86_64...\" \"error invoking gcc driver\")
  comp--compile-ctxt-to-file(\"/Users/umar/.config/emacs/eln-cache/28.0.50-x86_64...\")
  comp-compile-ctxt-to-file(\"/Users/umar/.config/emacs/eln-cache/28.0.50-x86_64...\")
  comp-final1()
  load-with-code-conversion(\"/var/folders/f3/j94kxrl177b_fn9gzqkytwgw0000gp/T/e...\" \"/var/folders/f3/j94kxrl177b_fn9gzqkytwgw0000gp/T/e...\" nil t)
  command-line-1((\"-l\" \"/var/folders/f3/j94kxrl177b_fn9gzqkytwgw0000gp/T/e...\"))
  command-line()
  normal-top-level()
## Steps tried so far - Reinstalling `gcc` and `libgccjit`
Command output
brew reinstall gcc libgccjit
==> Downloading https://homebrew.bintray.com/bottles/gcc-10.2.0_3.catalina.bottle.tar.gz
Already downloaded: /Users/umar/Library/Caches/Homebrew/downloads/03087cb9847fdc45f4f04f0a77eb1f9cee6aab4ed2fdd314085bed2c0c315cbc--gcc-10.2.0_3.catalina.bottle.tar.gz
==> Reinstalling gcc 
==> Pouring gcc-10.2.0_3.catalina.bottle.tar.gz
馃嵑  /usr/local/Cellar/gcc/10.2.0_3: 1,465 files, 339.5MB
==> Downloading https://homebrew.bintray.com/bottles/libgccjit-10.2.0_1.catalina.bottle.1.tar.gz
Already downloaded: /Users/umar/Library/Caches/Homebrew/downloads/3b6e694d326f34859c7f764b09c24898303707024c69c2782e6c51e2a3f0ef00--libgccjit-10.2.0_1.catalina.bottle.1.tar.gz
==> Reinstalling libgccjit 
==> Pouring libgccjit-10.2.0_1.catalina.bottle.1.tar.gz
   
- Linking brew installed gcc as the default gcc
$ which gcc
/usr/bin/gcc

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

$ ln -s /usr/local/bin/gcc-10 /usr/local/bin/gcc

$ which gcc
/usr/local/bin/gcc

$ gcc --version
gcc (Homebrew GCC 10.2.0_3) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I see the library at the following paths but not sure how macOS adds them to the LD path `$LD_LIBRARY_PATH` and `$DYLD_LIBRARY_PATH` are empty by default The library can be seen at the following paths
/System/Volumes/Data/usr/local/lib/gcc/10/libgcc_ext.10.5.dylib
/System/Volumes/Data/usr/local/Cellar/gcc/10.2.0_3/lib/gcc/10/libgcc_ext.10.5.dylib
/usr/local/Cellar/gcc/10.2.0_3/lib/gcc/10/libgcc_ext.10.5.dylib
/usr/local/lib/gcc/10/libgcc_ext.10.5.dylib
## Output of `brew config`
$ brew config
HOMEBREW_VERSION: 2.7.7
ORIGIN: https://github.com/Homebrew/brew
HEAD: cd191a7f6c4c8e053336d0ea34a9886b12d06470
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 3506ee7b09e90859ed4e7451f339e012dce46bd5
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: :0
HOMEBREW_EDITOR: emacsclient
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 11.0 build 1103
Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 14.0.2
macOS: 10.15.7-x86_64
CLT: 1103.0.32.62
Xcode: N/A
XQuartz: 2.7.11 => /opt/X11

Output of brew doctor

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

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.


Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  [email protected]

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/umar/.pyenv/shims/python3.7-config
  /Users/umar/.pyenv/shims/python3.7m-config
  /Users/umar/.pyenv/shims/python-config
  /Users/umar/.pyenv/shims/python3-config

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

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  pdftohtml
  [email protected]
  php
  youtube-dl
  [email protected]

Warning: Homebrew's "sbin" was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting your PATH for example like so:
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

Warning: Broken symlinks were found. Remove them with `brew cleanup`:
  /usr/local/share/zsh/site-functions/_brew_cask
install error

Most helpful comment

I decided to try emacs-plus today with --native-comp and I had to follow similar instructions:

emacs -Q
file-file init.el
M-x eval-buffer

Then wait until gccemacs was done.

I was unable to get this to work any other way.

All 9 comments

Hey @Gleek,

Honestly, I have no idea how xwidgets and gccemacs work together. Both very experimental features. So I have to ask, do they work for you separately?

I've no idea how my last comment did not get posted. Sorry about that. I'll add the update here again

It worked but I don't have an idea how. I did two things apart from the things I already mentioned above and it started to work.

  • Opened my init.el and ran M-x eval-buffer manually. I let the compilation run then.
  • Opened another emacs instance through command line to notice no compilation errors this time 馃
  • Restarted the main emacs through spotlight to not notice any error again.

Not sure if any of these triggered a fix, or was it some late affect of the other changes I did before. I had restarted multiple times before through spotlight but it always broke, but now it works.

You would have a better idea on what might have worked. You can close issue this as far as I'm concerned or keep this open if you've something to add.

Ok, I see. Please take a look at #187. Native comp branch is not easy to use.

It also seems strange that you set LD_LIBRARY_PATH. Please see these two comments: one and two

For me it worked with latest libgccjit, and with empty lib path.

Ok, I see. Please take a look at #187. Native comp branch is not easy to use.

Yes, I've been following that issue.

It also seems strange that you set LD_LIBRARY_PATH. Please see these two comments: one and two

No I didn't set that. I was actually asking if that was the way to go to do this. Didn't do them yet because of Sean's comment. Apparently, it wasn't needed.

For me it worked with latest libgccjit, and with empty lib path.

It worked for me earlier as well. I installed with the same flags on around 23rd Dec and everything worked flawlessly. Not even needing the gcc/libgccjit reinstall.

I wanted to see if there are any new optimizations that might have been merged upstream by now and reinstalled to get the issues. Possibly, some change in the upstream might have caused this.

Seems like the cause might remain a mystery for some time 馃槃

Thank you for this formulae and looking into the issue anyway :).

Sorry, now ideas right now.

It worked for me earlier as well. I installed with the same flags on around 23rd Dec and everything worked flawlessly. Not even needing the gcc/libgccjit reinstall.

Now I fear to rebuild Emacs 馃槰

I wanted to see if there are any new optimizations that might have been merged upstream by now and reinstalled to get the issues. Possibly, some change in the upstream might have caused this.

None that I know about.

Seems like the cause might remain a mystery for some time 馃槃

Hopefuly for a short time 馃樃

@Gleek did you find a solution for this? :)

Hey @d12frosted,
I haven't faced it again after the steps I did that are mentioned above.
I also haven't tried to recompile emacs again so I'm not sure if someone recompiling now will face the same errors.

I'll probably recompile after few weeks if any change worth updating lands on master and will report the status here.
I think we can close this issue for now and reopen if someone else reports it as well.

Alright. Then closing for now. Have fun with gccemacs :)

I decided to try emacs-plus today with --native-comp and I had to follow similar instructions:

emacs -Q
file-file init.el
M-x eval-buffer

Then wait until gccemacs was done.

I was unable to get this to work any other way.

Was this page helpful?
0 / 5 - 0 ratings