Resolved Set target platform for library configure build for iOS simulator

Discussion in 'iOS Programming' started by mydogisbox, Feb 1, 2012.

  1. mydogisbox, Feb 1, 2012
    Last edited: Feb 16, 2012

    mydogisbox macrumors member

    Jan 16, 2011
    I'm using the following script to build the Berkeley DB library.

    export CXXPP=
    export CXXPPFLAGS=
    export CPPFLAGS="-I$SDKROOT/usr/include/c++/4.2.1/i686-apple-darwin11/ -I$SDKROOT/usr/lib/gcc/i686-apple-darwin11/4.2.1/include/ -I$SDKROOT/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/ -I$SDKROOT/usr/include/ -I$SDKROOT/usr/include/c++/4.2.1/armv7-apple-darwin11/ -I./include/ -miphoneos-version-min=2.2 $ICU_FLAGS"
    export CFLAGS="$CPPFLAGS -pipe -arch i386 -no-cpp-precomp -isysroot $SDKROOT"
    export CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS"
    export CXXFLAGS="$CFLAGS" 
    export CC="$DEVROOT/usr/bin/gcc"
    export CXX="$DEVROOT/usr/bin/g++"
    export LDFLAGS="-arch i386 -L$SDKROOT/usr/lib/ -lgcc_eh -isysroot $SDKROOT -Wl,-dead_strip -miphoneos-version-min=2.0"
    ../dist/configure --with-cryptography=no --enable-shared=no --enable-cxx
    It builds and installs just fine, but when I run my test application I get an error like this:

    BDB1539 Build signature doesn't match environment

    followed by 11 exceptions and then a terminate caused by the exceptions.

    I looked in the script log file [EDIT]for the berkeley DB build[/EDIT] and it has this:

    I assume this means I'm building for an x86_64 processor, but the simulator is a 32 bit processor. How do I specify 32 bit in the script?
  2. Sayer macrumors 6502a


    Jan 4, 2002
    Austin, TX
    iOS devices use an ARM architecture processor, not x86.

    Look up on how to set a make file to build for iOS devices in the GOOGLE.
  3. mydogisbox thread starter macrumors member

    Jan 16, 2011
    You are correct, however, the simulator is exactly that, a simulator, not an emulator. The simulator is a 32 bit x86 process. See here and search for "simulator".

    For the sake of clarity, my code is partially taken from the Berkeley DB website documentation for iOS compilation here.
  4. robbieduncan Moderator emeritus


    Jul 24, 2002
    It is indeed. But I believe "x86_64" means you are compiling a 64 bit library...
  5. mydogisbox thread starter macrumors member

    Jan 16, 2011
    YES! How do I change that? I set everything to i386, but I'm still getting the aforementioned error.

  6. mydogisbox thread starter macrumors member

    Jan 16, 2011
    I figured out how to determine the target architecture of my library and it turns out that wasn't the problem.

    I've compiled the Berkeley DB library and included in my iOS project in Xcode 4.2. The project compiles just fine, but when I run it I get the following error:

    The project is one of the templates that comes with Xcode. The only thing I've changed is added the header for the berkeley library, linked the library itself and created an instance of the DB in the init of the model controller.

    I ran lipo on the library to make sure it was the correct architecture and got the following result:

    >lipo -info libdb_cxx-5.3.a
    input file libdb_cxx-5.3.a is not a fat file
    Non-fat file: libdb_cxx-5.3.a is architecture: i386
    It appears to be the correct architecture.

    What is a reasonable way of debugging what is going wrong here?
  7. mydogisbox thread starter macrumors member

    Jan 16, 2011
    It turns out this was just a stupid error on my part. I was still passing a unix path instead of an iOS path for the DB location.

Share This Page