Subdirs project and dyld: Library not loaded
I'm quite new to Qt and have been using it painlessly on Linux for a while, but when I came to move my project over to my OSX laptop to go on the road I just can't understand what's happening. I've read that there is a "problem with debugging on snow leopard":http://doc.qt.digia.com/qtcreator-2.4/creator-troubleshooting-debugging.html but as I've set it to release and still get the problem I think it must be something else.
I created a simple test case to see if a fresh project would exhibit the same problem and it did. Here is what I did:
Create new subdirs project.
Create a C++ shared lib as a child
Create a Console App as a child.
Right-click the Console App and add the C++ library as a library. This gets added to the .pro
@win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../ASharedLib/release/ -lASharedLib
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../ASharedLib/debug/ -lASharedLib
else:symbian: LIBS += -lASharedLib
else:unix: LIBS += -L$$OUT_PWD/../ASharedLib/ -lASharedLib
INCLUDEPATH += $$PWD/../ASharedLib
DEPENDPATH += $$PWD/../ASharedLib@
Builds fine, but when I try and run it:
@dyld: Library not loaded: libASharedLib.1.dylib
Referenced from: /Users/douglas/Code/QT/OSXSubdirsFailure-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Release/AConsoleApp/AConsoleApp
Reason: image not found
Press <RETURN> to close this window...@
What's going on?
I zipped up the whole thing including the build directories: http://dl.dropbox.com/u/81303672/CodeExamples/OSXSubDirsStuff.zip
I'm not sure but maybe you must load the library before to call the app:
I don't think this is the answer. LD_PRELOAD (and by the looks of it, the OSX equivalent) is used for overriding system libraries.
Any other ideas?
[quote author="hipersayan_x" date="1355893677"]I'm not sure but maybe you must load the library before to call the app:
What does need to be set is something like:
but I can't see any way to do this in Qt Creator settings or in the qmake reference guide.