Skip to main content

Core Dependencies

These dependencies are required for all platforms:
The build system requires Python to run x.py.
Verify Python Installation
python --version
# or
python3 --version
The version of Python used to execute x.py will be used throughout the build process.
Required for cloning the repository and managing submodules.
Clone Rust Repository
git clone https://github.com/rust-lang/rust.git
cd rust
The build system can automatically manage git submodules by setting build.submodules = true in bootstrap.toml (this is the default).
A C compiler is needed for building native dependencies and LLVM.
  • Unix/Linux: cc or gcc
  • macOS: Xcode Command Line Tools
  • Windows: MSVC or MinGW GCC
When cross-compiling, you may need additional compilers for the target platform.
Used for downloading dependencies. Not required on Windows.
Install on Debian/Ubuntu
sudo apt-get install curl
Install on macOS
# Usually pre-installed
brew install curl

Linux-Specific Dependencies

When compiling on Linux and targeting Linux:
sudo apt-get update
sudo apt-get install \
  build-essential \
  curl \
  git \
  python3 \
  pkg-config \
  libssl-dev

Package Details

PackagePurpose
pkg-configRequired when compiling on and targeting Linux
libiconvAlready included with glibc on most distributions
libssl-dev / openssl-develRequired for building Cargo

LLVM Build Dependencies

You can skip building LLVM by setting llvm.download-ci-llvm = true in bootstrap.toml for tier 1 or tier 2 platforms with host tools. This significantly speeds up the build process.
If building LLVM from source, you’ll need:
A modern C++ compiler:
Check LLVM’s documentation for specific version requirements, as they change with each LLVM release.
For tier 1 and tier 2 platforms with host tools, you can download pre-built LLVM instead of building from source:
bootstrap.toml
[llvm]
# Download LLVM if available, otherwise build from source
download-ci-llvm = "if-unchanged"

# Always download LLVM (faster builds)
# download-ci-llvm = true
Benefits:
  • Much faster builds - Skip hours of LLVM compilation
  • Less disk space - No need for LLVM source tree
  • Fewer dependencies - Don’t need C++ compiler for LLVM
After setting download-ci-llvm = true, you can deinitialize the LLVM submodule to save space:
git submodule deinit src/llvm-project

Using System LLVM

Alternatively, you can use LLVM installed on your system:
bootstrap.toml
[target.x86_64-unknown-linux-gnu]
llvm-config = "/usr/bin/llvm-config"
See the rustc-dev-guide for more information about using pre-built LLVM.

Optional Dependencies

Speed up rebuilds by caching compiler outputs:
Install ccache
# Debian/Ubuntu
sudo apt-get install ccache

# macOS
brew install ccache
Enable in bootstrap.toml:
[build]
ccache = true
# or specify path
ccache = "/usr/bin/ccache"
Required only for running the debuginfo test suite:
bootstrap.toml
[build]
gdb = "gdb"
lldb = "lldb"
Only needed when running tests for the emscripten target:
bootstrap.toml
[build]
nodejs = "node"
Required for rustdoc-gui tests and tidy js extra-checks:
bootstrap.toml
[build]
# On Windows, use yarn.cmd
yarn = "yarn"

Verifying Dependencies

Before starting the build, verify all dependencies are available:
Dependency Check
# Core tools
python3 --version
git --version
cc --version

# For building LLVM
cmake --version
ninja --version

# For Cargo
pkg-config --version

Platform-Specific Guides

Unix/Linux

Complete setup for Unix-like systems

Windows

Complete setup for Windows (MSVC and MinGW)

Build docs developers (and LLMs) love