OSX Snow Leopard: Build boost 1.47.0 for 32 and 64 bit
Asked Answered
L

6

5

I am going crazy...I am currently trying to upgrade boost for my project from 1.44.0 to 1.47.0 on osx snow leopard.- I want to build it with the following command:

./b2 macosx-version=10.6 link=static address-model=32_64 threading=multi stage

where i'd expect that it gives me a static fat build that supports i386 aswell as x86_64 . Anyways, it obviously does not, since if i query lipo -info of the resulting libs, they are all x86_64.- What can I do to solve this? Could it be that the build script is broken?

Lacrimator answered 2/8, 2011 at 14:31 Comment(9)
I believe you need to explicitly specify toolset=darwin; however, as a sanity check, run that same b2 invocation plus the -n argument and post a sample of how the compiler is being invoked (specifically, what arguments are being passed).Buryat
hmm the -n is not doing anything, what is it supposed to do? The darwin does not change anything ( i am pretty sure that it is the default choice on osx anyways ) thanks!Lacrimator
-n tells bjam/b2 to output the compiler/linker commands it would have executed, without actually executing them. Are you saying there was no program output at all?Buryat
hey, this is part the ouput, not sure if thats what you mean: cp "bin.v2/libs/regex/build/darwin-4.2.1/release/address-model-32_64/link-static/macosx-version-10.6/threading-multi/libboost_regex.a" "stage/lib/libboost_regex.a" common.copy stage/lib/libboost_graph.a cp "bin.v2/libs/graph/build/darwin-4.2.1/release/address-model-32_64/link-static/macosx-version-10.6/threading-multi/libboost_graph.a" "stage/lib/libboost_graph.a" common.copy stage/lib/libboost_iostreams.aLacrimator
btw., that looks fine to me, still the resulting libraries are 64 bit only.- looks like a bug to me to be honest.Lacrimator
Those are file copies, not compiler invocations. Look for g++ calls.Buryat
okay, my bad: they look correct to me too: "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -no-cpp-precomp -gdwarf-2 -fexceptions -isysroot /Developer/SDKs/MacOSX10.6.sdk -DBOOST_ALL_NO_LIB=1 -DBOOST_SIGNALS_NO_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/signals/build/darwin-4.2.1/release/address-model-32_64/link-static/macosx-version-10.6/threading-multi/signal_base.o" "libs/signals/src/signal_base.cpp"Lacrimator
No, that doesn't look right. Are you sure you tried explicitly setting toolset=darwin when invoking b2? Looking at darwin.jam, setting address-model=32_64 should cause it to call g++ with -arch i386 -arch x86_64, which it clearly isn't doing...Buryat
yeah, I tried both.- hmm that is very weird, maybe the script is broken? Has nobody else tried this?Lacrimator
G
2

I got it to work by using this build:

./b2 link=static threading=multi toolset=darwin cxxflags="-arch i386 -arch x86_64" macosx-version=10.6 stage

Gloxinia answered 17/8, 2011 at 15:8 Comment(0)
R
2

This is what worked for me.

./b2 link=static threading=multi toolset=darwin cxxflags="-arch i386 -arch x86_64" target-os=darwin address-model=32_64 stage
Ran answered 11/7, 2012 at 21:6 Comment(0)
M
1

The only way for me to get fat binaries building Boost 1.49 on MacOSX 10.6 was to use both the parameters architecture=x86 and address-model=32_64.

Menstruum answered 2/10, 2012 at 7:45 Comment(0)
F
1

I have tried all many options and none of them produced a universal binary with both 32 and 64-bit architectures. The one that finally worked for me was this one:

./b2 threading=multi toolset=darwin architecture=x86 target-os=darwin address-model=32_64 stage

This is with boost 1.51.0 on Mountain Lion.

Faludi answered 18/10, 2012 at 19:1 Comment(0)
P
0

You should add option "architecture", for example:

./b2 macosx-version=10.6 link=static address-model=32_64 architecture=combined threading=multi stage
Plascencia answered 12/6, 2013 at 11:49 Comment(0)
M
0

I'm having problems building 32/64 combined versions too, and ultimately resorted to building the two separately (I had to add the cxx flag "-arch i386" to the 32 bit build) and using lipo to combine them. Eg:

./bjam link=static release install address-model=32 --prefix=$prefix_dir-x86" --python-buildid=2.7 python=2.7 --with-python cxxflags="-fPIC -Wfatal-errors -arch i386" -s NO_BZIP2=1 -s NO_ZLIB=1
./bjam link=static release install address-model=64 --prefix=$prefix_dir-x64" --python-buildid=2.7 python=2.7 --with-python cxxflags="-fPIC -Wfatal-errors" -s NO_BZIP2=1 -s NO_ZLIB=1
lipo $prefix_dir-x86/lib/libboost_python-2_7.a $prefix_dir-x64/lib/libboost_python-2_7.a -output $prefix_dir-universal/libboost_python-2_7.a -create

Given that I still got 64 bit binaries (when I requested 32 bit) before I added "-arch i386", I suspect that there's an issue with bjam/b2's build script for 32 bit binaries on macos.

Mistletoe answered 8/4, 2014 at 19:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.