Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not open library 'vips.42' #371

Open
guschiavon opened this issue Sep 25, 2023 · 7 comments
Open

Could not open library 'vips.42' #371

guschiavon opened this issue Sep 25, 2023 · 7 comments

Comments

@guschiavon
Copy link

Everything was running smoothly until... I ran into this error when running the brew upgrade vips command:

bundle exec jekyll s -l
bundler: failed to load command: jekyll (/Users/gschiavon/.gem/ruby/2.7.3/bin/jekyll)
/Users/gschiavon/.gem/ruby/2.7.3/gems/ffi-1.16.1/lib/ffi/dynamic_library.rb:65:in `load_library': Could not open library 'vips.42': dlopen(vips.42, 0x0005): tried: 'vips.42' (no such file), '/System/Volumes/Preboot/Cryptexes/OSvips.42' (no such file), '/usr/lib/vips.42' (no such file, not in dyld cache), 'vips.42' (no such file), '/usr/local/lib/vips.42' (no such file), '/usr/lib/vips.42' (no such file, not in dyld cache). (LoadError)
Could not open library 'libvips.42.dylib': dlopen(libvips.42.dylib, 0x0005): Library not loaded: /opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib
  Referenced from: <555C8E69-E957-3A35-BB01-AF28A62E44B4> /opt/homebrew/Cellar/libmatio/1.5.23/lib/libmatio.11.dylib
  Reason: tried: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file, not in dyld cache).
Could not open library '/usr/local/lib/libvips.42.dylib': dlopen(/usr/local/lib/libvips.42.dylib, 0x0005): Library not loaded: /opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib
  Referenced from: <555C8E69-E957-3A35-BB01-AF28A62E44B4> /opt/homebrew/Cellar/libmatio/1.5.23/lib/libmatio.11.dylib
  Reason: tried: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file, not in dyld cache).
Could not open library '/opt/homebrew/lib/libvips.42.dylib': dlopen(/opt/homebrew/lib/libvips.42.dylib, 0x0005): Library not loaded: /opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib
  Referenced from: <555C8E69-E957-3A35-BB01-AF28A62E44B4> /opt/homebrew/Cellar/libmatio/1.5.23/lib/libmatio.11.dylib
  Reason: tried: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file, not in dyld cache).
Searched in <system library path>, /usr/lib, /usr/local/lib, /opt/local/lib, /opt/homebrew/lib
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/ffi-1.16.1/lib/ffi/library.rb:95:in `block in ffi_lib'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/ffi-1.16.1/lib/ffi/library.rb:94:in `map'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/ffi-1.16.1/lib/ffi/library.rb:94:in `ffi_lib'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/ruby-vips-2.0.17/lib/vips.rb:528:in `<module:Vips>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/ruby-vips-2.0.17/lib/vips.rb:525:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/ruby-vips-2.0.17/lib/ruby-vips.rb:1:in `require'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/ruby-vips-2.0.17/lib/ruby-vips.rb:1:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll_picture_tag-2.0.4/lib/jekyll_picture_tag/images/generated_image.rb:1:in `require'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll_picture_tag-2.0.4/lib/jekyll_picture_tag/images/generated_image.rb:1:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll_picture_tag-2.0.4/lib/jekyll_picture_tag/images.rb:2:in `require_relative'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll_picture_tag-2.0.4/lib/jekyll_picture_tag/images.rb:2:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll_picture_tag-2.0.4/lib/jekyll_picture_tag.rb:5:in `require_relative'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll_picture_tag-2.0.4/lib/jekyll_picture_tag.rb:5:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/runtime.rb:60:in `require'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/runtime.rb:55:in `each'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/runtime.rb:55:in `block in require'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/runtime.rb:44:in `each'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/runtime.rb:44:in `require'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler.rb:176:in `require'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll-4.3.2/lib/jekyll/plugin_manager.rb:53:in `require_from_bundler'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/jekyll-4.3.2/exe/jekyll:11:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/bin/jekyll:25:in `load'
        from /Users/gschiavon/.gem/ruby/2.7.3/bin/jekyll:25:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/cli/exec.rb:58:in `load'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/cli/exec.rb:23:in `run'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/cli.rb:484:in `exec'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/cli.rb:31:in `dispatch'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/cli.rb:25:in `start'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/exe/bundle:48:in `block in <top (required)>'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
        from /Users/gschiavon/.gem/ruby/2.7.3/gems/bundler-2.3.6/exe/bundle:36:in `<top (required)>'
        from /Users/gschiavon/.gem/ruby/3.0.0/bin/bundle:23:in `load'
        from /Users/gschiavon/.gem/ruby/3.0.0/bin/bundle:23:in `<main>'

From what I understand there is a misconfigured path to the library vips.42 but upon checking the folder, it indeed doesn't exist.

Which VIPS

/opt/homebrew/bin/vips

Ruby -v

ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]

System

MacBookPro M1
OSX Ventura 13.4

I can provide more config info as required. 🙏 someone can help!

@jcupitt
Copy link
Member

jcupitt commented Sep 25, 2023

I'll have a go on my mac mini tomorrow.

@jcupitt
Copy link
Member

jcupitt commented Sep 26, 2023

Hi again, I tried here and it all seems to work for me.

Looking at your log, I think you have several rubys installed and they are all mixed up:

$ bundle exec jekyll s -l
bundler: failed to load command: jekyll (/Users/gschiavon/.gem/ruby/2.7.3/bin/jekyll)
/Users/gschiavon/.gem/ruby/2.7.3/gems/ffi-1.16.1/lib/ffi/dynamic_library.rb:65:in ...

I don't know what 2.7.3 is doing here. macOS ships with 2.6.10, so maybe this is a very old homebrew version? Homebrew is currently on 3.2.2. You say you're trying to use ruby 3.0.2, but that's another version again.

I'd pick a ruby and make sure you have the matching version of gem. Check your environment variables, and especially check PATH. Wipe your .gem directory and reinstall everything. Check gem show ruby-vips and make sure it looks sensible.

I see:

john@cheese ~ $ which irb
/opt/homebrew/Cellar/ruby/3.2.2_1/bin/irb
john@cheese ~ $ which ruby
/opt/homebrew/Cellar/ruby/3.2.2_1/bin/ruby
john@cheese ~ $ which gem
/opt/homebrew/Cellar/ruby/3.2.2_1/bin/gem
john@cheese ~ $ ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
john@cheese ~ $ gem info ruby-vips

*** LOCAL GEMS ***

ruby-vips (2.1.4)
    Author: John Cupitt
    Homepage: http://github.com/libvips/ruby-vips
    License: MIT
    Installed at: /opt/homebrew/lib/ruby/gems/3.2.0

    A fast image processing library with low memory needs
john@cheese ~ $ which vips
/opt/homebrew/bin/vips
john@cheese ~ $ vips --version
vips-8.14.5
john@cheese ~ $ irb
irb(main):001:0> require "vips"
=> true
irb(main):002:0> 

@guschiavon
Copy link
Author

guschiavon commented Sep 26, 2023 via email

@jcupitt
Copy link
Member

jcupitt commented Sep 26, 2023

Hi Gus, sure, looks reasonable.

@villu164
Copy link

I also ran into this issue yesterday (likely because homebrew updated bunch of stuff)
Anyway, the

vips --version

which blew up for me

vips --version      
dyld[5853]: Library not loaded: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib'
  Referenced from: '/opt/homebrew/Cellar/libmatio/1.5.23/lib/libmatio.11.dylib'
  Reason: tried: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file)
[1]    5853 abort      vips --version

was very helpful, because I was able to take the ruby out of the issue chain

I removed hdf5

brew uninstall hdf5   
Error: Refusing to uninstall /opt/homebrew/Cellar/hdf5/1.14.2
because it is required by libmatio and vips, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies hdf5

which at forst refused, but

brew uninstall libmatio vips
Uninstalling /opt/homebrew/Cellar/libmatio/1.5.23... (38 files, 974.2KB)
Uninstalling /opt/homebrew/Cellar/vips/8.14.5... (84 files, 5.7MB)

brew uninstall hdf5         
Uninstalling /opt/homebrew/Cellar/hdf5/1.14.2... (285 files, 21MB)

brew install vips  
...

was almost there, but complained some errors

vips --version

(process:6825): VIPS-WARNING **: 22:55:08.731: unable to load "/opt/homebrew/Cellar/vips/8.14.5/lib/vips-modules-8.14/vips-openslide.so" -- dlopen(/opt/homebrew/Cellar/vips/8.14.5/lib/vips-modules-8.14/vips-openslide.so, 0x0009): Library not loaded: '/opt/homebrew/opt/libtiff/lib/libtiff.5.dylib'
  Referenced from: '/opt/homebrew/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib'
  Reason: tried: '/opt/homebrew/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file), '/opt/homebrew/Cellar/libtiff/4.6.0/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file)
vips-8.14.5

making some other guesses

brew install openslide

and got rid of the error

vips --version        

vips-8.14.5

So likely some dependency chain issue from homebrew 🤷

@imtrent
Copy link

imtrent commented Oct 3, 2023

I also ran into this issue yesterday (likely because homebrew updated bunch of stuff) Anyway, the

vips --version

which blew up for me

vips --version      
dyld[5853]: Library not loaded: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib'
  Referenced from: '/opt/homebrew/Cellar/libmatio/1.5.23/lib/libmatio.11.dylib'
  Reason: tried: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file), '/opt/homebrew/Cellar/hdf5/1.14.2/lib/libhdf5.200.dylib' (no such file), '/usr/local/lib/libhdf5.200.dylib' (no such file), '/usr/lib/libhdf5.200.dylib' (no such file)
[1]    5853 abort      vips --version

was very helpful, because I was able to take the ruby out of the issue chain

I removed hdf5

brew uninstall hdf5   
Error: Refusing to uninstall /opt/homebrew/Cellar/hdf5/1.14.2
because it is required by libmatio and vips, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies hdf5

which at forst refused, but

brew uninstall libmatio vips
Uninstalling /opt/homebrew/Cellar/libmatio/1.5.23... (38 files, 974.2KB)
Uninstalling /opt/homebrew/Cellar/vips/8.14.5... (84 files, 5.7MB)

brew uninstall hdf5         
Uninstalling /opt/homebrew/Cellar/hdf5/1.14.2... (285 files, 21MB)

brew install vips  
...

was almost there, but complained some errors

vips --version

(process:6825): VIPS-WARNING **: 22:55:08.731: unable to load "/opt/homebrew/Cellar/vips/8.14.5/lib/vips-modules-8.14/vips-openslide.so" -- dlopen(/opt/homebrew/Cellar/vips/8.14.5/lib/vips-modules-8.14/vips-openslide.so, 0x0009): Library not loaded: '/opt/homebrew/opt/libtiff/lib/libtiff.5.dylib'
  Referenced from: '/opt/homebrew/Cellar/openslide/3.4.1_7/lib/libopenslide.0.dylib'
  Reason: tried: '/opt/homebrew/opt/libtiff/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file), '/opt/homebrew/Cellar/libtiff/4.6.0/lib/libtiff.5.dylib' (no such file), '/usr/local/lib/libtiff.5.dylib' (no such file), '/usr/lib/libtiff.5.dylib' (no such file)
vips-8.14.5

making some other guesses

brew install openslide

and got rid of the error

vips --version        

vips-8.14.5

So likely some dependency chain issue from homebrew 🤷

So glad I came across this. Thanks for sharing how you fixed it! Worked for me as well

@solidiquis
Copy link

@villu164's is the correct solution imo, but if for whatever reason you can't update vips' dependencies for whatever reason, you can also just create a soft link whose name is the version of hdf5 this gem is expecting. Example, if your error says this:

 Referenced from: <555C8E69-E957-3A35-BB01-AF28A62E44B4> /opt/homebrew/Cellar/libmatio/1.5.23/lib/libmatio.11.dylib
  Reason: tried: '/opt/homebrew/opt/hdf5/lib/libhdf5.200.dylib' (no such file),

and lets say in your /opt/homebrew/opt/hdf5/lib/ directory you have libhdf5.310.dylib, then all you'll need to do is:

ln -s libhdf5.310.dylib libhdf5.200.dylib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants