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
Little help? Could not open library 'glib-2.0.0': dlopen(glib-2.0.0, 5): image not found. #284
Comments
Hi @bdhartz, It used to "just work", but I've not tried ruby-vips on macos for a while, perhaps things have changed. I'll have a go later today. |
Thanks John, I look forward to hearing back! Let me know if you'd like to hop on a call or if I can provide any further info. |
Oh, an M1 mac, I just noticed. I think brew is still a bit wobbly on the M1, you might need to wait a few months more before it'll work smoothly. On this old imac I see:
|
I have the same problem, with an M1 as well. Let me know if you find a solution. Thank you |
Sorry, I don't know what's wrong with your system. I did the most basic install and it all worked. Are you maybe attempting to use the Apple ruby? It blocks third party libraries for security. You must use the homebrew ruby. On my mac (2012 imac), I see this:
So I used
The relevant libraries are in there too.
I can run the vips command-line stuff.
And I can |
I think @jonfer is having an issue on a mac with M1/silicon architecture, similar to me above. I don't believe there was a solution for now. |
Having the same problem using ruby-vips with Jekyll Picture Tag on an M1 Macbook. |
Hi @DotIN13, you need to give a lot more information. What error did you get, how did you install everything, what versions are you running, where is your glib installed, which ruby are you using etc. etc. Could it perhaps be a native vs. x86 problem? For example, if glib has been built for x86 and ruby is native it obviously won't work. |
I think PR ffi/ffi#882 might fix this. As a workaround, you could try to symlink the whole |
ErrorDependency Error: Yikes! It looks like you don't have jekyll_picture_tag or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. If you've run Jekyll with How did I install everything?brew: official install script, arm64 glib, vips: via brew, arm64 ruby: via rbenv, arm64 Ruby Version
glibglib: stable 2.68.0 (bottled)
Core application library for C
https://developer.gnome.org/glib/
/opt/homebrew/Cellar/glib/2.68.0 (442 files, 22.0MB) * vips infovips: stable 8.10.6 (bottled)
Image processing library
https://github.com/libvips/libvips
/opt/homebrew/Cellar/vips/8.10.6 (167 files, 14.2MB) * So I guess it's all native but something just went wrong. |
After symlinking with the following command, it worked like butter, thanks a lot.
|
Ah thanks for that Kleis, I hadn't realized homebrew had moved the lib area. Related: https://github.com/ioquatix/ffi-module A more modern interface to ruby-ffi which has much better library searching. It might be useful to experiment with something similar. |
@DotIN13 @kleisauke Yes, this works. M1 strikes again! |
@rdetert @DotIN13 @kleisauke - thanks for your work on this! For whatever reason, I don't have a /opt/local directory, so |
@bdhartz You could try creating |
This was close for me, but I had to do |
I followed the instructions to create a symlink and I got the following error on my m1 machine.
I also get the same error if I used the ffi with ffi/ffi#882 fix implemented. Is anyone else getting that? |
@mmhan I might be wrong but try adding "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" to your .bashrc or .zshrc |
@greycampbell - Yep, it worked! Thanks! |
I ran into this as well. Also on M1. Had to modify the symlimk comments from above because I couldn't directly link the entire directory. What I used:
|
I managed to solve it like this:
Then I removed all installed gems:
Then I installed the bundle
Then I installed all the gems again:
|
might fix it. v1.15.0 doesn't look in |
I did all the fixes but had no luck. Fixed using the command brew install vips Maybe this could help1 |
@Adverbly's solution worked perfectly for me. I didn't quite understand what was going on, so I looked around a bit and learned:
file /opt/homebrew/lib/libglib-2.0.0.dylib
# /opt/homebrew/lib/libglib-2.0.0.dylib: Mach-O 64-bit dynamically linked shared library arm64 super handy!
Hope it's useful. |
I just had this issue on a new M2 mac and solved it by removing the old x86 homebrew:
|
There has been an ongoing discussion in multiple PRs about how to fix the Homebrew path issue. One notable PR that was merged, offering a more general solution, can be found at ffi/ffi#968 While the fix has been merged, there hasn't been a new release yet. To address the gem 'ffi', git: 'https://github.com/ffi/ffi.git', branch: 'master' If you prefer a more stable commit instead of the latest master, you can specify that. With this solution, there's no need to create symlinks between the arm64 and the Rosetta 2 (x86_64) versions of Homebrew. |
This has completely thrown my system configuration and now I'm not able to locally run any project that leverages the vips library... |
It appears that the Ruby-FFI gem has recently released |
In my case, I'm using Mac OS 14.0 with M2, what I did is just to:
|
Still having the issue with ffi 1.16.3 and Ventura 13.5 on an M1 Macbook Air |
Hi @thomasbromehead, It was working fine on my M2 mac mini last time I tested it, I'll try again to verify some time this weekend. I would doublecheck that you are using homebrew ruby and that you have no old x86 homebrew binaries on your system, in case you've not done that. |
I tried just now on my M2 mac mini, and it all worked. Here's what I did:
Here's my
I also ran
To verify it worked, I tried:
I have the various glib libraries in
|
It worked for me. |
DetailsMy Homebrew packages have been installed to # glib is installed but missing dylibs:
$ brew info glib
==> glib: stable 2.80.0 (bottled)
Core application library for C
https://developer.gnome.org/glib/
/opt/homebrew/Cellar/glib/2.80.0_2 (524 files, 36MB)
Poured from bottle using the formulae.brew.sh API on 2024-03-31 at 19:30:11
...
$ ls /opt/homebrew/lib/libgob*
ls: /opt/homebrew/lib/libgob*: No such file or directory
# Reinstalled and now dylibs are found:
$ brew reinstall glib
$ ls /opt/homebrew/lib/libgob*
/opt/homebrew/lib/libgobject-2.0.0.dylib /opt/homebrew/lib/libgobject-2.0.dylib
/opt/homebrew/lib/libgobject-2.0.a
# Now vips loads without errors again:
$ ruby -e 'require "vips"' (While I still have a few things installed with a separate |
worked for me. I'm using rails 7.1.3 on mac M1 chip. |
Hi team (John? Anyone?) Hoping for some help. I've spent hours on github/stackoverflow trying to triage this issue. Admittedly, I'm new to ruby and very new to getting development environments set up. I am on an M1 mac.
My VIPs-related unit tests fail with the following error:
LoadError: Could not open library 'glib-2.0.0': dlopen(glib-2.0.0, 5): image not found.
Could not open library 'libglib-2.0.0.dylib': dlopen(libglib-2.0.0.dylib, 5): image not found
Would really appreciate any help here. Also would be happy to jump on a zoom call and report findings back here!
Notes from my investigation/previous issues:
(1) #130 - libglib-2.0.dylib is on my system, in a few different places actually. Is the code looking for it somewhere else?
$ locate libglib-2.0.dylib
/opt/homebrew/Cellar/glib/2.66.7/lib/libglib-2.0.dylib
/opt/homebrew/lib/libglib-2.0.dylib
/usr/local/lib/libglib-2.0.dylib
/usr/local/libglib-2.0.dylib
I see the suggestion that I should check:
you have glib and libvips in /usr/local/lib - should they really be here if I'm primarily using brew, which puts things elsewhere? I've tried copying a bunch of files into /usr/local/lib, but I'm not sure exactly which files should be here for l
you can run command-line vips stuff correctly - irb > require 'vips' fails with the error mentioned above.
your gem and Ruby know about /usr/local - how can I check this?
(2) vips --version output:
vips-8.10.5-Fri Dec 18 10:14:09 UTC 2020
(3) I saw some other suggestions (I can't find them now) to modify lib/ffi/library.rb to use a direct path. However,
LIBC = '/usr/lib/libc.dylib' #original value
#LIBC = '/System/DriverKit/usr/lib/system/libsystem_c.dylib' - tried this, didn't work
#LIBC = '/opt/homebrew/Cellar/tcl-tk/8.6.11_1/lib/tcllibc/macosx-arm-clang/tcllibc.dylib' - tried this, didn't work
Interestingly, the output of $ locate libc.dylib is below.
/opt/homebrew/Cellar/tcl-tk/8.6.11_1/lib/tcllibc/macosx-arm-clang/tcllibc.dylib
Looking for any guidance or suggestions. Thank you so much! Apologies if this is posted incorrectly, happy to remove it elsewhere. Thank you!
The text was updated successfully, but these errors were encountered: