Copying dynamic library (.dylib) into a framework (.framework)

☆樱花仙子☆ 提交于 2019-12-06 05:29:48

问题


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:


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.



来源:https://stackoverflow.com/questions/1777641/copying-dynamic-library-dylib-into-a-framework-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!