Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mydogisbox

macrumors member
Original poster
Jan 16, 2011
64
0
I'm using the following script to build the Berkeley DB library.

Code:
DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneSimulator5.0.sdk
SYSROOT=$SDKROOT

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:

build='x86_64-apple-darwin11.2.0'

build_alias=''

build_cpu='x86_64'

build_os='darwin11.2.0'

build_vendor='apple'

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?
 
Last edited:
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.
 
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.

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".

Edit:
For the sake of clarity, my code is partially taken from the Berkeley DB website documentation for iOS compilation here.
 
It is indeed. But I believe "x86_64" means you are compiling a 64 bit library...

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

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?
 
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:

BDB1539 Build signature doesn't match environment
.
.
.
lots of exceptions here with no useful information
.
.
.
terminate called throwing an exception(gdb)

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?
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.