iPhone OS
Prev | Chapter 6. Building Berkeley DB for UNIX/POSIX | Next

## iPhone OS

Building Berkeley DB in iPhone OS is the same as building for a conventional UNIX platform. This section lists the commands for building Berkeley DB in both the iPhone simulator (a software simulator included in the iPhone SDK that you can use to test your application without using the iPhone/iPod Touch) and the iPhone device.

Prior to building BDB in an iPhone simulator/iPhone device, set the required environment variables for iPhone OS.

The steps to build BDB in an iPhone simulator is as follows:

    export LDFLAGS="-arch i386 -pipe -Os -gdwarf-2 -no-cpp-precomp"
    export CFLAGS="-arch i386 -pipe -Os -gdwarf-2 -no-cpp-precomp "
    export CXXFLAGS="-arch i386 -pipe -Os -gdwarf-2 -no-cpp-precomp"
    cd $BDB_HOME/build_unix
    ../dist/configure --host=i386-apple-darwin\
                      --prefix=$SDKROOT ...
    make

The steps to build BDB in an iPhone device is as follows:

    export LDFLAGS="-arch armv6 -pipe -Os -gdwarf-2\
                    -no-cpp-precomp -mthumb -isysroot $SDKROOT "
    export CFLAGS="-arch armv6 -pipe -Os -gdwarf-2\
                   -no-cpp-precomp -mthumb -isysroot $SDKROOT "
    export CXXFLAGS="-arch armv6 -pipe -Os -gdwarf-2\
                     -no-cpp-precomp -mthumb -isysroot $SDKROOT "
    cd $BDB_HOME/build_unix
    ../dist/configure --host=arm-apple-darwin9\
                      --prefix=$SDKROOT ...
    make

Both set of commands create the BDB dynamic library - libdb-5.1.dylib. To build the static library, libdb-5.1.a, add the `--enable-shared=no` option while configuring.

Prev | Up | Next
HP-UX | Home | IRIX