views:

467

answers:

1

I have two XCode projects: a framework and a client application. My application depends on my framework and everything works fine with that — the framework is being recompiled everytime the app is, the projects build paths are set correctly, it's completely okay.

Now the framework started using 3rd party dylib file, and it's linked against the dylib. I've even added a build phase to copy that library into the framework's resources dir.

When i'm trying to run the application, everything compiles correctly, then i get this:

dyld: Library not loaded: /usr/local/lib/libplplot.9.dylib Referenced from: /Users/railsmaniac/Projects/Study/Calculus of >approximations/Builds/Debug/XNMaths.framework/Versions/A/XNMaths Reason: image not found

How can i fix it? Adding the library into client application's resources doesn't fix the problem. I can just place the library into the required location, but i prefer to keep it IN the framework. Is it possible?

+1  A: 

It looks like your application is expecting the library to be found at a specific path on the system. If you are on OS 10.5+ you can use the new @rpath functionality to allow your application to link dynamically to your library.

See this post for further details. It also shows the "old" way of doing this.

jkp
Thank you for the answer. I am a bit new to dynamic linking etc, since i'm a web developer natively :) But i clearly understand the concept. One question now: is it the application project issue, or the frameworks? I'd like to fix this once in the framweork for all apps using it. Is that possible?
Nat
It should be possible yes. I haven't done it in a long while (haven't developed native OS X frameworks for a few years now) so I can't give you many more pointers other than to play around with whats in that article (it will work, I did it years ago). Oh and accept if you're happy with the pointers ;)
jkp
I've posted an update of my situation. Yep, you answer was helpful, thanks again.
Nat