我正在尝试在 Android 上编译 SoundTouch。我从这个配置行开始:
./configure CPPFLAGS="-I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/" LDFLAGS="-Wl,-rpath-link=/卷/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/lib -L/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/ arch-arm/usr/lib -nostdlib -lc" --host=arm-eabi --enable-shared=yes CFLAGS="-nostdlib -O3 -mandroid" host_alias=arm-eabi --no-create --no-递归
因为 Android NDK 以 ARM 为目标,所以我还必须更改 Makefile 以删除 -msse2 标志才能进行。
当我运行'make'时,我得到:
/bin/sh ../../libtool --tag=CXX --mode=compile arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c -o FIRFilter.lo FIRFilter.cpp
libtool: compile: arm-eabi-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/ -O3 -fcheck-new -I../../include -g -O2 -MT FIRFilter.lo -MD -MP -MF .deps/FIRFilter.Tpo -c FIRFilter.cpp -o FIRFilter.o
FIRFilter.cpp:46:21: error: stdexcept: No such file or directory
FIRFilter.cpp: In member function 'virtual void soundtouch::FIRFilter::setCoefficients(const soundtouch::SAMPLETYPE*, uint, uint)':
FIRFilter.cpp:177: error: 'runtime_error' is not a member of 'std'
FIRFilter.cpp: In static member function 'static void* soundtouch::FIRFilter::operator new(size_t)':
FIRFilter.cpp:225: error: 'runtime_error' is not a member of 'std'
make[2]: *** [FIRFilter.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
这并不奇怪,因为 -nostdlib 标志是必需的。Android 似乎既没有 stdexcept 也没有 stdlib。 我怎样才能克服这个编译 SoundTouch 的障碍?
猜测一下,可能有一些我不知道我应该使用的标志。我可以重构代码不使用stdexcept。可能有一种方法可以引入原始的 stdexcept 源并引用它。我也许可以链接到预编译的 stdexcept 库。