静态链接 fftw3 到共享库

发布于 2024-09-13 23:13:13 字数 2540 浏览 3 评论 0原文

我正在开发一些适用于 Android 的音调校正软件,并且希望使用 NDK 让 fftw3 在 Android 上运行。

音调修正库 (talentedhack, http://code.google.com/p/talentledhack/以防万一有人想知道)依赖于fftw3,所以我尝试将fftw3编译为静态库,然后将其链接到talenthack共享库中。目前,我已经将 fftw3 构建为静态库 libfftw3.a,但

bin/ndk/local/armeabi/objs/talentedhack/fft.o: In function `fft_inverse':
jni/talentedhack/fft.c:51: undefined reference to `fftwf_execute'

在使用 ndk-build 编译有天赋的共享库时,我不断收到类似这样的未解决的引用错误。但它似乎正确地拾取了文件,这令人费解。

我的 Android.mk 文件的相关部分如下所示:

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)

从项目顶层调用 ndk-build 时失败的命令是:

/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/构建/平台/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

我不是确定这是否是 fftw3 的问题,因为我按照他们的移植说明进行操作(获取源文件的子集,手动配置并构建它们),因为系统实际上没有 fftwf_execute 或中定义的任何其他函数任何头文件(我可以告诉)由于使用一些奇特的宏,或者如果是 Android NDK 构建系统未正确处理静态库的问题。 任何帮助将不胜感激。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文