Overview
This repo carries a set of community-maintained patches to cross-compile Node.js for Android. These patches are spread across multiple workflow steps and need to be revisited on every Node.js major version bump.
Current patches
Area
Patch
Upstream tracking
V8 stack tracing
stack_trace_posix.cc — stub backtrace symbols
nodejs/node#58505
V8 trap handler
Force V8_TRAP_HANDLER_SUPPORTED false
—
libuv
uv.gyp — include_dirs+ fix for Android
nodejs/node#57748
libuv
fs.c — #ifndef __ANDROID__ around FICLONE
nodejs/node#57748
libuv
uvwasi.c — skip Android in platform check
—
zlib
cpu_features.c — replace android_getCpuFeatures with getauxval
nodejs/node#57748
V8
v8config.h — std::atomic_ref polyfill for older NDK
—
V8
memcopy.h — use __atomic_store_n directly
—
V8
wasm-shuffle-reducer.cc — explicit template arg
—
V8
v8.gyp — add OS==android to clang conditions
—
V8
toolchain.gypi — v8_android_log_stdout=1, remove branch-protection
—
V8
globals.h — comment out tagged-size static_assert
—
V8
builtins-iterator-inl.h — static_assert → if constexpr
—
V8
SMI assertions in assembler.h — relaxed for cross-compile
—
gyp
ninja.py — `$
OBJ` variable for toolset-specific output dirs
gyp
common.gypi — remove android cpufeatures cflags
—
gyp
node.gyp — add OS==android to clang conditions
—
What needs to be done
Short-term
Test each patch against the latest Node.js v26.x HEAD — some may already be upstreamed or made obsolete
Split patches into individual files (.patch) instead of inline Python scripts for easier maintenance
Document which patches are from Termux, which are original, and which are upstream PRs
Medium-term
Upstream remaining patches to Node.js/V8 where feasible (see deps/ contribution rules)
Automate patch staleness detection — fail the build if a patch no longer applies
Add a patch for 32-bit ARM host-toolset -m32/-m64 conflict (see armeabi-v7a: 32-bit ARM cross-build is experimental #11 )
Long-term
Reduce patch count as upstream Node.js improves Android support (Cannot build node v22 and above Android with NDK 27 nodejs/node#58505 )
Evaluate switching to a proper cross-build SDK (e.g., Termux's build system) instead of maintaining patches in-house
Overview
This repo carries a set of community-maintained patches to cross-compile Node.js for Android. These patches are spread across multiple workflow steps and need to be revisited on every Node.js major version bump.
Current patches
stack_trace_posix.cc— stub backtrace symbolsV8_TRAP_HANDLER_SUPPORTED falseuv.gyp—include_dirs+fix for Androidfs.c—#ifndef __ANDROID__around FICLONEuvwasi.c— skip Android in platform checkcpu_features.c— replaceandroid_getCpuFeatureswithgetauxvalv8config.h—std::atomic_refpolyfill for older NDKmemcopy.h— use__atomic_store_ndirectlywasm-shuffle-reducer.cc— explicit template argv8.gyp— addOS==androidto clang conditionstoolchain.gypi—v8_android_log_stdout=1, remove branch-protectionglobals.h— comment out tagged-size static_assertbuiltins-iterator-inl.h—static_assert→if constexprassembler.h— relaxed for cross-compileninja.py— `$common.gypi— remove android cpufeatures cflagsnode.gyp— addOS==androidto clang conditionsWhat needs to be done
Short-term
.patch) instead of inline Python scripts for easier maintenanceMedium-term
deps/contribution rules)-m32/-m64conflict (see armeabi-v7a: 32-bit ARM cross-build is experimental #11)Long-term