我有一个Android NDK项目在SoundTouch库的NDK_Build期间失败。
构建日志
izzy@NebulaesGate:~/warspace/AudioAnalyzerLib/jni$ /home/izzy/warspace/adt-bundle-linux-x86-20140321/ndk/ndk-build
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 8 in /home/izzy/warspace/AudioAnalyzerLib/AndroidManifest.xml
Android NDK: WARNING: Ignoring invalid values in LOCAL_CPP_FEATURES definition in /home/izzy/warspace/AudioAnalyzerLib/jni/Android.mk: -fno-exceptions
[armeabi] Compile++ thumb: SoundTouch <= AAFilter.cpp
[armeabi] Compile++ thumb: SoundTouch <= BPMDetect.cpp
[armeabi] Compile++ thumb: SoundTouch <= cpu_detect_x86.cpp
[armeabi] Compile++ thumb: SoundTouch <= FIFOSampleBuffer.cpp
[armeabi] Compile++ thumb: SoundTouch <= FIRFilter.cpp
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/FIRFilter.cpp: In static member function 'static soundtouch::FIRFilter* soundtouch::FIRFilter::newInstance()':
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/FIRFilter.cpp:294:10: warning: variable 'uExtensions' set but not used [-Wunused-but-set-variable]
[armeabi] Compile++ thumb: SoundTouch <= mmx_optimized.cpp
[armeabi] Compile++ thumb: SoundTouch <= PeakFinder.cpp
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/PeakFinder.cpp: In member function 'int soundtouch::PeakFinder::findCrossingLevel(float const*, float, int, int) const':
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/PeakFinder.cpp:146:11: warning: variable 'peaklevel' set but not used [-Wunused-but-set-variable]
[armeabi] Compile++ thumb: SoundTouch <= RateTransposer.cpp
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/RateTransposer.cpp: In member function 'void soundtouch::RateTransposer::processSamples(const SAMPLETYPE*, uint)':
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/RateTransposer.cpp:133:10: warning: variable 'count' set but not used [-Wunused-but-set-variable]
[armeabi] Compile++ thumb: SoundTouch <= SoundTouch.cpp
[armeabi] Compile++ thumb: SoundTouch <= sse_optimized.cpp
[armeabi] Compile++ thumb: SoundTouch <= TDStretch.cpp
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/TDStretch.cpp: In static member function 'static soundtouch::TDStretch* soundtouch::TDStretch::newInstance()':
/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/TDStretch.cpp:627:10: warning: variable 'uExtensions' set but not used [-Wunused-but-set-variable]
[armeabi] SharedLibrary : libSoundTouch.so
/home/izzy/warspace/adt-bundle-linux-x86-20140321/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/izzy/warspace/AudioAnalyzerLib/obj/local/armeabi/objs/SoundTouch/SoundTouch/RateTransposer.o: in function soundtouch::TransposerBase::newInstance():/home/izzy/warspace/AudioAnalyzerLib/jni/SoundTouch/RateTransposer.cpp:284: error: undefined reference to 'soundtouch::InterpolateLinearInteger::InterpolateLinearInteger()'
collect2: ld returned 1 exit status
make: *** [/home/izzy/warspace/AudioAnalyzerLib/obj/local/armeabi/libSoundTouch.so] Error 1
我知道它有一个未定义的引用错误,但我不理解它。 RateTransposer.cpp包含InterpolateLinear.h
#include "InterpolateLinear.h"
这是失败的代码
#ifdef SOUNDTOUCH_INTEGER_SAMPLES
// Notice: For integer arithmetics support only linear algorithm (due to simplest calculus)
return new InterpolateLinearInteger; # <<<<<________________LINE 284
#else
这是我的Android.mk文件
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += -fno-exceptions
LOCAL_SRC_FILES := \
SoundTouch/AAFilter.cpp \
SoundTouch/BPMDetect.cpp \
SoundTouch/cpu_detect_x86.cpp\
SoundTouch/FIFOSampleBuffer.cpp \
SoundTouch/FIRFilter.cpp \
SoundTouch/mmx_optimized.cpp \
SoundTouch/PeakFinder.cpp \
SoundTouch/RateTransposer.cpp \
SoundTouch/SoundTouch.cpp \
SoundTouch/sse_optimized.cpp \
SoundTouch/TDStretch.cpp
LOCAL_MODULE := libSoundTouch
LOCAL_C_INCLUDES := include/ #include/BPMDetect.h include/FIFOSampleBuffer.h include/FIFOSamplePipe.h include/SoundTouch.h include/STTypes.h
LOCAL_CFLAGS += -Wall -fvisibility=hidden -I include -D ST_NO_EXCEPTION_HANDLING -fdata-sections -ffunction-sections -marm
include $(BUILD_SHARED_LIBRARY)
感谢您的帮助, 乔
答案 0 :(得分:2)
我想出来了。
我在RateTransposer.cpp之前将'SoundTouch / InterpolateLinear.cpp \'添加到我的Android.mk文件...