Building for Windows
- Download
uv,choco, andrustup- Be sure to select Quick install via the Visual Studio Community installer
- In the Visual Studio Installer, ensure the following components are installed:
- Windows 10/11 SDK (anything >= 10.0.19041.0) (
Microsoft.VisualStudio.Component.Windows{10, 11}SDK.{>=19041}) - MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) (
Microsoft.VisualStudio.Component.VC.Tools.x86.x64) - C++ ATL for latest v143 build tools (x86 & x64) (
Microsoft.VisualStudio.Component.VC.ATL)
- Windows 10/11 SDK (anything >= 10.0.19041.0) (
- Restart your shell to make sure
cargois available - Install the other dependencies:
.\mach bootstrap - Build servoshell:
.\mach build
We don’t recommend having more than one version of Visual Studio installed. Servo will try to search for the appropriate version of Visual Studio, but having only a single version installed means fewer things can go wrong.
Troubleshooting
Be sure to look at the General Troubleshooting section if you have trouble with your build and your problem is not listed below.
Cannot run mach in a path on a case-sensitive file system on Windows.
- Open a command prompt or PowerShell as administrator (Win+X, A)
- Disable case sensitivity for your Servo repo:
fsutil file SetCaseSensitiveInfo X:\path\to\servo disable
Could not find DLL dependency: api-ms-win-crt-runtime-l1-1-0.dllDLL file `api-ms-win-crt-runtime-l1-1-0.dll` not found!
Find the path to Redist\ucrt\DLLs\x64\api-ms-win-crt-runtime-l1-1-0.dll, e.g. C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64\api-ms-win-crt-runtime-l1-1-0.dll.
Then set the WindowsSdkDir environment variable to the path that contains Redist, e.g. C:\Program Files (x86)\Windows Kits\10.
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [(C:\\Program Files\\LLVM\\bin\\libclang.dll: invalid DLL (64-bit))])"', C:\Users\me\.cargo\registry\src\...
rustup may have been installed with the 32-bit default host, rather than the 64-bit default host needed by Servo.
Check your default host with rustup show, then set the default host:
> rustup set default-host x86_64-pc-windows-msvc
ERROR: GetShortPathName returned a long path name: `C:/PROGRA~2/Windows Kits/10/`. Use `fsutil file setshortname' to create a short name for any components of this path that have spaces.
SpiderMonkey (mozjs) requires 8.3 filenames to be enabled on Windows (#26010).
- Open a command prompt or PowerShell as administrator (Win+X, A)
- Enable 8.3 filename generation:
fsutil behavior set disable8dot3 0 - Uninstall and reinstall whatever contains the failing paths, such as Visual Studio or the Windows SDK — this is easier than adding 8.3 filenames by hand
= note: lld-link: error: undefined symbol: __std_search_1 >>> referenced by D:\a\mozjs\mozjs\mozjs-sys\mozjs\intl\components\src\NumberFormatterSkeleton.cpp:157
Issues like this can occur when mozjs is upgraded, as the update may depend on newer MSVC (remember we require “Latest” in set up your environment!). To resolve it, launch the Visual Studio Installer and apply all available updates.