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

OSX: Library load failed: libatk-1.0.dylib #32

Closed
timotheecour opened this issue Nov 27, 2016 · 14 comments
Closed

OSX: Library load failed: libatk-1.0.dylib #32

timotheecour opened this issue Nov 27, 2016 · 14 comments

Comments

@timotheecour
Copy link
Contributor

timotheecour commented Nov 27, 2016

object.Exception@../../../../.dub/packages/gtk-d-3.3.1/gtk-d/src/gtkc/Loader.d(123): Library load failed: libatk-1.0.dylib

README.md only shows sudo apt-get install libcairo2-dev as a dependency; what about osx? i did do brew install cairo FWIW but should i also have brew install atk ?

EDIT: after that i still get:

$binary
object.Exception@../../../../.dub/packages/gtk-d-3.3.1/gtk-d/src/gtkc/Loader.d(123): Library load failed: libatk-1.0.dylib

Also tried:

DYLD_LIBRARY_PATH=$HOME/homebrew/lib $binary

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /Users/timothee/homebrew//lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO

@timotheecour timotheecour changed the title Library load failed: libatk-1.0.dylib OSX: Library load failed: libatk-1.0.dylib Nov 27, 2016
@BlackEdder
Copy link
Owner

Are you trying to install it with gtk support?

On travis it needs the following libraries to build/install:

brew install libjpeg cairo gtk+3

@timotheecour
Copy link
Contributor Author

will try your suggestion.

Regardless, see also relevant discussion in http://forum.dlang.org/thread/mailman.519.1480285208.9448.digitalmars-d-learn@puremagic.com
how to debug exceptions/asserts thrown in module constructors?

@timotheecour
Copy link
Contributor Author

timotheecour commented Nov 27, 2016

On travis it needs the following libraries to build/install:

This didn't help:
still getting object.Exception@../../../../../../.dub/packages/gtk-d-3.3.1/gtk-d/src/gtkc/Loader.d(123): Library load failed: libatk-1.0.dylib

to reproduce: (pasting from a part of http://forum.dlang.org/thread/mailman.519.1480285208.9448.digitalmars-d-learn@puremagic.com)

main.d:
import ggplotd.gtk;
void main(){
}

dub.json:
{
"targetType": "executable",
"sourcePaths":["."],

"dependencies": {
"ggplotd": ">=1.1.0",
},

"subConfigurations": {
"ggplotd": "ggplotd-gtk",
},
"buildRequirements": ["allowWarnings"],
}

@timotheecour
Copy link
Contributor Author

NOTE: i do have /Users/timothee/homebrew//lib/libatk-1.0.dylib but dlopen isn't able to find it based on just libatk-1.0.dylib alone and, as explained above, setting DYLD_LIBRARY_PATH causes other issues.

The following worked in my case:
edit /Users/timothee/.dub/packages//gtk-d-3.3.1/gtk-d/src/gtkc/Loader.d :
edit
private void* pLoadLibrary(string libraryName, RTLD flag = RTLD.NOW):

auto libraryName2=`/Users/timothee/homebrew/lib/`~libraryName;
void* handle = dlopen(cast(char*)toStringz(libraryName2), flag);
if(!handle){
  import std.string;
  string temp=dlerror().fromStringz.idup;
  assert(0, temp);
}

the code should be improved to autodetect the path to that library, or at least provide an environment variable for that (but not DYLD_LIBRARY_PATH)

@timotheecour
Copy link
Contributor Author

Also note: if brew install libjpeg cairo gtk+3 is required on OSX it should be clear in README.md

@BlackEdder
Copy link
Owner

Also note: if brew install libjpeg cairo gtk+3 is required on OSX it should be clear in README.md

I don't have a mac so not really sure if it is required. That's just how I got it to work. I hesitate to add things to the readme that I can't fully test myself. If you can confirm that all three are needed for the gtk build then I can add a section (PR is always welcome as well :) )

@BlackEdder
Copy link
Owner

By the way if you don't need gtk support it will work fine without it.

@MikeWey
Copy link
Contributor

MikeWey commented Nov 29, 2016

As for GtkD would there be anyway to detect the homebrew path?

  • Does homebrew provide environment variables?
  • Is the library path always in the same place relative to the brew exactable?
  • Are there a few default install paths to check? (~/homebrew, /usr/local, /opt)

I don't have any experience with OSX and homebrew, but it would be great to get this working.

@BlackEdder
Copy link
Owner

Does homebrew provide environment variables?

There seems to be a $HOMEBREW_ROOT variable.

@timotheecour
Copy link
Contributor Author

timotheecour commented Nov 30, 2016 via email

@timotheecour
Copy link
Contributor Author

also, brew --prefix is simpler than brew config|grep HOMEBREW_PREFIX

@BlackEdder
Copy link
Owner

@MikeWey would you be ok with calling brew --prefix for gtkd? Or maybe accept a custom environmental variable and update the gtkd readme?

@MikeWey
Copy link
Contributor

MikeWey commented Dec 3, 2016

We could do both brew --prefix and the environment variable. Although i'm not that keen on calling an other executable on startup.

For the environment variable, we could use the GTK_BASEPATH that we used to use on windows, or HOMEBREW_ROOT.

@timotheecour
Copy link
Contributor Author

closed since gtkd-developers/GtkD#164 is closed now

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

3 participants