Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stdexcept On Android

I'm trying to compile SoundTouch on Android. I started with this configure line:

./configure CPPFLAGS="-I/Volumes/android-build/mydroid/development/ndk/build/platforms/android-3/arch-arm/usr/include/" LDFLAGS="-Wl,-rpath-link=/Volumes/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-recursion

Because the Android NDK targets ARM, I also had to change the Makefile to remove the -msse2 flags to progress.

When I run 'make', I get:

/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

This isn't very surprising, since the -nostdlib flag was required. Android seems to have neither stdexcept nor stdlib. How can I get past this block of compiling SoundTouch?

At a guess, there may be some flag I don't know about that I should use. I could refactor the code not to use stdexcept. There may be a way to pull in the original stdexcept source and reference that. I might be able to link to a precompiled stdexcept library.

like image 621
David R. Avatar asked Nov 06 '22 14:11

David R.


1 Answers

The default provided gcc version provided with the android ndk does not support exceptions. See http://www.crystax.net/android/ndk.php for an alternative build which does.

like image 172
Futumsh Avatar answered Nov 15 '22 09:11

Futumsh