0

Android ndk r15c compiled node.js error: 'to_string' is not a member of 'std'

I use the (doc) method to build using ndk, this problem has occurred, after google After searching and issues, I got the message android-ndk uses gnustl cpp lib by default which doesn't include some functions (std::to_string) in particular., then I put the common.gypi file inside The gnu++1y was changed to c++11 and it still didn't work.

In file included from ../deps/v8/src/torque/ast-generator.h:9:0,
             from ../deps/v8/src/torque/ast-generator.cc:8:
../deps/v8/src/torque/ast.h: In member function 'std::string' 
Prashant Gupta
  • 791
  • 8
  • 26
Rsplwe
  • 1
  • 1
  • 2
    Possible duplicate of [android-ndk: stoi / stof / stod / to\_string is not a member of 'std'](https://stackoverflow.com/questions/42051279/android-ndk-stoi-stof-stod-to-string-is-not-a-member-of-std) See 1st answer looks like it was not fixed until NDK r16 – Richard Critten Oct 04 '18 at 08:53

1 Answers1

0

then I put the common.gypi file inside The gnu++1y was changed to c++11 and it still didn't work.

That flag controls your C++ standard version, not your STL.

If you update to r17/r18 you'll get libc++ by default. Otherwise:

https://github.com/nodejs/node/blob/master/android-configure#L43

You need to add --stl=libc++ to that command. I'd strongly recommend updating to r16 at least though, since libc++ wasn't really ready for production use until then.

Dan Albert
  • 9,365
  • 2
  • 34
  • 76
  • In file included from /home/rsplwe/dev/node/node-v10.11.0/android-toolchain/include/c++/4.9.x/type_traits:390:0, from ../deps/v8/src/base/bits.h:9, from ../deps/v8/src/base/bits.cc:5: /home/rsplwe/dev/node/node-v10.11.0/android-toolchain/include/c++/4.9.x/cstddef:44:25: fatal error: stddef.h: No such file or directory #include_next ^ compilation terminated. – Rsplwe Oct 06 '18 at 02:08
  • That's usually the case when either the compiler is being invoked improperly (incorrectly ordered `-I` or `-isystem` arguments) or when the project has its own copies of things like stddef.h that are used improperly as in the former case. – Dan Albert Oct 08 '18 at 18:51