I'm trying to compile again the libpq for arm and i386 with the iOS SDK 4.2.
I did last year for SDK3.x without any problems.
Now, when I want to create the fat binary file with two files, I'm getting this error:
specifed architecture type (arm) for file (/Users/montx/mylibs_sdk42/libpq.arm) does not match its cputype (7) and cpusubtype (3) (should be cputype (12) and cpusubtype (0))
I'm compiling again because my compiled files doesn't work with the latest iOS4.2
Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
fcntl$UNIX2003 called from function pg_set_noblock in image GlobalScan.
If you are encountering this problem running a simulator binary within gdb, make sure you 'set start-with-shell off' first.
thanks!
Here is the full script:
#!/bin/bash
DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneOS4.2.sdk
rm -rf /Users/montx/mylibs_sdk42
mkdir /Users/montx/mylibs_sdk42 #Store there compiled libs
make clean
#Build ARM library
./configure --host=arm-apple-darwin --without-readline --disable-ipv6 CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.0.1 CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.0.1/include/ -I$SDKROOT/usr/include/" CFLAGS="$CPPFLAGS -arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT" CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" LD=$DEVROOT/usr/bin/ld
make -C src/interfaces/libpq
cp /Users/montx/Downloads/postgresql-8.4.1/src/interfaces/libpq/libpq.a /Users/montx/mylibs_sdk42/libpq.arm
#Build ARM library
./configure --host=arm-apple-darwin --without-readline --disable-ipv6 CC=$DEVROOT/usr/bin/arm-apple-darwin9-gcc-4.0.1 CPPFLAGS="-I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.0.1/include/ -I$SDKROOT/usr/include/" CFLAGS="$CPPFLAGS -arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT" CPP="$DEVROOT/usr/bin/cpp $CPPFLAGS" LD=$DEVROOT/usr/bin/ld
#Then build i386 library ==> the simulator is 32bits
CFLAGS="$(OTHER_CFLAGS) -mmacosx-version-min=10.5"
LDFLAGS="$(OTHER_LDFLAGS) -mmacosx-version-min=10.5"
make clean && ./configure CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" && make -C src/interfaces/libpq
cp src/interfaces/libpq/libpq.a /Users/montx/mylibs_sdk42/libpq.i386
#Then make fat binary
$DEVROOT/usr/bin/lipo -arch armv6 /Users/montx/mylibs_sdk42/libpq.arm -arch i386 /Users/montx/mylibs_sdk42/libpq.i386 -create -output /Users/montx/mylibs_sdk42/libpq