nodejs / nodejs/node

Cross-build x64 host -> arm target fails in V8 host arch guard (v8config.h)

Aperta
#61,794 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

build
Lingua principale
JavaScript
Stelle
122k
Fork
37.3k
Merge medio
4g 2h
PR unite (30g)
283

Descrizione

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-snapshot does 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)?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre la build x64-to-arm con i comandi configure e make indicati nell’issue. Iniziare da deps/v8/include/v8config.h e dal file generato out/tools/v8_gypfiles/v8_libplatform.host.mk, quindi tracciare il motivo per cui gli oggetti host ricevono la macro target ARM. Il lavoro è completato quando il percorso di cross-build supportato e il guard richiesto o il comportamento di generazione della build sono documentati e verificati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, javascript, linux
Ambito
build-system, compilers, operating-systems
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.