Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Compile Error #22499

Closed
ghost opened this issue Aug 24, 2018 · 7 comments
Closed

Android Compile Error #22499

ghost opened this issue Aug 24, 2018 · 7 comments
Labels
v8 engine Issues and PRs related to the V8 dependency.

Comments

@ghost
Copy link

ghost commented Aug 24, 2018

  • Version: v10.9.0
  • Platform: Android
/home/rsplwe/node_build/node-v10.9.0/android-toolchain/bin/arm-linux-androideabi-g++ '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=0' '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DCAN_USE_VFP3_INSTRUCTIONS' '-DCAN_USE_VFP32DREGS' '-DV8_EMBEDDER_STRING="-node.14"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT' '-Dv8_promise_internal_field_count' '-DV8_INTL_SUPPORT' '-DV8_CONCURRENT_MARKING' '-DDISABLE_UNTRUSTED_CODE_MITIGATIONS' '-DANTLR4CPP_STATIC' -I../deps/v8/third_party/antlr4/runtime/Cpp/runtime/src -I../deps/v8/src/torque -I../deps/v8  -Wall -Wextra -Wno-unused-parameter -march=armv7-a -mfpu=vfpv3 -marm -fdata-sections -ffunction-sections -O2 -fno-omit-frame-pointer -fPIE -std=gnu++1y -MMD -MF /home/rsplwe/node_build/node-v10.9.0/out/Release/.deps//home/rsplwe/node_build/node-v10.9.0/out/Release/obj.host/torque/deps/v8/src/torque/ast-generator.o.d.raw  -I/home/rsplwe/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/include -I/home/rsplwe/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libcxx/include -fPIE -pie  -c -o /home/rsplwe/node_build/node-v10.9.0/out/Release/obj.host/torque/deps/v8/src/torque/ast-generator.o ../deps/v8/src/torque/ast-generator.cc
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 v8::internal::torque::SourceFileMap::PositionAsString(v8::internal::torque::SourcePosition)':
../deps/v8/src/torque/ast.h:199:42: error: 'to_string' is not a member of 'std'
     return GetSource(pos.source) + ":" + std::to_string(pos.line) + ":" +
                                          ^
../deps/v8/src/torque/ast.h:200:12: error: 'to_string' is not a member of 'std'
            std::to_string(pos.column);
            ^
In file included from ../deps/v8/src/torque/global-context.h:10:0,
                 from ../deps/v8/src/torque/ast-generator.h:10,
                 from ../deps/v8/src/torque/ast-generator.cc:8:
../deps/v8/src/torque/declarable.h: In constructor 'v8::internal::torque::Label::Label(const string&)':
../deps/v8/src/torque/declarable.h:163:44: error: 'to_string' is not a member of 'std'
         generated_("label_" + name + "_" + std::to_string(next_id_++)),
                                            ^
In file included from ../deps/v8/src/torque/declarations.h:11:0,
                 from ../deps/v8/src/torque/global-context.h:11,
                 from ../deps/v8/src/torque/ast-generator.h:10,
                 from ../deps/v8/src/torque/ast-generator.cc:8:
../deps/v8/src/torque/scope.h: In member function 'void v8::internal::torque::Scope::Stream(std::ostream&) const':
../deps/v8/src/torque/scope.h:26:27: error: 'to_string' is not a member of 'std'
     stream << "scope " << std::to_string(scope_number_) << " {";
                           ^
deps/v8/gypfiles/torque.host.mk:276: recipe for target '/home/rsplwe/node_build/node-v10.9.0/out/Release/obj.host/torque/deps/v8/src/torque/ast-generator.o' failed
make[1]: *** [/home/rsplwe/node_build/node-v10.9.0/out/Release/obj.host/torque/deps/v8/src/torque/ast-generator.o] Error 1
rm 384f9c5c253bbc588c63d66c04a230edc0a146b5.intermediate 29f598d02843dc7efafdbc9308c6852050dc9336.intermediate
Makefile:87: recipe for target 'node' failed
make: *** [node] Error 2
@addaleax addaleax added the v8 engine Issues and PRs related to the V8 dependency. label Aug 24, 2018
@addaleax
Copy link
Member

Since nobody has weighed in here … @Rsplwe this problem is most likely caused either because your system headers don’t provide std::to_string, even though it is part of C++11, or because there is some header file named string that gets included by accident.

I’m not sure how to address any of this, and it probably requires some digging around in your header files. Having the preprocessed source for one of the failing compile commands might help?

@ghost
Copy link
Author

ghost commented Aug 28, 2018

@addaleax I built with ndk according to the documentation's build method.

@lundibundi
Copy link
Member

@Rsplwe Ok, so I've found this android/ndk#82 and https://stackoverflow.com/questions/22774009/android-ndk-stdto-string-support which tells us that android-ndk uses 'gnustl' cpp lib by default which doens't include some functions (std::to_string) in particular.
Therefore you have a few options here that are dependent on your situation:

  • Use libc++ std library for ndk (just LOCAL_CFLAGS := -std=c++11 in Android.mk should work, otherwise refer to https://developer.android.com/ndk/guides/cpp-support)
  • implement your own/copy from somewhere to_string (and possibly other functions) in project-local-file

Also, libc++ will soon (ndk r18) be the default and the gnustl will be removed completely (https://developer.android.com/ndk/guides/cpp-support).

@addaleax
Copy link
Member

addaleax commented Sep 6, 2018

@Rsplwe Does @lundibundi’s answer help you?

@ghost
Copy link
Author

ghost commented Sep 7, 2018

@lundibundi thank you

@lundibundi
Copy link
Member

I think this is resolved based on @Rsplwe comment. If you experience any more problems feel free to reopen.

@sruetzler
Copy link

@Rsplwe
How did you solve the problem?
I was not able to build nodejs for android. Even with the ndk 18 or with the -std=c++11 flags and something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

3 participants