Cross-build x64 host -> arm target fails in V8 host arch guard (v8config.h)
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
Summary
Cross-building Node.js for --dest-cpu=arm (32-bit ARM / armhf) from an x64 Linux host fails in V8 host object compilation due to a host/target architecture guard in deps/v8/include/v8config.h.
Environment
- Host: Ubuntu 24.04 x86_64
- Target: Raspberry Pi 3, 32-bit Raspbian Buster (armhf)
- Cross toolchain:
arm-linux-gnueabihf-*
Repro
From x64 host:
./configure \
--dest-os=linux \
--dest-cpu=arm \
--cross-compiling \
--with-arm-float-abi=hard \
--with-arm-fpu=neon \
--without-node-snapshot
make -j1
Failure
Host V8 compilation fails with:
#error Target architecture arm is only supported on arm and ia32 host
Coming from deps/v8/include/v8config.h:
#if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
#error Target architecture arm is only supported on arm and ia32 host
#endif
In generated host makefiles (for example out/tools/v8_gypfiles/v8_libplatform.host.mk), host objects are compiled with -DV8_TARGET_ARCH_ARM, which triggers this guard on x64 hosts.
Notes
--without-node-snapshotdoes not avoid this, as host V8 objects are still built with ARM target macros.- A local workaround changing the guard to include x64 host allows compilation to proceed:
-#if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
+#if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM || V8_HOST_ARCH_X64))
Request
What is the intended/supported path for x64-host -> arm-target cross-builds in current Node/V8?
If this should be supported, could build generation be adjusted so host-side V8 tools/objects do not fail this guard (or guard logic updated in a supported way)?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 issue 中的 configure 和 make 命令重现 x64-to-arm 构建。先从 deps/v8/include/v8config.h 和生成的 out/tools/v8_gypfiles/v8_libplatform.host.mk 开始,然后追踪 host 对象为何会接收到 ARM 目标宏。完成的标准是:已记录并验证受支持的 cross-build 路径,以及所需的 guard 或构建生成行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- cpp, javascript, linux
- 领域
- build-system, compilers, operating-systems
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100