Skip to content

Commit

Permalink
Fix MacPorts Issue. Could not open library dlopen
Browse files Browse the repository at this point in the history
  • Loading branch information
Mac committed Oct 14, 2017
1 parent d6af765 commit d2eb45d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/vips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class << self

if FFI::Platform.windows?
glib_libname = 'libglib-2.0-0.dll'
elsif FFI::Platform.mac? and FileTest.exists?('/opt/local/lib/libglib-2.0.dylib')
glib_libname = '/opt/local/lib/libglib-2.0.dylib'
else
glib_libname = 'glib-2.0'
end
Expand Down Expand Up @@ -121,6 +123,8 @@ module GObject

if FFI::Platform.windows?
gobject_libname = 'libgobject-2.0-0.dll'
elsif FFI::Platform.mac? and FileTest.exists?('/opt/local/lib/libgobject-2.0.dylib')
gobject_libname = '/opt/local/lib/libgobject-2.0.dylib'
else
gobject_libname = 'gobject-2.0'
end
Expand Down Expand Up @@ -459,6 +463,8 @@ module Vips

if FFI::Platform.windows?
vips_libname = 'libvips-42.dll'
elsif FFI::Platform.mac? and FileTest.exists?('/opt/local/lib/libvips.dylib')
vips_libname = '/opt/local/lib/libvips.dylib'
else
vips_libname = 'vips'
end
Expand Down

3 comments on commit d2eb45d

@comomac
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using RVM (Ruby 2.4.1) on Mac OS X 10.12 Sierra with MacPorts have error as below. This commit fixes load library path by reference directly to MacPort library.

LoadError: Could not open library 'glib-2.0': dlopen(glib-2.0, 5): image not found.
Could not open library 'libglib-2.0.dylib': dlopen(libglib-2.0.dylib, 5): image not found
from /Users/mac/.rvm/gems/ruby-2.4.1/gems/ffi-1.9.18/lib/ffi/library.rb:147:in 'block in ffi_lib'
from /Users/mac/.rvm/gems/ruby-2.4.1/gems/ffi-1.9.18/lib/ffi/library.rb: 100:in 'map'
from /Users/mac/.rvm/gems/ruby-2.4.1/gems/ffi-1.9.18/lib/ffi/library.rb: 100:in 'ffi_lib'
from /Users/mac/.rvm/gems/ruby-2.4.1/gems/ruby-vips-2.0.7/lib/vips.rb:28:in 'module:GLib'
from /Users/mac/.rvm/gems/ruby-2.4.1/gems/ruby-vips-2.0.7/lib/vips.rb:13:in '<top (required)>'
from /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in 'require'
from /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in 'rescue in require'
from /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in 'require'
from (irb):1
from /Users/mac/.rvm/rubies/ruby-2.4.1/bin/irb:11:in '

'

@comomac
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe related to libvips#130 libvips#141

@ioquatix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have this issue too, but it was working before, with the same setup... odd

Please sign in to comment.