Add dist::Gcc build step by Kobzol · Pull Request #137667 · rust-lang/rust (original) (raw)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Mar 11, 2025

@matthiaskrgr

Add support for downloading GCC from CI

This PR adds a new bootstrap config section called gcc and implements a single config download-ci-gcc. Its behavior is similar to download-ci-llvm. Since rust-lang#137667, we distribute a CI component that contains the prebuilt libgccjit.so library on x64 Linux. With download-ci-gcc, this component is downloaded from CI to avoid building GCC locally.

This is an MVP of this functionality, designed for local usage. This PR does not enable this functionality on the LLVM 18 PR CI job which builds cg_gcc, and does not implement more complex detection logic. It simply uses false (build locally) or true (download from CI if you're on the right target, if CI download fails, then bootstrap fails).

The original LLVM CI download functionality has a lot of features and complexity, which we don't need for GCC (yet). I don't like how the LLVM CI stuff is threaded through multiple parts of bootstrap, so with GCC I would like to take a more centralized approach, where the build::Gcc step handles download from CI internally. This means that:

This approach will require some modifications once we extend this feature, but so far I like this approach much more than putting this stuff into Config[::parse], which already does a ton of stuff that it arguably shouldn't (but it's super difficult to extract its logic out).

This PR is an alternative to rust-lang#130749, which did a more 1:1 copy of the download-ci-llvm logic.

r? @onur-ozkan