views:

613

answers:

2

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)

+1  A: 

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)

Dave Rigby
it seems that linking with -static makes the compiler fall back to a different linker, giving another error:"ld_classic: can't locate file for: -lcrt0.o"atleast i got another compiler flag to google :)
possan
A: 

I would also be interested in hearing about if you ever found a solution to get it running on the iPhone.

If I only want to use boost_graph, how much other dependencies are there? I looked around a bit and I think it is only the boost_regex, but how does it work with the dependencies on the stl containers? Will that add a lot of regular c++ STL-related code that has to be compiled for and bundled into to app when building the app project?

niblha