Why is Rust's build system uniquely hard to use?
a day ago
- Rust's build system is particularly confusing even for experienced compiler engineers due to its unique stage numbering and bootstrap process.
- The naming of stage 0 as a separate stage (rather than 'native compiler') contributes to confusion, as other compilers use different terminology.
- Rust builds its standard library from source, requiring support for two compiler versions (beta and in-tree), causing significant pain when making changes that affect both compiler and std.
- Other compilers like GCC, Clang, and GHC handle standard library building differently; C doesn't build std from source, Haskell requires only one version.
- The x.py stage numbering is off-by-one: --stage N builds with stage N, not creates stage N, which is counterintuitive.
- Proposed changes include renaming to sysroot-based flags (--bootstrap-sysroot, --dev-sysroot, etc.), removing cfg(bootstrap) from std, enabling download-rustc for library-only changes, and overhauling terminology.
- Developers express strong support for removing cfg(bootstrap) to reduce complexity and speed up development.