Matt Galloway

My home on the 'net.

Compiling Boost 1.44 for iPhone

As a follow up to my other post about compiling Boost for iOS, here is how to do it for 1.44.

First, edit your user-config.jam (i.e. edit ~/user-config.jam) to include the following:

1
2
3
4
5
6
7
8
9
10
11
using darwin : 4.2.1~iphone
   : /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv7 -mthumb -fvisibility=hidden -fvisibility-inlines-hidden
   : <striper>
   : <architecture>arm <target-os>iphone
   ;

using darwin : 4.2.1~iphonesim
   : /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -fvisibility=hidden -fvisibility-inlines-hidden
   : <striper>
   : <architecture>x86 <target-os>iphone
   ;

Then, follow these steps to install:

1
2
3
4
5
6
7
8
9
10
11
12
13
# <grab source from boost.org>
tar xzf boost_1_44_0.tar.gz
cd boost_1_44_0
./bootstrap.sh

# Set this to whatever you want to build against
SDK_VERSION="4.1"

# Install for device:
./bjam --prefix=${HOME}/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK_VERSION}.sdk/usr toolset=darwin architecture=arm target-os=iphone macosx-version=iphone-${SDK_VERSION} define=_LITTLE_ENDIAN link=static install

# Install for simulator
./bjam --prefix=${HOME}/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk/usr toolset=darwin architecture=x86 target-os=iphone macosx-version=iphonesim-${SDK_VERSION} link=static install

This will install boost into a prefix directory of:

${HOME}/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk/usr

Comments