Dyld:库未加载
我正在尝试将库 libssh2.1.dylib 链接到我的 iPhone Xcode 项目,但当我尝试链接它时出现此错误。如果我不将其添加为框架,则会出现“符号未找到”错误。现在 /Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib 不是该文件的正确路径。我从互联网上下载了该库,它是作者计算机的路径。我的文件位于完全不同的地方。如何更改路径参考?这是我得到的错误:
dyld: Library not loaded: /Users/Matt/Documents/Development/iPhoneApps/PortScanner/lib/libssh2.1.dylib
Referenced from: /var/mobile/Applications/5353E047-05FE-42E4-8F32-617E8D02A11D/Port Scanner.app/Port Scanner
Reason: image not found
I am trying to link the library libssh2.1.dylib to my iPhone Xcode project but I get this error when I try to link it. If I don't add this as a framework I get Symbols not found error. Now /Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib is not the correct pathway to that file. I downloaded the library off the internet and its the pathway of the Author's computer. I have the file located in a totally different place. How do I change the pathway reference? Heres the error I get:
dyld: Library not loaded: /Users/Matt/Documents/Development/iPhoneApps/PortScanner/lib/libssh2.1.dylib
Referenced from: /var/mobile/Applications/5353E047-05FE-42E4-8F32-617E8D02A11D/Port Scanner.app/Port Scanner
Reason: image not found
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 install_name_tool 更改 .dylib 文件上的安装路径名:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/install_name_tool.1.html
更改安装名称的示例:
此外,您可能还需要更改依赖项名称,您可以使用相同的工具来执行此操作:
您可以检查什么当前名称正在使用 otool。因此,您可以使用 otool 验证更改,如下所示:
otool -D libssh2.1.dylib
和otool -L libssh2.1.dylib
的依赖项或者您可以获取源代码并使用其中的当前路径自行重建它。
如果您需要相对路径,您应该考虑将安装名称更改为 @rpath/libssh2.1.dylib 并将路径添加到项目设置中。
You can use the install_name_tool to change the installed path name on a .dylib file:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/install_name_tool.1.html
Example of changing an install name:
Also you may need to change dependency names too, and you can use the same tool to do that:
You can check what the current names are using the otool. So you can verify the change with the otool like this:
otool -D libssh2.1.dylib
and dependencies withotool -L libssh2.1.dylib
Or you can get the source code and rebuild it yourself with the current path in it.
If you need a relative path you should look into changing your install name to @rpath/libssh2.1.dylib and add the path to your project settings.