possan
possan

Reputation: 525

Using boost on the iPhone

After alot of hacking i have managed to compile the boost-libraries for iphone, both device and simulator, but when i try to use them i get an error in the xcode debugger saying:

dyld: Library not loaded: libboost_graph.so.1.40.0

which im guessing is a dynamic library loader which isn't allowed on the iphone. i'm linking the app with -Lboost_graph as a compiler flag.

this is the script i used for building boost:

./bjam $1 $2 $3 \
        toolset=darwin \
        architecture=arm \
        target-os=iphone \
        macosx-version=iphone-3.0 \
        define=_LITTLE_ENDIAN \
        --layout=system \
        --libdir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib \
        --includedir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include \
        link=static \
        runtime-link=static

./bjam $1 $2 $3 \
        toolset=darwin \
        architecture=x86 \
        target-os=iphone \
        macosx-version=iphonesim-3.0 \
        --layout=system \
        --libdir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib \
        --includedir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/include \
        link=static \
        runtime-link=static

I'm guessing i am missing something very basic here, but what?

is the library compiled for dynamic loading (there is both an .a-file and a .so-file in the platform /usr/lib)

Upvotes: 4

Views: 1878

Answers (1)

DaveR
DaveR

Reputation: 9640

I might be wrong, but I think you will need to link your application statically with boost - the error message from dyld suggests that you are currently linking to the dynamic boost library (note the .so suffix in the error message - you want to be linking against the static one - libboost.a

you probably want to link your app with something like:

-iboost_graph -static

(assuming the .a file is called libboost_graph.a)

Upvotes: 2

Related Questions