Skip to content

Android cross-compilation patch maintenance tracking #12

Description

@Towartz

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.gypinclude_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.hstd::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.gypiv8_android_log_stdout=1, remove branch-protection
V8 globals.h — comment out tagged-size static_assert
V8 builtins-iterator-inl.hstatic_assertif 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

  1. Test each patch against the latest Node.js v26.x HEAD — some may already be upstreamed or made obsolete
  2. Split patches into individual files (.patch) instead of inline Python scripts for easier maintenance
  3. Document which patches are from Termux, which are original, and which are upstream PRs

Medium-term

  1. Upstream remaining patches to Node.js/V8 where feasible (see deps/ contribution rules)
  2. Automate patch staleness detection — fail the build if a patch no longer applies
  3. 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

  1. Reduce patch count as upstream Node.js improves Android support (Cannot build node v22 and above Android with NDK 27 nodejs/node#58505)
  2. Evaluate switching to a proper cross-build SDK (e.g., Termux's build system) instead of maintaining patches in-house

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions