Dyld: Library not loaded

江枫思渺然 提交于 2019-12-04 14:36:12

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!