Xcode, Dyld, External Dynamic Libraries and Setting {DY}LD_LIBRARY_PATH for Running Targets
Xcode, Dyld, External Dynamic Libraries and Setting {DY}LD_LIBRARY_PATH for Running Targets
- Subject: Xcode, Dyld, External Dynamic Libraries and Setting {DY}LD_LIBRARY_PATH for Running Targets
- From: Grant Erickson <email@hidden>
- Date: Fri, 24 Jul 2009 14:54:44 -0700
- Organization: Nuovation System Designs, LLC
- Thread-topic: Xcode, Dyld, External Dynamic Libraries and Setting {DY}LD_LIBRARY_PATH for Running Targets
Xcode seems to do a marvelous job at resolving frameworks and their
locations in the project build results rather than from their normal
installed locations (i.e. ignoring the path that might show up in otool -D
for that framework).
However, I am having more difficulty with external shared libraries (i.e.
dylibs), in particular, boost.
I have built boost using bjam with the following settings:
bjam --layout=system 'architecture=combined' 'address-model=32_64' \
'macosx-version=10.4' 'macosx-version-min=10.4'
otool reports the library paths that result as:
% otool -D ../results/Debug/boost/lib/libboost_*.dylib
../results/Debug/boost/lib/libboost_filesystem.dylib:
libboost_filesystem.dylib
../results/Debug/boost/lib/libboost_system.dylib:
libboost_system.dylib
and that all works well and fine.
I've added libboost_system.dylib and libboost_filesystem.dylib to my project
as "Relative to Build Products" and added them as link libraries to my
target. This all works well and fine.
However, when I go to run the target in the debugger, I get:
[Session started at 2009-07-24 14:37:54 -0700.]
dyld: Library not loaded: libboost_filesystem.dylib
Referenced from:
${HOME}/Source/results/Debug/MyApp.app/Contents/MacOS/MyApp
Reason: image not found
The Debugger has exited due to signal 5 (SIGTRAP).The Debugger has
exited due to signal 5 (SIGTRAP).
In the short-term, I can work around this by installing boost in
/usr/local/lib, but long-term, that's the wrong answer, particularly when
the user (e.g. me) has a different version of boost there (e.g. MacPorts)
that they'd rather not overwrite.
Long-term, my intent is to set rpath when building Boost such that otool -D
reports:
/Library/Application Support/Nuovations/lib/libboost_filesystem.dylib
/Library/Application Support/Nuovations/lib/libboost_system.dylib
because setting LD_RUNPATH_SEARCH_PATHS for the application (e.g. MyApp)
only seems to be supported for 10.5 and I am deploying against 10.4.
However, even in that case, I need to tell Xcode "Hey, the libraries you are
looking for when running the binary are <here>, not in their installed
locations (e.g. /Library/Application Support/Nuovations/lib) just like the
five frameworks you resolved."
Toward that end, is there a way to tell Xcode to set LD_LIBRARY_PATH or
DYLD_LIBRARY_PATH before running a target binary?
Regards,
Grant
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden