A few functions missing from std namespace
NDK version 12.0.2763256-beta1
$ cat test.cpp
#include <cmath>
#include <string>
int main() {
(void) std::nextafter(0.0, 0.0);
(void) std::round(0.0);
std::log2(0.0);
std::to_string(0);
}
$ ~/Android/toolchains/arm/bin/arm-linux-androideabi-clang++ -std=c++11 test.cpp
test.cpp:5:9: error: no member named 'nextafter' in namespace 'std'; did you mean simply 'nextafter'?
(void) std::nextafter(0.0, 0.0);
^~~~~~~~~~~~~~
nextafter
.../Android/toolchains/arm/bin/../sysroot/usr/include/math.h:245:8: note:
'nextafter' declared here
double nextafter(double, double) __NDK_FPABI_MATH__;
^
test.cpp:6:9: error: no member named 'round' in namespace 'std'; did you mean simply 'round'?
(void) std::round(0.0);
^~~~~~~~~~
round
.../Android/toolchains/arm/bin/../sysroot/usr/include/math.h:274:8: note:
'round' declared here
double round(double) __NDK_FPABI_MATH__;
^
test.cpp:7:2: error: no member named 'log2' in namespace 'std'; did you mean simply 'log2'?
std::log2(0.0);
^~~~~~~~~
log2
.../Android/toolchains/arm/bin/../sysroot/usr/include/math.h:240:8: note:
'log2' declared here
double log2(double) __NDK_FPABI_MATH__;
^
test.cpp:8:7: error: no member named 'to_string' in namespace 'std'
std::to_string(0);
~~~~~^
4 errors generated.
http://en.cppreference.com/w/cpp/numeric/math/nextafter http://en.cppreference.com/w/cpp/numeric/math/round http://en.cppreference.com/w/cpp/numeric/math/log2 http://en.cppreference.com/w/cpp/string/basic_string/to_string
Standalone toolchain created with:
$ ./build/tools/make-standalone-toolchain.sh --platform=android-24 --arch=arm --use-llvm --install-dir=$HOME/Android/toolchains/arm
There's probably a lot more. These are just the few I ran into.
Sounds like not a regression, so actually r13 since the solution is going to take quite a bit of effort to fix thanks to autoconf being bad: https://code.google.com/p/android/issues/detail?id=82734
Looks like std::to_string is still missing in r13 beta1. Will it make into the final r13?
Hope std::to_strong make into r13
It will not be in r13. The "fix" for this is that we're working on libc++ so gnustl becomes unnecessary. r14 is probably when that will be done. It's been the entire focus of r13, but there are a lot of intermediate tasks to getting it done.
Getting libc++ into shape depends on unified headers, which are going to take all of the r14 cycle.
@DanAlbert, sorry for spam, I want to know what feature of libc++_shared that is still missing to solve stack unwinding problem for either ice cream sandwich and gingerbread?
@kangjoni76: Are you referring to the exception handling issues mentioned in the Known Issues for the last few releases? libc++ (as implemented in the NDK) has more issues than that (see the warnings in the libc++ section of our docs).
As for the exception unwinding issues, the KI list looks like it was actually more general than the problem really is. It seems to affect only armeabi (doesn't affect arm7): https://android.googlesource.com/platform/ndk/+/master/tests/device/libcxx-unwind/test_config.py. Whether or not it still affects ICS is unknown, since I don't have an ICS device handy atm.
yes I was referring to that case. I couldn't move on from exiting r10e release. It's still unclear to me, perhaps shouldn't official wiki to provide complete tescase exception handling progress report on ARM especially for libc++_shared part, so that we could better know edge case part about this. https://developer.android.com/ndk/guides/cpp-support.html
Exception unwinding was broken in r10e too... In fact, it was much worse.
Actually, digging in to this to verify that it was broken in r10e, it looks like this was fixed some time during the development of r12 (the test was added early in r12). There was a misconfiguration in the test that was causing it to be skipped rather than reporting that a known failure was passing, which is why it didn't get removed from the known issues list.
I'll get the changelog updated to reflect this.
I'm still using gnustl_shared at r10e, well using qt5 5.6 qml is not c++ exception heavy code yet. But the Google project that is grpc in which I had filed an issue https://github.com/grpc/grpc/issues/7898 still showstopper. They might use many exception code as they will to deprecate non c++11 compiler. But thank you very much anyway for considering this.
Hello, I ran into the very same bug for the function snprintf (which is supposed to be part of std:: too) :) I'm on NDK version 13.1.3345770.
hi all,
I resolved the issues w.r.t. "'stoi' is not a member of 'std'" ,"stddef.h: No such file or directory"
with the following steps:
-
enter the directory "android-ndk-r13b/build/tools"
-
then get the toolchain using: sh make-standalone-toolchain.sh --arch=arm
--platform=android-16
--install-dir=/somewhere/Android-16_Toolchain
--stl=libc++ -
compile your c++11 .cpp file using the following command: /somewhere/Android-16_Toolchain/bin/arm-linux-androideabi-g++ -std=c++11
-isystem /somewhere/Android-16_Toolchain/include/c++/4.9.x/ -o test test.cpp -lc++_shared
libc++ covers the unsupported std:: functions by the default libgnustl, and "-isystem" resolves the header including problem.
Work for O ate all of r15's time, so this is going to have to wait for r16.
Okay, as of r16 libc++ is in good enough shape to recommend it. If you need these functions, migrate over to libc++.
Thanks for bearing with us on this one. Sorry it took so long!
@DanAlbert I get crashes in boost (something in their boost::exception code) with r15b LLVM STL that I do not get using GNU STL. I tried debugging it for a few hours but without proper backtraces in tombstones and inability to use ndk-gdb with CMake builds, I couldn't get very far. I'll try with r16 and see if it makes a difference. I'm hoping it was due to libc++ issues. Since you recommend it in r16 should be worth another try...
Sorry for the newbie request: how do I actually download the r16 beta? Thanks!
right now, r16 is only available as a continuous build: https://android.googlesource.com/platform/ndk/+/master/docs/ContinuousBuilds.md
when there's an "official" beta, it'll be available here: https://github.com/android-ndk/ndk/wiki
With latest canary build I still have issues that seem related to this issue. See: https://github.com/nodejs/node/issues/14771
You're still using gnustl in that. See https://github.com/android-ndk/ndk/issues/82#issuecomment-236979264