gtkd-developers / GtkD

GtkD is a D binding and OO wrapper of GTK+ originally created by Antonio Monteiro
http://gtkd.org
Other
322 stars 71 forks source link

Library load failed: libgdk-3.0.dylib #162

Closed BlackEdder closed 8 years ago

BlackEdder commented 8 years ago

I use gtk-d 3.3.1 in my ggplotd library and test OSX support through travis. This used to work, but lately I get the following error when running the test suite:

ggplotd 1.0.0+commit.3.g000325d: building configuration "__test__ggplotd-gtk__"...
Linking...
Running ./__test__ggplotd-gtk__ 
object.Exception@../../../.dub/packages/gtk-d-3.3.1/gtk-d/src/gtkc/Loader.d(123): Library load failed: libgdk-3.0.dylib
Program exited with code 1

gtk is installed using brew and does not throw any errors:

==> Installing gtk+3 dependency: gobject-introspection
==> Downloading https://homebrew.bintray.com/bottles/gobject-introspection-1.48.
==> Pouring gobject-introspection-1.48.0.mavericks.bottle.tar.gz
  /usr/local/Cellar/gobject-introspection/1.48.0: 170 files, 9.6M
==> Installing gtk+3 dependency: gdk-pixbuf
==> Downloading https://homebrew.bintray.com/bottles/gdk-pixbuf-2.34.0.mavericks
==> Pouring gdk-pixbuf-2.34.0.mavericks.bottle.tar.gz
==> /usr/local/Cellar/gdk-pixbuf/2.34.0/bin/gdk-pixbuf-query-loaders --update-ca
  /usr/local/Cellar/gdk-pixbuf/2.34.0: 219 files, 4.3M
==> Installing gtk+3 dependency: atk
==> Downloading https://homebrew.bintray.com/bottles/atk-2.20.0.mavericks.bottle
==> Pouring atk-2.20.0.mavericks.bottle.tar.gz
  /usr/local/Cellar/atk/2.20.0: 205 files, 3.1M
==> Installing gtk+3 dependency: libepoxy
==> Downloading https://homebrew.bintray.com/bottles/libepoxy-1.3.1.mavericks.bo
==> Pouring libepoxy-1.3.1.mavericks.bottle.tar.gz
  /usr/local/Cellar/libepoxy/1.3.1: 8 files, 2.2M
==> Installing gtk+3 dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-57.1.mavericks.bottle
==> Pouring icu4c-57.1.mavericks.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides libicucore.dylib (but nothing else).
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
    LDFLAGS:  -L/usr/local/opt/icu4c/lib
    CPPFLAGS: -I/usr/local/opt/icu4c/include
==> Summary
  /usr/local/Cellar/icu4c/57.1: 265 files, 65.9M
==> Installing gtk+3 dependency: harfbuzz
==> Downloading https://homebrew.bintray.com/bottles/harfbuzz-1.3.0.mavericks.bo
==> Pouring harfbuzz-1.3.0.mavericks.bottle.tar.gz
  /usr/local/Cellar/harfbuzz/1.3.0: 123 files, 4.7M
==> Installing gtk+3 dependency: pango
==> Downloading https://homebrew.bintray.com/bottles/pango-1.40.1.mavericks.bott
==> Pouring pango-1.40.1.mavericks.bottle.tar.gz
  /usr/local/Cellar/pango/1.40.1: 124 files, 5.1M
==> Installing gtk+3 dependency: hicolor-icon-theme
==> Downloading https://homebrew.bintray.com/bottles/hicolor-icon-theme-0.15.mav
==> Pouring hicolor-icon-theme-0.15.mavericks.bottle.tar.gz
  /usr/local/Cellar/hicolor-icon-theme/0.15: 6 files, 48.3K
==> Installing gtk+3 dependency: gsettings-desktop-schemas
==> Downloading https://homebrew.bintray.com/bottles/gsettings-desktop-schemas-3
==> Pouring gsettings-desktop-schemas-3.20.0.mavericks.bottle.tar.gz
==> /usr/local/opt/glib/bin/glib-compile-schemas /usr/local/share/glib-2.0/schem
  /usr/local/Cellar/gsettings-desktop-schemas/3.20.0: 89 files, 3.5M
==> Installing gtk+3
==> Downloading https://homebrew.bintray.com/bottles/gtk+3-3.20.6.mavericks.bott
==> Pouring gtk+3-3.20.6.mavericks.bottle.tar.gz
==> /usr/local/opt/glib/bin/glib-compile-schemas /usr/local/share/glib-2.0/schem
  /usr/local/Cellar/gtk+3/3.20.6: 1,365 files, 68.3M

Any pointers on what might be the problem?

MikeWey commented 8 years ago

How easy would it be to check if the library is actually there and if the name matches, on travis?

BlackEdder commented 8 years ago

I added to the travis script:

find / -name libgdk-3.0.dylib

and it does seem to be installed

/usr/local/Cellar/gtk+3/3.20.6/lib/libgdk-3.0.dylib
/usr/local/lib/libgdk-3.0.dylib
MikeWey commented 8 years ago

Can you check if 'DYLD_FALLBACK_LIBRARY_PATH' contains "/usr/local/lib" as one of the paths. according to man dyld it should be one of the default paths.

BlackEdder commented 8 years ago

Calling

echo $DYLD_FALLBACK_LIBRARY_PATH

showed that the variable was empty. Next I tried exporting it in .travis.yml

- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/usr/local/lib; fi

but I still got the same error

BlackEdder commented 8 years ago

After specifying DYLD_LIBRARY_PATH I got further, but ended up with the following error:

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Program exited with code -5

This seems related to this: http://stackoverflow.com/questions/17643509/conflict-between-dynamic-linking-priority-in-osx

But I don't understand OSX linking well enough to have found a solution (yet).

BlackEdder commented 8 years ago

Nevermind ignore the previous post, because after solving the libJPEG error I am back at my original problem, i.e. setting DYLD_LIBRARY_PATH to /usr/local/lib only introduced new errors/did not solve the existing error at all.

MikeWey commented 8 years ago

I'm not all that familiar with OSX my self. I'll see if i can find out something more.

BlackEdder commented 8 years ago

Thanks! I am not that familiar with OSX myself. Mostly use travis to create prebuild binaries for releases. I tried quite a lot of variants to travis, but nothing seemed to work. Without access to an OSX machine it will be hard for me to solve :(.

BlackEdder commented 8 years ago

Builds are working again. Not sure if you fixed it, or if it was a problem on travis' end, but happy to close this issue :)

MikeWey commented 8 years ago

I didn't do anything, i am happy that it's working again.