how to compile fftw3 on iOS

Nowdays I just want to use FFTW3 on iOS, since I've compiled it successfully into i386 version which is used by the iOS simulator, the rest work is to compile it into armv6(or v7) version and lipo these two versions together,below is my incorrect configure:

./configure CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 LD=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld CCFLAGS="-I /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/lib/gcc/arm-apple-darwin10/4.2.1/include/ -I /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include/ -miphoneos-version-min=2.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk" LDFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk" --enable-float --host=arm-apple-darwin --build=arm-apple-darwin10 --disable-fortran

when use this to build fftw3,I always get this:

checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for arm-apple-darwin-strip... no checking for strip... strip configure: WARNING: using cross tools not prefixed with host triplet checking for a thread-safe mkdir -p... ./install-sh -c -d checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking build system type... arm-apple-darwin10 checking host system type... arm-apple-darwin checking for arm-apple-darwin-gcc... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 checking whether the C compiler works... no configure: error: in /Users/chencyz/Desktop/Development/Misc/fftw3/fftw-3.3': configure: error: C compiler cannot create executables See config.log' for more details

I'm not so clear about the problem(C compiler not works?),could anyone give me some guides,thanks very much !


According to ./configure --help:

--build=BUILD     configure for building on BUILD [guessed]
--host=HOST       cross-compile to build programs to run on HOST [BUILD]

So the key is to pass --host=arm-apple-darwin10, and execute configure with the correct alterations to PATH, CFLAGS, LDFLAGS, etc.

This seems to work:

PATH=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH 
../configure --host=arm-apple-darwin10 CFLAGS="-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include -I/Library/iPhone/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk" 
CC=arm-apple-darwin10-gcc-4.2.1 
CPP=cpp 
LDFLAGS="-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk" 
--enable-single

Good luck.


I had a similar issue when trying to get cute compiled for iOS. Looking at the configure script, it didn't seem to use the $LDFLAGS variable, but if it did I think you could add the following to the configure line:

./configure CC=... CFLAGS="-arch armv7 -isysroot $SDKROOT" CXXFLAGS="$CFLAGS" LDFLAGS="$CFLAGS -Wl,-syslibroot $SDKROOT"

Where $SDKROOT is /Developer/Platforms/iPhone.platform/Developer/SDKs/iPhone5.0.sdk by default (with the iOS 5.0 SDK).

I never got cute compiled as I couldn't figure out how to correct the C-compiler invocation, however, your mileage may vary.

链接地址: http://www.djcxy.com/p/52450.html

上一篇: 错误,同时加载项目到设备..关于libsqlite3.0dylib文件丢失

下一篇: 如何在iOS上编译fftw3