English 中文(简体)
static linking fftw3 into shared library
原标题:

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.

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签