Compiler V8 sous Linux Arm64

31 juil. 2025

Comme vous le savez peut-être, développer depuis une machine Linux avec un CPU aarch64 n'est pas si commun, sans exception pour le moteur JavaScript V8. Il supporte officiellement la compilation depuis un hôte MacOS avec un CPU Apple Silicon mais pas depuis un Linux aarch64. Comme ma situation actuelle implique de travailler depuis une VM Linux en aarch64, voici comment j'ai fait :

TL;DR

  • Télécharger LLVM depuis https://github.com/llvm/llvm-project/releases et l'extraire
  • Lancer gn gen avec les arguments suivants is_debug=true target_os="linux" target_cpu="arm64" v8_enable_temporal_support=false enable_rust=false clang_base_path="/home/user/Downloads/LLVM-21.1.0-rc2-Linux-ARM64" clang_use_chrome_plugins=false
curl https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.0-rc2/LLVM-21.1.0-rc2-Linux-ARM64.tar.xz -o /home/user/Downloads/LLVM-21.1.0-rc2-Linux-ARM64.tar.xz
cd /home/user/Downloads && tar xvf LLVM-21.1.0-rc2-Linux-ARM64.tar.xz
cd /home/user/v8/v8
gn gen out/debug --args='is_debug=true target_os="linux" target_cpu="arm64" v8_enable_temporal_support=false enable_rust=false clang_base_path="/home/user/Downloads/LLVM-21.1.0-rc2-Linux-ARM64" clang_use_chrome_plugins=false'
ninja -C out/debug d8

Sur ma VM Qemu avec 8 coeurs et 16GB de RAM, la compilation prend environ 32 minutes.