views:

38

answers:

1

So, I'm building a project, and it uses functions from a compiled library (.dylib or .so). I have the headers and the library files (this is all part of QtRoot, btw) in appropriate locations, but when I try to build my project in Xcode, I get a debugger error:

dyld: Library not loaded: @rpath/libRIO.so Referenced from: /Users/paulthompson/Documents/Programming/Build Products/Debug/MacHeliosSim.app/Contents/MacOS/MacHeliosSim Reason: image not found sharedlibrary apply-load-rules all Data Formatters temporarily unavailable, will re-try after a 'continue'. (Cannot call into the loader at present, it is locked.)

Now, the program itself which is built will run just fine if I open it from the Finder, but whenever I try to run it from Xcode, it barfs at me. What the heck is this rpath thing, and why can't the debugger find the libraries, even though Xcode itself knows where they are, and apparently the program when run from the Finder can find them too?

Thanks,

Paul

+2  A: 

http://en.wikipedia.org/wiki/Rpath_(linking)

It's a path stored in the binary to find shared libs. When you start the app from Finder, it's probably an app bundle? When app bundles are created, shared libraries are copied into the app bundle, and the paths to the bundled libraries become relative then. (@executable_path/../Frameworks/foobar). How did you create the version that works from Finder?

Does the error above occurr at link time or when starting the application from xcode? (In the latter case, try with DYLD_LIBRARY_PATH)

Also, the .so extension for libRIO instead of .dylib looks a bit suspicious.

Frank
You missed the closing parenthesis on your link.
Adam W
TraxusIV
copy files build phase?
TraxusIV
I suppose I should ask, what is the _correct_ way to add a precompiled library like this to a project? The method I used was to drag and drop them from another project (which was generated by qmake, and displays the same problem).Also, that wiki article is rather brief. Can you expound a bit on the details of rpath?
TraxusIV