将动态库(.dylib)复制到框架(.framework) [英] Copying dynamic library (.dylib) into a framework (.framework)

查看:396
本文介绍了将动态库(.dylib)复制到框架(.framework)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个XCode项目:一个框架和一个客户端应用程序. 我的应用程序取决于我的框架,并且一切都可以正常工作-每次应用程序都在重新编译框架时,项目构建路径设置正确,完全可以.

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.

现在,该框架开始使用第3方dylib文件,并且已与dylib链接. 我什至还添加了一个构建阶段,以将该库复制到框架的资源目录中.

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:库未加载:/usr/local/lib/libplplot.9.dylib 引用自:/Users/railsmaniac/Projects/Study/Calculus of> approximations/Builds/Debug/XNMaths.framework/Versions/A/XNMaths 原因:找不到图片

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?

推荐答案

您的应用程序似乎期望在系统的特定路径上找到该库.如果您使用的是OS 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.

这篇关于将动态库(.dylib)复制到框架(.framework)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆