Dyld:库未加载

发布于 2024-09-24 14:22:53 字数 508 浏览 0 评论 0原文

我正在尝试将库 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戴着白色围巾的女孩 2024-10-01 14:22:53

您可以使用 install_name_tool 更改 .dylib 文件上的安装路径名:

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/install_name_tool.1.html

更改安装名称的示例:

install_name_tool -id <yourpath>/libssh2.1.dylib /Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib
  • 第一个参数是您想要的路径,
  • 第二个参数是文件的真实路径,因此从 Finder 中拖动文件

此外,您可能还需要更改依赖项名称,您可以使用相同的工具来执行此操作:

install_name_tool -change <old path> <new path> <library name>

您可以检查什么当前名称正在使用 otool。因此,您可以使用 otool 验证更改,如下所示:
otool -D libssh2.1.dylibotool -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:

install_name_tool -id <yourpath>/libssh2.1.dylib /Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib
  • first parameter is the path that you want
  • second parameter is the real path to the file so drag the file in from the Finder

Also you may need to change dependency names too, and you can use the same tool to do that:

install_name_tool -change <old path> <new path> <library name>

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 with otool -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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文