ABI Selection
Windows has two prominent ABIs (Application Binary Interfaces):MSVC ABI
Native Windows ABI
- Used by Visual Studio
- Best for Windows-specific development
- Interoperates with MSVC-built libraries
- Recommended for most users
GNU ABI
MinGW/GCC Toolchain
- Uses GNU toolchain (GCC)
- Better for cross-platform code
- Interoperates with MinGW-built libraries
- Good for Unix-style development on Windows
Choose the ABI based on which C/C++ libraries you need to interoperate with. You can build both if needed.
Available Build Triples
- GNU ABI (GCC)
- MSVC ABI
i686-pc-windows-gnu(32-bit)x86_64-pc-windows-gnu(64-bit)
bootstrap.toml:
Building with MSVC
Install Visual Studio
Install Visual Studio 2022 or later with C++ build tools:
- Download Visual Studio
- Run the installer
- Select “Desktop development with C++” workload
- Include Windows 10 or 11 SDK
Visual Studio 2019 may work but is not actively tested. Visual Studio 2022 or later is recommended.
Troubleshooting MSVC Builds
Visual Studio Version Not Detected
Visual Studio Version Not Detected
If bootstrap doesn’t detect your Visual Studio version, manually call the vcvars script:For Visual Studio 2019:
Slow Performance During Build
Slow Performance During Build
Several tips to improve build speed:
-
Disable Windows Defender Real-Time Protection (temporarily)
- Note: It will re-enable automatically after some time
-
Use native Windows Python instead of MSYS2 Python
- Can help with LLVM build issues
-
Use Git for Windows instead of MSYS2 Git
- Often much faster for git operations
-
Download pre-built LLVM:
Linker Errors
Linker Errors
If you encounter linker errors, ensure:
- Visual Studio is properly installed with C++ tools
- Windows SDK is installed
- You’re running from a Visual Studio command prompt, or vcvars is called
Building with MinGW (MSYS2)
Install MSYS2
- Download the latest MSYS2 installer
- Run the installer and follow the instructions
- Complete the installation to
C:\msys64(default)
Install Git for Windows
Download and install Git for Windows:
- Install Git for Windows
- Ensure it’s in your Windows PATH
- Edit
C:\msys64\mingw64.ini(ormingw32.inifor 32-bit) - Uncomment:
MSYS2_PATH_TYPE=inherit
Install Build Tools
Start a MINGW64 or MINGW32 shell (from start menu or by running Install build tools:
C:\msys64\mingw64.exe).Update package mirrors:- 64-bit
- 32-bit
MinGW Build Tips
Advanced Configuration
Multi-Target Build
Multi-Target Build
Build for both MSVC and GNU targets:Build with:
bootstrap.toml
Optimized Build Configuration
Optimized Build Configuration
bootstrap.toml
Cross-Compiling Between ABIs
Cross-Compiling Between ABIs
To use GNU ABI from PowerShell or MSVC ABI from MINGW:
Building Documentation
Build Rust documentation:Testing Your Build
Common Issues
Python Not Found
Python Not Found
Ensure Python is in your PATH:
Git Submodule Errors
Git Submodule Errors
Update submodules:
Long Path Issues
Long Path Issues
Windows has a 260-character path limit by default. Enable long paths:
- Run as Administrator:
- Or use Group Policy Editor (gpedit.msc):
- Computer Configuration → Administrative Templates → System → Filesystem
- Enable “Enable Win32 long paths”
Out of Memory
Out of Memory
Reduce parallel jobs:Or limit LLVM linker jobs:
Next Steps
Configuration Options
Explore all available build configuration options
Dependencies Reference
Detailed dependency information