Search code examples
ios4berkeley-dbbuild-script

Berkeley DB for iPhone


I had tried to create the library for iphone OS 4, but was getting errors.

Here are my build scripts with reference to Berkeley DB Installation guide.

export DEV_iOS=/Developer/Platforms/iPhoneOS.platform/Developer
export SDK_iOS=${DEV_iOS}/SDKs/iPhoneOS4.2.sdk
export COMPILER_iOS=${DEV_iOS}/usr/bin
export CC=${COMPILER_iOS}/gcc
export CXX=${COMPILER_iOS}/g++
export LDFLAGS="-arch armv6 -pipe -Os -gdwarf-2 -no-cpp-precomp -mthumb -isysroot ${SDK_iOS}"
export CFFLAGS=${LDFLAGS}
export CXXFLAGS=${LDFLAGS}
../dist/configure --host=arm-apple-darwin10 --with-cryptography=no --enable-shared=no
make

Here I am getting an error message with3 warnings:

libtool: link: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -O3 -o db_archive -arch armv6 -pipe -Os -gdwarf-2 -no-cpp-precomp -mthumb -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk db_archive.o util_sig.o libdb-5.1.a -lpthread
ld: warning: in db_archive.o, file was built for i386 which is not the architecture being linked (armv6)
ld: warning: in util_sig.o, file was built for i386 which is not the architecture being linked (armv6)
ld: warning: in libdb-5.1.a, file was built for unsupported file format which is not the architecture being linked (armv6)
Undefined symbols:
"_main", referenced from:
_main$non_lazy_ptr in crt1.o
(maybe you meant: _main$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [db_archive] Error 1

Please guide me, where I am doing wrong in the scripts.

Thanks in advance.


Solution

  • I have got Oracle team support.

    I had been successfully able to create the library.

    I have posted it on my blog. Please check the detailed build script for i386 and armv6 architectures.

    http://ankitthakur.wordpress.com/2011/01/16/build-scripts-for-berkely-db-static-libraries-with-ios-development/