Skip to content

Cannot build node v22 and above Android with NDK 27 #58505

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

Closed
AbdullahZughbi opened this issue May 29, 2025 · 2 comments · May be fixed by #58574
Closed

Cannot build node v22 and above Android with NDK 27 #58505

AbdullahZughbi opened this issue May 29, 2025 · 2 comments · May be fixed by #58574
Labels
android Issues and PRs related to the android platform. build Issues and PRs related to build files or the CI.

Comments

@AbdullahZughbi
Copy link

Version

22

Platform

Android

Subsystem

No response

What steps will reproduce the bug?

  • Download Android Studio with NDK
  • git clone https://github.com/nodejs/node.git
  • cd node
  • ./android-configure /home/abdullah/android-ndk/android-ndk-r27c 24 arm64, then make

How often does it reproduce? Is there a required condition?

All the time

What is the expected behavior? Why is that the expected behavior?

node builds successfully, and produce a libnode.so file in the output folder

What do you see instead?

  /home/abdullah/android-ndk/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++ -o /home/abdullah/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/debug/stack_trace.o ../deps/v8/src/base/debug/stack_trace.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_FILE_OFFSET_BITS=64' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DV8_TARGET_ARCH_ARM64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_ANDROID' '-DV8_EMBEDDER_STRING="-node.12"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DNDEBUG' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_USE_ZLIB' '-DV8_ENABLE_LEAPTIERING' '-DV8_ENABLE_SPARKPLUG' '-DV8_ENABLE_MAGLEV' '-DV8_ENABLE_TURBOFAN' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_ADVANCED_BIGINT_ALGORITHMS' '-DBUILDING_V8_BASE_SHARED' '-D_GLIBCXX_USE_C99_MATH' -I../deps/v8 -I../deps/v8/include -I../deps/v8/third_party/abseil-cpp  -Wno-unused-parameter -fno-omit-frame-pointer -fPIC -I../../../.gyp/sources/android/cpufeatures -fdata-sections -ffunction-sections -O2 -fno-rtti -fno-exceptions -fno-strict-aliasing -std=gnu++20 -Wno-invalid-offsetof -MMD -MF /home/abdullah/node/out/Release/.deps//home/abdullah/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/debug/stack_trace.o.d.raw   -c
  /home/abdullah/android-ndk/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++ -o /home/abdullah/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/division-by-constant.o ../deps/v8/src/base/division-by-constant.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_FILE_OFFSET_BITS=64' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DV8_TARGET_ARCH_ARM64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_ANDROID' '-DV8_EMBEDDER_STRING="-node.12"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DNDEBUG' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_USE_ZLIB' '-DV8_ENABLE_LEAPTIERING' '-DV8_ENABLE_SPARKPLUG' '-DV8_ENABLE_MAGLEV' '-DV8_ENABLE_TURBOFAN' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_ADVANCED_BIGINT_ALGORITHMS' '-DBUILDING_V8_BASE_SHARED' '-D_GLIBCXX_USE_C99_MATH' -I../deps/v8 -I../deps/v8/include -I../deps/v8/third_party/abseil-cpp  -Wno-unused-parameter -fno-omit-frame-pointer -fPIC -I../../../.gyp/sources/android/cpufeatures -fdata-sections -ffunction-sections -O2 -fno-rtti -fno-exceptions -fno-strict-aliasing -std=gnu++20 -Wno-invalid-offsetof -MMD -MF /home/abdullah/node/out/Release/.deps//home/abdullah/node/out/Release/obj.target/v8_libbase/deps/v8/src/base/division-by-constant.o.d.raw   -c
../deps/v8/src/base/debug/stack_trace_posix.cc:161:9: error: use of undeclared identifier 'backtrace_symbols'
  161 |         backtrace_symbols(trace, static_cast<int>(size)));
      |         ^
../deps/v8/src/base/debug/stack_trace_posix.cc:178:5: error: use of undeclared identifier 'backtrace_symbols_fd'
  178 |     backtrace_symbols_fd(trace, static_cast<int>(size),
      |     ^
../deps/v8/src/base/debug/stack_trace_posix.cc:390:32: error: use of undeclared identifier 'backtrace'; did you mean 'StackTrace'?
  390 |   count_ = static_cast<size_t>(backtrace(trace_, arraysize(trace_)));
      |                                ^
../deps/v8/src/base/debug/stack_trace.h:41:22: note: 'StackTrace' declared here
   41 | class V8_BASE_EXPORT StackTrace {
      |                      ^
3 errors generated.
make[1]: *** [tools/v8_gypfiles/v8_libbase.host.mk:193: /home/abdullah/node/out/Release/obj.host/v8_libbase/deps/v8/src/base/debug/stack_trace_posix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
rm 883452348be4cb58b1eb60a0572b382856e349c2.intermediate 4ff62ee4959a053aa13e9af93837146f5403ba3d.intermediate
make: *** [Makefile:135: node] Error 2
abdullah@Abdullah:~/node$

Additional information

No response

@bjohansebas bjohansebas added build Issues and PRs related to build files or the CI. android Issues and PRs related to the android platform. labels May 30, 2025
@AbdullahZughbi
Copy link
Author

Didn't respond?

@bnoordhuis
Copy link
Member

Android is self-serve (i.e. not a supported platform) but you can send a pull request updating tools/v8_gypfiles/v8.gyp to use stack_trace_android.cc instead of stack_trace_posix.cc.

It's quite possible you'll run into other build errors. You'll have to fix those yourself as well.

@bnoordhuis bnoordhuis closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2025
necm1 added a commit to necm1/node that referenced this issue Jun 4, 2025
This commit fixes a bug in the V8 engine as detailed in the linked issue. The change addresses the described behavior and ensures correct functionality as expected.

Fixes: nodejs#58505
necm1 added a commit to necm1/node that referenced this issue Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Issues and PRs related to the android platform. build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants