nodejs / nodejs/node

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

Offen
#61,794 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

build
Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.3k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
283

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Den x64-to-arm-Build mit den im Issue genannten configure- und make-Befehlen reproduzieren. Mit deps/v8/include/v8config.h und der generierten out/tools/v8_gypfiles/v8_libplatform.host.mk beginnen und anschließend nachvollziehen, warum Host-Objekte das ARM-Target-Makro erhalten. Erledigt ist die Aufgabe, wenn der unterstützte Cross-Build-Pfad sowie das erforderliche Guard- oder Build-Generierungsverhalten dokumentiert und verifiziert sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, javascript, linux
Bereich
build-system, compilers, operating-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.