Repository navigation
Cannot build node v22 and above Android with NDK 27 #58505
Copy link
Copy link
Closed as not planned
Labels
androidIssues and PRs related to the Android platform.Issues and PRs related to the Android platform.buildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.
Description
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, thenmake
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
androidIssues and PRs related to the Android platform.Issues and PRs related to the Android platform.buildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.
Activity
AbdullahZughbi commentedon May 30, 2025
Didn't respond?
bnoordhuis commentedon Jun 3, 2025
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.
verdeandrius commentedon Jun 19, 2025
I'm trying the same, and also I'm getting stuck with this kind of errors. If you agree we could chat separately to share our findings and try to compile it properly (I'm trying to don't make spam here).
AbdullahZughbi commentedon Jun 24, 2025
Has the Android issue been fixed now?
I want to use Node.js to build native UI apps on Android. Is that possible now?
verdeandrius commentedon Jun 24, 2025
Under my understanding, it is not possible directly, the compilation process needs to be adjusted to compile for android to make NodeJs accesible via JNI, but I'm learning too so I can be wrong.
AbdullahZughbi commentedon Jun 24, 2025
Try this:
By the way, will there be an official Node.js release for Android in the future?
Maybe try using a
.nodefile with JNI?For context, I started learning Node.js with discord.js, HTML, CSS, JavaScript, and EJS in October 2023.
bnoordhuis commentedon Jun 24, 2025
Unlikely, for reasons of testing/maintenance/etc. Will only happen if enough people spend enough time to make it viable.
AbdullahZughbi commentedon Jun 25, 2025
Ok
build: fix android build