Dyld: Library not loaded
Asked Answered
G

1

3

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
Gastrulation answered 25/9, 2010 at 17:19 Comment(1)
May be its bit off the topic. But have a look into the document and get instruction to build and use the libssh2 library to use with you iPhone app. Uri: sites.google.com/site/olipion/cross-compilation/libssh2Unadvised
H
1

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.

Hedge answered 30/12, 2011 at 20:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.