I m working on some pitch correction software for Android, and I am looking to get fftw3 working on Android using the NDK.
The pitch correction library (talentedhack, http://code.google.com/p/talentledhack/ incase anyone wants to know) depends on fftw3, so I am trying to compile fftw3 as a static library, then link it into the talentedhack shared library. Currently I ve got fftw3 building as a static library, libfftw3.a, but I keep getting unresolved reference errors like this
bin/ndk/local/armeabi/objs/talentedhack/fft.o: In function `fft_inverse :
jni/talentedhack/fft.c:51: undefined reference to `fftwf_execute
when compiling the talentedhack shared library using ndk-build. It appears to be picking up the file correctly though, which is puzzling.
The relevant parts of my Android.mk file looks like this:
LOCAL_MODULE := talentedhack
LOCAL_CFLAGS := -std=c99
LOCAL_SRC_FILES := talentedhack.c other_source_files.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/fftw3/api
LOCAL_STATIC_LIBRARIES := fftw3
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
The command that fails when ndk-build is invoked from the project top level is this one:
/opt/android-ndk-linux/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc -nostdlib -Wl,-soname,libtalentedhack.so -Wl,-shared,-Bsymbolic /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/circular_buffer.o /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/fft.o /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/formant_corrector.o /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/lfo.o /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/pitch_detector.o /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/pitch_shifter.o /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/pitch_smoother.o /path/to/project/bin/ndk/local/armeabi/objs/talentedhack/quantizer.o /path/to/project/ndk/local/armeabi/objs/talentedhack/talentedhack.o -Wl,--whole-archive -Wl,--no-whole-archive /path/to/project/bin/ndk/local/armeabi/libfftw3.a /opt/android-ndk-linux/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/libgcc.a /opt/android-ndk-linux/build/platforms/android-8/arch-arm/usr/lib/libc.so /opt/android-ndk-linux/build/platforms/android-8/arch-arm/usr/lib/libstdc++.so /opt/android-ndk-linux/build/platforms/android-8/arch-arm/usr/lib/libm.so -Wl,--no-undefined -Wl,-z,noexecstack -L/opt/android-ndk-linux/build/platforms/android-8/arch-arm/usr/lib -llog -Wl,-rpath-link=/opt/android-ndk-linux/build/platforms/android-8/arch-arm/usr/lib -o /path/to/project/bin/ndk/local/armeabi/libtalentedhack.so
I m not sure whether this is a problem with fftw3, since I followed their instructions on porting (grab a subset of the source files, manually configure, and build them), since the system actually doesn t have fftwf_execute or any of the other functions defined in any header (that I can tell) due to using some fancy macros, or if it is a problem with Android NDK build system not dealing with static libraries correctly. Any help at all would be greatly appreciated.