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?

kod kristoff
  • 89
  • 12
moka
  • 4,353
  • 2
  • 37
  • 63
  • 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). – ildjarn Aug 02 '11 at 19:39
  • 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! – moka Aug 02 '11 at 22:07
  • `-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? – ildjarn Aug 02 '11 at 22:15
  • 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.a – moka Aug 03 '11 at 09:04
  • btw., that looks fine to me, still the resulting libraries are 64 bit only.- looks like a bug to me to be honest. – moka Aug 03 '11 at 10:42
  • Those are file copies, not compiler invocations. Look for `g++` calls. – ildjarn Aug 03 '11 at 15:43
  • 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" – moka Aug 05 '11 at 12:38
  • 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... – ildjarn Aug 05 '11 at 15:55
  • yeah, I tried both.- hmm that is very weird, maybe the script is broken? Has nobody else tried this? – moka Aug 08 '11 at 12:27

6 Answers6

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
Rahul Jiresal
  • 1,006
  • 13
  • 24
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

regis
  • 36
  • 1
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.

Steve
  • 13
  • 5
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.

wotaskd
  • 925
  • 1
  • 10
  • 15
0

You should add option "architecture", for example:

./b2 macosx-version=10.6 link=static address-model=32_64 architecture=combined threading=multi stage
Rob
  • 4,927
  • 12
  • 49
  • 54
James Zeng
  • 53
  • 7
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.