From f38b4c65778d718397e5220666366c42ac7a8bcf Mon Sep 17 00:00:00 2001 From: StefanStojanovic Date: Wed, 23 Apr 2025 12:53:31 +0200 Subject: [PATCH 1/2] doc,build,win: update docs with clang Updated BUILDING.md to make ClangCL mandatory for new versions of Node. Forcing clang-cl flag in vcbuild if not specified, thus disabling MSVC. --- BUILDING.md | 12 ++++-------- tools/bootstrap/windows_boxstarter | 2 +- vcbuild.bat | 8 ++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index a6004eb45d370e..2af5d760d65f0c 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -640,7 +640,10 @@ Refs: [Visual Studio 2022 (17.6 or newer)](https://visualstudio.microsoft.com/downloads/) or the "C++ build tools" workload from the [Build Tools](https://aka.ms/vs/17/release/vs_buildtools.exe), - with the default optional components + with the default optional components. Starting with Node.js v24, ClangCL is required to compile + on Windows. To enable it, two additional components are needed: + * C++ Clang Compiler for Windows (Microsoft.VisualStudio.Component.VC.Llvm.Clang) + * MSBuild support for LLVM toolset (Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset) * Basic Unix tools required for some tests, [Git for Windows](https://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. @@ -664,13 +667,6 @@ Optional requirements for compiling for Windows on ARM (ARM64): * Visual C++ ATL for ARM64 * Windows 10 SDK 10.0.17763.0 or newer -Optional requirements for compiling with ClangCL (search for `clang` in Visual Studio -Installer's "individual component" tab): - -* Visual Studio individual components - * C++ Clang Compiler for Windows - * MSBuild support for LLVM toolset - NOTE: Currently we only support compiling with Clang that comes from Visual Studio. When building with ClangCL, if the output from `vcbuild.bat` shows that the components are not installed diff --git a/tools/bootstrap/windows_boxstarter b/tools/bootstrap/windows_boxstarter index 00ac4a0b711004..fc860180aab36f 100644 --- a/tools/bootstrap/windows_boxstarter +++ b/tools/bootstrap/windows_boxstarter @@ -18,7 +18,7 @@ choco install python3 -y # Installs VS 2022 Build Tools choco install visualstudio2022buildtools -y -choco install visualstudio2022-workload-vctools -y --params="--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64" +choco install visualstudio2022-workload-vctools -y --params="--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --add Microsoft.NetCore.Component.SDK --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset" # NASM choco install nasm -y diff --git a/vcbuild.bat b/vcbuild.bat index 532ee7a0b67465..63ddd4b2be8b74 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -237,6 +237,14 @@ if errorlevel 1 echo Could not find NASM, install it or build with openssl-no-as call :getnodeversion || exit /b 1 +@REM Forcing ClangCL usage for version 24 and above +set NODE_MAJOR_VERSION= +for /F "tokens=1 delims=." %%i in ("%NODE_VERSION%") do set "NODE_MAJOR_VERSION=%%i" +if %NODE_MAJOR_VERSION% GEQ 24 ( + echo Using ClangCL for version 24 and above is mandatory. + set clang_cl=1 +) + if defined TAG set configure_flags=%configure_flags% --tag=%TAG% if not "%target%"=="Clean" goto skip-clean From f8bce751bbbd621610a3751334b48fbd4fd152b4 Mon Sep 17 00:00:00 2001 From: Stefan Stojanovic Date: Thu, 24 Apr 2025 09:38:46 +0200 Subject: [PATCH 2/2] Update vcbuild.bat Co-authored-by: Joyee Cheung --- vcbuild.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcbuild.bat b/vcbuild.bat index 63ddd4b2be8b74..9c21c390346094 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -241,7 +241,7 @@ call :getnodeversion || exit /b 1 set NODE_MAJOR_VERSION= for /F "tokens=1 delims=." %%i in ("%NODE_VERSION%") do set "NODE_MAJOR_VERSION=%%i" if %NODE_MAJOR_VERSION% GEQ 24 ( - echo Using ClangCL for version 24 and above is mandatory. + echo Using ClangCL because the Node.js version being compiled is >= 24. set clang_cl=1 )