Building FFTW3 in Android NDK

Download fftw3: http://www.fftw.org/download.html Create bash script android_build.sh:

#!/bin/sh
# Compiles fftw3 for Android

export NDK_DIR="/home/luohanjie/Android/Sdk/ndk/android-ndk-r21"
export INSTALL_DIR="`pwd`/jni_arm"
export TARGET=aarch64-linux-android
export API=27
export TOOLCHAIN="$NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64"
export AR=$TOOLCHAIN/bin/$TARGET-ar
export AS=$TOOLCHAIN/bin/$TARGET-as
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/$TARGET-ld
export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib
export STRIP=$TOOLCHAIN/bin/$TARGET-strip
export CFLAGS="-march=armv8-a -D__ANDROID_API__=$API"

mkdir -p $INSTALL_DIR
./configure --host=$TARGET \
--prefix=$INSTALL_DIR \
LIBS="-L$LD_LIBRARY_PATH -L$SYS_ROOT/usr/lib -lc -lgcc -static-libstdc++" \
--enable-shared --enable-single --enable-neon --enable-threads --with-combined-threads --enable-maintainer-mode --disable-fortran


make -j4
make install

exit 0

Run the script:

sh ./android_build.sh

You should end up with libraries in directory of jni_arm.