I've got an iPhone app that runs on the device. Now I need to run it in the Simulator.
It uses an open source project (http://site.icu-project.org/), which I build from the command line to create arm-compatible .a
files. I can link these with my iPhone project, and it runs on the device.
If I switch the target to Simulator, the build fails, as I expected:
ld: warning: in libicudata.a, file was built for unsupported file format which is not the architecture being linked (i386)
But if I use libs compiled for local use (x86_64), I get the same error, which has got be baffled. Do I have to specify a third architecture for the Simulator? Which one? How do I set the configuration?
For reference, this is how I configured the icu project for the two different targets: How to build ICU so I can use it in an iPhone app?
Edited to add:
As Guillaume suggested (and Connect iPhone App to PostgreSQL Using Libpq confirmed), I now see that the emulator needs a 32-bit build. So that's the last part: how do I set the configuration?
The library has a standard configure
script, as far as I know, but I'm still pretty new at this.
Edited to add:
I've gotten this far, but the references to i686 are obviously wrong.
I don't know if i386 is considered a cross-compile, if it is I need "host" and "target" options, too.
ICU_PATH=/Users/eric.grunin/Documents/dev/icu2
DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneSimulator4.3.sdk
SYSROOT=$SDKROOT
ICU_FLAGS="-I$ICU_PATH/source/common/ -I$ICU_PATH/source/tools/tzcode/ "
export CXXPP=
export CXXPPFLAGS=
export CPPFLAGS="-I$SDKROOT/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I$SDKROOT/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include/ -I$SDKROOT/usr/include/ -I$SDKROOT/usr/include/c++/4.2.1/armv7-apple-darwin10/ -I./include/ -miphoneos-version-min=2.2 $ICU_FLAGS"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
export CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS"
export CXXFLAGS="$CFLAGS"
export CC="$DEVROOT/usr/llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-gcc-4.2"
export CXX="$DEVROOT/usr/llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-g++-4.2"
export LDFLAGS="-L$SDKROOT/usr/lib/ -isysroot $SDKROOT -Wl,-dead_strip -miphoneos-version-min=2.0"
cd $ICU_PATH
mkdir simbuild
cd simbuild
$ICU_PATH/source/configure --enable-static --disable-shared
gnumake