Homebrew-emacs-plus: Library not loaded: libMagickWand

Created on 3 Feb 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

Install and run emacs-plus.

What happened (include command output)

brew install emacs-plus [OPTIONS] worked. But running emacs got me the following error:

dyld: Library not loaded: /usr/local/opt/imagemagick/lib/libMagickWand-7.Q16HDRI.8.dylib
  Referenced from: /usr/local/Cellar/emacs-plus@27/27.1/Emacs.app/Contents/MacOS/Emacs
  Reason: image not found
[1]    10452 abort      emacs
To check the linkage, I did the following:
$ brew linkage --test emacs-plus
Broken dependencies:
  /usr/local/opt/imagemagick/lib/libMagickCore-7.Q16HDRI.8.dylib (imagemagick)
  /usr/local/opt/imagemagick/lib/libMagickWand-7.Q16HDRI.8.dylib (imagemagick)
## Output of `brew config`
$ brew config
HOMEBREW_VERSION: 2.7.7-138-g04dab84
ORIGIN: https://github.com/Homebrew/brew
HEAD: 04dab8428b4db1bb94bc1284cbaf77322fef9334
Last commit: 56 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 6bc0da1160532a5b75beb28ee6c2398abfd820b8
Core tap last commit: 39 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: emacsclient
HOMEBREW_MAKE_JOBS: 24
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: 24-core 64-bit ivybridge
Clang: 12.0 build 1200
Git: 2.30.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 1.8.0_112
macOS: 10.15.7-x86_64
CLT: 12.3.0.0.1.1607026830
Xcode: 12.3
XQuartz: 2.7.11 => /opt/X11
## Output of `brew doctor`
$ brew doctor
Your system is ready to brew.
install error

Most helpful comment

Nice. Brew team released new version of imagemagick, which doesn't force rebuilding of dependant formulas, meaning they will break at 'runtime' thanks to dynamic linking. It's not the first time, definitely not the last time. Let me just rebuild the bottle.

P. S. I am sorry to hear things like 'I spent a while fighting with this last night'. 馃樋

All 10 comments

I spent a while fighting with this last night. I don't really know much about the issue, but I was able to manually fix it by doing the following:

cd /usr/local/opt/imagemagick/lib
ln -s "libMagickCore-7.Q16HDRI.9.dylib" "libMagickCore-7.Q16HDRI.8.dylib"
ln -s "libMagickWand-7.Q16HDRI.9.dylib" "libMagickWand-7.Q16HDRI.8.dylib"

brew reinstall --build-from-source emacs-plus@27 is a local workaround. I think a better solution is to provide a new bottle which does not have the linkage issue.

brew reinstall --build-from-source emacs-plus@27 is a local workaround. I think a better solution is to provide a new bottle which does not have the linkage issue.

That actually didn't seem to work for me when I was trying to solve the issue yesterday.

Nice. Brew team released new version of imagemagick, which doesn't force rebuilding of dependant formulas, meaning they will break at 'runtime' thanks to dynamic linking. It's not the first time, definitely not the last time. Let me just rebuild the bottle.

P. S. I am sorry to hear things like 'I spent a while fighting with this last night'. 馃樋

Okey, could not produce the bottle.

位 brew bottle emacs-plus@27
==> Determining d12frosted/emacs-plus/emacs-plus@27 bottle rebuild...
==> Bottling [email protected]_sur.bottle.3.tar.gz...
==> Detecting if [email protected]_sur.bottle.3.tar.gz is relocatable...
Error: Bottle contains non-relocatable reference to /usr/local/Homebrew!

Not sure what exactly causing this error, unfortunatelly don't have much time to dig into it. So I am going to disable bottle, so at least the bleeding stops. Will dig into bottling issue later.

See 8190095

FYI, I'm not sure if this is related but brew audit --strict --online emacs-plus@27 returns the following diagnostics (I do not include the style warnings here):

d12frosted/emacs-plus/emacs-plus@27:
  * Emacs Lisp files were linked directly to "/usr/local/share/emacs/site-lisp".
    This may cause conflicts with other packages.
    They should instead be installed into:
      /usr/local/opt/emacs-plus@27/share/emacs/site-lisp/emacs-plus@27
    The offending files are:
      /usr/local/opt/emacs-plus@27/share/emacs/site-lisp/subdirs.el
  * Files were found with references to the Homebrew shims directory.
    The offending files are:
      libexec/emacs/27.1/x86_64-apple-darwin19.6.0/emacs.pdmp
      Emacs.app/Contents/MacOS/Emacs.pdmp
Error: 2 problems in 1 formula detected

Thanks @soonho-tri . I think I addressed the warning about site-lisp somewhere, but now I can't remember where exactly. The second looks like the culprit here. Seems like something related to portable dumper. Will investigate.

EDIT: Now I remember where I addressed the first warning - in my attempts to automate bottle building.

fyi Happens for emacs 28 as well. @lucassz hack worked, thanks.

Since it's old and we already recovered from that change, closing the issue. But leaving it as pinned for future visibility.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathanj picture jonathanj  路  3Comments

paulhenrich picture paulhenrich  路  8Comments

oguzserbetci picture oguzserbetci  路  4Comments

d12frosted picture d12frosted  路  8Comments

frankjonen picture frankjonen  路  3Comments