Re: Problem cross compiling for iPhone (iOS 4)

Xander Maas <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Hi All,

Got a version of the (simple) script I used to build the libraries:

#!/bin/sh

# First we unset some shell variables and set some important (??) onces
unset CC
unset CFLAGS
unset LDFLAGS
unset CPP
unset PLATFORM

export buildPath=`pwd`

# make arm target
export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1
export CFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
export LDFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot \ /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk"
export CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp

cd $buildPath/freetds-0.83.dev.20110125_arm
./configure --disable-shared --disable-odbc --disable-pool --disable-server --disable-apps --host=arm-apple-darwin10 --prefix=$buildPath/build/arm 
make -j4
make install

# make i686 (Simulator) target
unset CC
unset CFLAGS
unset LDFLAGS
unset CPP

export CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/i686-apple-darwin10-gcc-4.2.1
export CFLAGS="-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk"
export LDFLAGS="-isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -Wl,-syslibroot \
Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk"
export CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/cpp

cd $buildPath/freetds-0.83.dev.20110125_i686_SIM
./configure --disable-shared --disable-odbc --disable-pool --disable-server --disable-apps --host=i686-apple-darwin10 --prefix=$buildPath/build/i686
make -j4
make install

# make the universal libraries
for lib in libct.a libsybdb.a; do lipo -create -output $buildPath/build/universal/$lib $buildPath/build/arm/lib/$lib $buildPath/build/i686/lib/$lib; done

The script creates the correct archs in their respective folders and lipo creates a (correct) universal library. 
I do get the same 'error' when I try to link to the i386 library (not the universal one).

It must be something I do wrong, but what... (tearing my hair out....)

Regards,

Xander


On 14 feb 2011, at 19:16, Daniel Fazekas wrote:

> On Feb 14, 2011, at 18:51, Xander Maas wrote:
> 
>> Yes, I have. I have specified the 4.2 SDK for both the Simulator library (i386) and iPhoneOS. I also use the same SDK for my project.
> 
> So you have built the FreeTDS code twice using configure something like this?
> 
> export PATH="/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
> CFLAGS="-D__IPHONE_OS_VERSION_MIN_REQUIRED=40200 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk" ./configure --host=i386-apple-darwin
> make
> 
> save the libraries, then repeated for the real iOS SDK & arm arch and used lipo to combine the two  architectures together?
> 
> Because when I build it like that, it links to _fopen rather than _fopen$UNIX2003.
> That UNIX2003 thing is something for Mac OS X 10.5/10.6's Unix certification compatibility.
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.