Boost logo

Boost :

Subject: [boost] linking on OSX
From: David M. Cotter (me_at_[hidden])
Date: 2009-10-09 17:35:18


i've compiled my boost library. i want to use threads in my stand-
alone application

i want this to work even on machines that don't have boost installed,
obviously.

so i have a couple custom build steps in my XCode proj:

I have a "Copy Files" step which copies "libboost_thread.dylib" into
the "SharedSupport" folder of my application bundle
then the normal "link with binaries" step, which links with the
thread.dylib which is in the normal "install" location (/usr/local/lib/)
then i have a "custom shell script" step (after the linking step)
which does this:

install_name_tool -change libboost_thread.dylib @loader_path/../
SharedSupport/libboost_thread.dylib "${BUILT_PRODUCTS_DIR}/$
{EXECUTABLE_PATH}";

what this does is cause the executable to link with the
libboost_thread.dylib that is in the SharedSupport folder in the app
bundle, or so i thought.

because when i run, it fails to launch because it can't find the
dylib, i get this in the console:

10/9/09 2:19:35 PM [0x0-0x41d41d].com.foo.foo[88777] dyld: Library not
loaded: @loader_path/../SharedSupport/libboost_thread.dylib
10/9/09 2:19:35 PM [0x0-0x41d41d].com.foo.foo[88777] Referenced
from: /Users/davec/Desktop/Foo.app/Contents/MacOS/Foo
10/9/09 2:19:35 PM [0x0-0x41d41d].com.foo.foo[88777] Reason: no
suitable image found. Did find:
10/9/09 2:19:35 PM [0x0-0x41d41d].com.foo.foo[88777] /Users/davec/
Desktop/Foo.app/Contents/MacOS/../SharedSupport/libboost_thread.dylib:
unknown required load command 0x80000022


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk