Question

I have an app, call it Animal.app. Inside its Contents/Frameworks folder is a framework, say Mammal.framework. And inside the Versions/A/Frameworks folder of the framework, I have dog.dylib. The install name of dog.dylib is @rpath/dog.dylib. For the "Runpath Search Paths" setting of the framework, I have specified @loader_path/../Frameworks. (My reasoning for that last setting is that the "loader" of the dylib would be the binary of the framework, at the path Mammal.framework/Versions/A/Mammal.)

I get an error message at runtime:

Dyld Error Message:
  Library not loaded: @rpath/dog.dylib
  Referenced from: /Volumes/VOLUME/*/Animal.app/Contents/MacOS/../Frameworks/Mammal.framework/Versions/A/Mammal
  Reason: image not found

I've read Apple's "Run-Path Dependent Libraries" documentation, and Mike Ash's blog post on @rpath, but I still can't see what I'm doing wrong.

Was it helpful?

Solution

It turns out that the right runpath search path is @loader_path/Frameworks. What I was missing is that @loader_path represents, not the full path to the loader, but that path minus its last component. Mike Ash's blog post does say that, but I somehow missed it. Thus, in the case of a framework, @loader_path ends with the A.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top