Search code examples
macososx-leoparduniversal-binaryboost-build

How to build boost 1.45 universal binaries?


How to build boost 1.45 universal binaries? on leopard/ snow leopard ?


Solution

  • To build 4-way universal boost static binaries on OSX 10.6 I do the following:

    1. Download boost from the boost website.

    2. Extract the archive and cd into the boost_x_xx_x folder (where x_xx_x is the version of boost you are using).

    3. Run:

      ./bootstrap.sh and then

      # The name of the Boost.Jam program changed from "bjam" to "b2" in Boost 1.47.0

      # Replace "b2" with "bjam" if you are compiling a version <= 1.46.1

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

    This will compile everything except for Boost.MPI (which requires the --with-mpi option). The build products get put in ./stage


    UPDATE: If you have installed XCode 4, then there is an extra step that you must perform. XCode 4 does not come with compilers or libraries capable of targeting PowerPC. Unfortunately, the compilers that come with XCode 4 become the default compilers used by Boost. To force the use of the compilers that come with XCode 3, you must perform an extra step. Note that you must install XCode 3 if it is not on your system.

    After running ./bootstrap.sh, and before running b2, open:

    ./tools/build/v2/user-config.jam
    

    Add following line to that file. This instructs boost to use the g++-4.2 from XCode 3:

    using darwin : : /Developer-old/usr/bin/g++-4.2 ;