Dyld:未加载库 [英] Dyld: Library not loaded

查看:146
本文介绍了Dyld:未加载库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将库libssh2.1.dylib链接到我的iPhone Xcode项目,但是当我尝试将其链接时出现此错误.如果我不将此添加为框架,则会出现找不到符号"错误.现在/Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib不是该文件的正确路径.我从互联网上下载了该库,它是作者计算机的路径.我的文件位于完全不同的位置.如何更改路径参考?这是我得到的错误:

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

推荐答案

您可以使用install_name_tool更改.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

更改安装名称的示例:

install_name_tool -id <yourpath>/libssh2.1.dylib /Users/Matt/Documents/Development/iPhoneApps/Portscanner/lib/libssh2.1.dylib

  • 第一个参数是您想要的路径
  • 第二个参数是文件的真实路径,因此将文件从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>
    

    您可以使用otool检查当前名称.因此,您可以使用otool验证更改,如下所示: otool -D libssh2.1.dylibotool -L libssh2.1.dylib

    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.

    如果需要相对路径,则应考虑将安装名称更改为@ rpath/libssh2.1.dylib并将该路径添加到项目设置中.

    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.

    这篇关于Dyld:未加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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