将动态库 (.dylib) 复制到框架 (.framework)
我有两个 XCode 项目:一个框架和一个客户端应用程序。 我的应用程序取决于我的框架,一切都运行良好 - 每次应用程序都会重新编译框架,项目构建路径设置正确,完全没问题。
现在框架开始使用第 3 方 dylib 文件,并且它与 dylib 链接。 我什至添加了一个构建阶段来将该库复制到框架的资源目录中。
当我尝试运行该应用程序时,一切都正确编译,然后我得到:
dyld:未加载库:/usr/local/lib/libplplot.9.dylib 引用自:/Users/railsmaniac/Projects/Study/Calculus of >approximations/Builds/Debug/XNMaths.framework/Versions/A/XNMaths 原因:找不到图片
我该如何修复? 将库添加到客户端应用程序的资源中并不能解决问题。 我可以将库放置到所需的位置,但我更喜欢将其保留在框架中。 是否可以?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您的应用程序期望在系统上的特定路径中找到该库。如果您使用的是操作系统 10.5+,您可以使用新的 @rpath 功能来允许您的应用程序动态链接到您的库。
有关更多详细信息,请参阅这篇文章 。它还显示了执行此操作的“旧”方法。
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.