Publish a release with 16 KB page-size support (from main / PR #154)
epsylon · 2026-07-26T06:37:35Z · open
What is the problem this feature will solve?
Google Play now hard-blocks apps targeting SDK 35+ unless their native libraries
are 16 KB page-size aligned. nodejs-mobile's latest published release (v18.20.4)
was built before the 16 KB alignment fix (#148 / PR #154, merged into main on
2025-11-13), so its libnode.so has 4 KB-aligned ELF segments and Play rejects it.
Anyone shipping a Node.js-Mobile app to Play is currently blocked
What is the feature you are proposing to solve the problem?
Please cut a tagged release (or attach official prebuilt binaries) built from
current main, which already includes the max-page-size=16384 build flag.
What alternatives have you considered?
I built current main for Android arm64 and can confirm it produces a correctly
16 KB-aligned libnode.so — readelf -l shows the LOAD segments at align 2**14 —
and it runs fine on-device (Node 18.20.4, all modules load, no crashes).
Verification for a produced .so:
readelf -l libnode.so | grep -A1 LOAD # must show 0x4000 (16384)
zipalign -c -P 16 -v 4 app.apk # must say "Verification successful"
A release from main would unblock everyone targeting recent Android/Play. Thanks!
epsylon · 2026-07-26T06:49:21Z
Follow-up with the exact change I needed to build current main for Android
arm64 successfully — in case it helps when cutting the release, since a plain
build from main fails on my side.
Blocker: host compiler is hardcoded to g++, which ICEs on V8
android_configure.py forces the host toolchain to gcc/g++:
# nodejs-mobile patch: add host CC and CXX
os.environ['CC_host'] = os.popen('command -v gcc').read().strip()
os.environ['CXX_host'] = os.popen('command -v g++').read().strip()
With host g++ 12, building V8's host tools dies with `internal compiler error:
Segmentation fault` (marking-barrier.cc, cpp-heap, effect-control-linearizer…).
Making the host compiler overridable fixes it — non-breaking, defaults unchanged:
-# nodejs-mobile patch: add host CC and CXX
-os.environ['CC_host'] = os.popen('command -v gcc').read().strip()
-os.environ['CXX_host'] = os.popen('command -v g++').read().strip()
+# nodejs-mobile patch: add host CC and CXX.
+# Respect CC_host/CXX_host if already set (e.g. CC_host=clang), since some host
+# g++ versions ICE while building V8's host tools. Default to gcc/g++ when unset.
+os.environ.setdefault('CC_host', os.popen('command -v gcc').read().strip())
+os.environ.setdefault('CXX_host', os.popen('command -v g++').read().strip())
Build that produced a working, 16 KB-aligned libnode.so
Using the NDK's own host clang avoids the g++ ICE:
export CC_host=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
export CXX_host=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
export LDFLAGS='-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384'
./android-configure "$NDK" 24 arm64
make -C out BUILDTYPE=Release libnode -j2
Notes:
- On low-RAM hosts without swap, V8's host compilation can OOM at high
-j;
capping parallelism avoids it.
- Result:
readelf -l out/Release/libnode.soshows LOAD segments at
align 2**14 (16 KB), and it runs fine on-device (Node 18.20.4).libc++_shared.so from recent NDKs (r27+) is already 16 KB-aligned.
Happy to open a PR for the android_configure.py change if that's useful —
kept it here since the diff is tiny.