how to compile fftw3 on iOS
Asked Answered
P

2

2

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 Seeconfig.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 !

Plumcot answered 21/10, 2011 at 14:10 Comment(5)
Before you waste too much time on this, you do know that you can't use FFTW for commercial development without paying a hefty licensing fee, right ? A simpler, free alternative is KissFFT: kissfft.sourceforge.netLeipzig
Thanks for your advise :) But I also need many other libraries,they all depend on FFTW3,so I think I have to choice FFTW despite its license issue......Plumcot
OK - there can't be many iPhone apps that are successful enough to justify paying a $5k licensing fee for FFTW, but I hope that your is one of them...Leipzig
Before you go too far, please note that there's a highly-tuned FFT library in the SDK (part of the Accelerate.framework). Leaving aside the licensing issues of FFTW, the simplicity of using a platform library is hard to argue with.Gentilism
Also: did you "See config.log' for more details"? Please do so, and post the tail of the log file in your question.Gentilism
N
1

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.

Niggard answered 3/11, 2011 at 9:9 Comment(1)
Hi - I'm trying to get compile fftw3 for ios5 and not having any luck, even when editing the path and passing in values appropriate values for configure. Hoping someone here is having better luck and can share...Metalanguage
L
0

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.

Labrum answered 21/10, 2011 at 15:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.