在 android移植FFT 傅里叶变换库

时间:2022-04-11 06:35:24

1. 库下载地址:http://www.vesperix.com/arm/fftw-arm/source/fftw-3.2.2-arm.tar.gz

2. 首先编译生成android ndk, 可以参考 http://www.linuxidc.com/Linux/2012-01/52662.htm

3. 将fft代码解压在ndk跟目录, 运行如下脚本:

FFT_ENABLE="--enable-single"
FFT_DISABLE="--disable-fortran --disable-alloca"
FFT_PREFIX="--prefix=/home/^^/fftw_arm/result"
FFT_BUILD="--target=arm-eabi- --host=arm-eabi  --build=x86_64-linux-gnu"
FFT_CFLAGS="-nostdlib"

#FFT_LIBS= -lc -lm


export ANDROID_NDK_ROOT=/home/^^/android/ndk
export PATH=/home/^^/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$ANDROID_NDK_ROOT/toolchains/arm-eabi-4.4.3/prebuilt/linux-x86/bin:$PATH
export ANDROID_API_LEVEL="android-8"

./configure $FFT_ENABLE $FFT_DISABLE CC=arm-linux-androideabi-gcc  $FFT_PREFIX $FFT_BUILD CFLAGS="-nostdlib -O2" CPPFLAGS="-I$ANDROID_NDK_ROOT/platforms/$ANDROID_API_LEVEL/arch-arm/usr/include/ -I/home/^^/android/bionic/libc/arch-arm/include -I /home/^^/android/bionic/libc/include -I/home/^^/android/bionic/libstdc++/include -I/home/^^/android/bionic/libm/include -I/home/^^/android/bionic/libm/include/arm -I/home/^^/android/bionic/libthread_db/include -I/home/^^/android/bionic/libc/kernel/arch-arm" LDFLAGS="-Wl,-rpath-link=$ANDROID_NDK_ROOT/platforms/$ANDROID_API_LEVEL/arch-arm/usr/lib/ -L$ANDROID_NDK_ROOT/platforms/$ANDROID_API_LEVEL/arch-arm/usr/lib/" LIBS="-lc -lm -lstdc++"

 

4. 可以make install 成功, enable-neon 的话 好像不能编译通过, 生成的静态库还没有测试运行 !!