OSX Snow Leopard: Build boost 1.47.0 for 32 and 64 bit
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开发者_如何学JAVA 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?
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
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
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.
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.
You should add option "architecture", for example:
./b2 macosx-version=10.6 link=static address-model=32_64 architecture=combined threading=multi stage
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.
精彩评论