mercredi 4 mars 2015

Android NDK , C++11 and the wrong stdlib

Trying to compile a C++11 library using the android ndk(android-ndk-r10d) and a standalone toolchain results in many errors along the lines of



error: no member named 'to_string' in namespace 'std'


This seems to be the same across using GCC or clang. The toolchain is generated with :



./make-standalone-toolchain.sh --platform=android-19 --install-dir=/home/ian/android_standalone/ --ndk-dir=/home/ian/androidndk/android-ndk-r10d/ --arch=arm --system=linux-x86_64 --stl=gnustl


And compilation is via:



cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" -DANDROID_STANDALONE_TOOLCHAIN=/home/ian/android_standalone/ ../


Almost all of the suggestions for fixing this involve ensuring you are passing -stdlib=c++11 to the compiler. However that is not a problem here:


/home/ian/android_standalone/bin/clang35++ -DANDROID -DRELICXX_MOVE -DRELICXX_MOVEG1 -DRELICXX_MOVEG2 -DRELICXX_MOVEGT -DRELICXX_MOVEZR -DRELICXX_UNCONST -Dforwardsec_EXPORTS -fpic -target armv7-none-linux-androideabi -Qunused-arguments --sysroot=/home/ian/android_standalone/sysroot -funwind-tables -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Xclang -mnoexecstack -std=c++11 -Wall -Wextra -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -isystem /home/ian/android_standalone/sysroot/usr/include -isystem /home/ian/android_standalone/include/c++/4.8 -isystem /home/ian/android_standalone/include/c++/4.8/arm-linux-androideabi/armv7-a -I/home/ian/libforwardsec/include/forwardsec -I/home/ian/libforwardsec/src -o CMakeFiles/http://ift.tt/1AKjlDW -c /home/ian/libforwardsec/src/util.cpp In file included from /home/ian/libforwardsec/src/util.cpp:2:


There seems to be something generically wrong with setting up an android toolchain that supports c++11.


Aucun commentaire:

Enregistrer un commentaire