Home Explore Blog CI



rustc

src/building/prerequisites.md
95e93d17ff107b0b9e4230e73b3614af7a60ac230892e5d7000000030000074e
# Prerequisites

## Dependencies

See [the `rust-lang/rust` INSTALL](https://github.com/rust-lang/rust/blob/master/INSTALL.md#dependencies).

## Hardware

You will need an internet connection to build. The bootstrapping process
involves updating git submodules and downloading a beta compiler. It doesn't
need to be super fast, but that can help.

There are no strict hardware requirements, but building the compiler is
computationally expensive, so a beefier machine will help, and I wouldn't
recommend trying to build on a Raspberry Pi! We recommend the following.
* 30GB+ of free disk space. Otherwise, you will have to keep
  clearing incremental caches. More space is better, the compiler is a bit of a
  hog; it's a problem we are aware of.
* 8GB+ RAM
* 2+ cores. Having more cores really helps. 10 or 20 or more is not too many!

Beefier machines will lead to much faster builds. If your machine is not very
powerful, a common strategy is to only use `./x check` on your local machine
and let the CI build test your changes when you push to a PR branch.

Building the compiler takes more than half an hour on my moderately powerful
laptop. We suggest downloading LLVM from CI so you don't have to build it from source
([see here][config]).

Like `cargo`, the build system will use as many cores as possible. Sometimes
this can cause you to run low on memory. You can use `-j` to adjust the number
of concurrent jobs. If a full build takes more than ~45 minutes to an hour, you
are probably spending most of the time swapping memory in and out; try using
`-j1`.

If you don't have too much free disk space, you may want to turn off
incremental compilation ([see here][config]). This will make compilation take
longer (especially after a rebase), but will save a ton of space from the
incremental caches.


Chunks
df54bcf7 (1st chunk of `src/building/prerequisites.md`)
Title: Prerequisites for Building the Rust Compiler
Summary
To build the Rust compiler, you'll need to meet certain hardware and software requirements. You'll need an internet connection, 30GB+ of free disk space, 8GB+ RAM, and 2+ cores. A faster machine will significantly speed up the build process. Consider using `./x check` locally and relying on CI for full builds if your machine is less powerful. Downloading LLVM from CI is also recommended to avoid building it from source. Adjust the number of concurrent jobs with `-j` if you encounter memory issues and consider disabling incremental compilation to save disk space if needed.