Repository navigation
Cross compile node v14.x or v.15.x for android x86_64 #36287
Description
Activity
Any chance this is related to #35520?
- addedandroidIssues and PRs related to the Android platform.Issues and PRs related to the Android platform.
on Nov 28, 2020 I think it's not related, this is more about the linker when building the objects: mksnapshot and the v8_base_without_compiler. I suspect that the handler-inside-posix.o and handler-outside-posix.o is not compiled wiith the v8_base_without_compiler
But when I hard-code to include these objects, It shown a lot of other errors on both the target and host output. I still don't know why.
Btw, I'm new with build systems like GN and GYP. Any hints are welcome.
Thank you.
This seems to have become a 64 bit problem somewhere between 16.10.10 and 16.11.0
See termux/termux-packages#7710. node v16.10.10 compiles for Android aarch64 but not v16.11.0
Reacted by Hirokazu MORIKAWAUpdate, I was able to fix this error by using this patch
--- ./deps/v8/src/trap-handler/trap-handler.h 2021-10-08 19:08:46.000000000 +0530 +++ ./deps/v8/src/trap-handler/trap-handler.h.mod 2021-10-09 19:43:08.715641214 +0530 @@ -17,22 +17,7 @@ namespace internal { namespace trap_handler { -// X64 on Linux, Windows, MacOS, FreeBSD. -#if V8_HOST_ARCH_X64 && V8_TARGET_ARCH_X64 && \ - ((V8_OS_LINUX && !V8_OS_ANDROID) || V8_OS_WIN || V8_OS_MACOSX || \ - V8_OS_FREEBSD) -#define V8_TRAP_HANDLER_SUPPORTED true -// Arm64 (non-simulator) on Mac. -#elif V8_TARGET_ARCH_ARM64 && V8_HOST_ARCH_ARM64 && V8_OS_MACOSX -#define V8_TRAP_HANDLER_SUPPORTED true -// Arm64 simulator on x64 on Linux or Mac. -#elif V8_TARGET_ARCH_ARM64 && V8_HOST_ARCH_X64 && (V8_OS_LINUX || V8_OS_MACOSX) -#define V8_TRAP_HANDLER_VIA_SIMULATOR -#define V8_TRAP_HANDLER_SUPPORTED true -// Everything else is unsupported. -#else #define V8_TRAP_HANDLER_SUPPORTED false -#endif // Setup for shared library export. #if defined(BUILDING_V8_SHARED) && defined(V8_OS_WIN)Reacted by Hirokazu MORIKAWA, Seven Lju, Andrey Hohutkin and ZephrysI patched the nodejs on our x86_64 platform and have used it for a year without any problem. Currently, I no longer maintain the build, so I can not help you to test it. Anyway, thanks for your fix @thunder-coding
- addedbuildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.
on Oct 21, 2021 api.cc
- added a commit that references this issue
on Sep 12, 2022 - added 3 commits that reference this issue
on Sep 26, 2022 - added 2 commits that reference this issue
on Jan 3, 2023 github-actions commented
on Jun 27, 2026 on Jun 27, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jun 27, 2026 github-actions commented
on Jul 28, 2026 on Jul 28, 2026 – with GitHub ActionsContributorMore actionsThis issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.- added a commit that references this issue
on Jul 31, 2026 - added a commit that references this issue
on Sep 13, 2026
What steps will reproduce the bug?
The Android NDK version: Linux 64-bit (x86) r21, download from https://developer.android.com/ndk/downloads
How often does it reproduce? Is there a required condition?
The build always stuck as below state.
What is the expected behavior?
Build without error
What do you see instead?
Additional information
I noted that in v8_base_without_compiler build config at deps/v8/BUILD.gn, EnableTrapHandler and RegisterDefaultTrapHandler are defined for Linux and x64 platform, but I don't see it generated in out/tools/v8_gypfiles/v8_base_without_compiler.target(host).mk (even I change the condition to always true)
I wonder is this an expected behavior?
I fixed it temporarily by disabling undefined code paths and the node can work normally in the target platform.
I wonder if there are any further issues if I do this.
Thanks