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

女生的网名这么多〃 提交于 2019-12-06 02:51:06

问题


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?


回答1:


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




回答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



回答3:


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.




回答4:


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.




回答5:


You should add option "architecture", for example:

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



回答6:


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.



来源:https://stackoverflow.com/questions/6913723/osx-snow-leopard-build-boost-1-47-0-for-32-and-64-bit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!