Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dist::Gcc build step #137667

Merged
merged 2 commits into from
Mar 5, 2025
Merged

Add dist::Gcc build step #137667

merged 2 commits into from
Mar 5, 2025

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Feb 26, 2025

This PR adds a dist:Gcc bootstrap step to distribute a prebuilt libgccjit.so from CI on x64 Linux.

With primed sccache, the build takes ~4 minutes on CI, and produces a 50 MiB archive.

I want to land this before adding something akin to [gcc] download-ci-gcc = true, to already have the artifacts available on CI, to make it easier to setup the download merge-base logic.

r? @ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 26, 2025
@Kobzol
Copy link
Contributor Author

Kobzol commented Feb 26, 2025

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 26, 2025
Add `dist::Gcc` build step

To distribute the prebuilt libgccjit.so from CI. Opening as a draft to examine the impact on CI times.

r? `@ghost`
@bors
Copy link
Contributor

bors commented Feb 26, 2025

⌛ Trying commit bea7b2f with merge 87766ec...

@bors
Copy link
Contributor

bors commented Feb 26, 2025

☀️ Try build successful - checks-actions
Build commit: 87766ec (87766ec3ca2cc62161ab97bbbebabb95bab24f89)

@Kobzol
Copy link
Contributor Author

Kobzol commented Feb 26, 2025

445s to build GCC without sccache. Now trying again with cache.

@bors try

@bors
Copy link
Contributor

bors commented Feb 26, 2025

⌛ Trying commit bea7b2f with merge e7be89f...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 26, 2025
Add `dist::Gcc` build step

To distribute the prebuilt libgccjit.so from CI. Opening as a draft to examine the impact on CI times.

r? `@ghost`
@bors
Copy link
Contributor

bors commented Feb 26, 2025

☀️ Try build successful - checks-actions
Build commit: e7be89f (e7be89ff3e5e6915ef8f49b031c24861eabe63a2)

@Kobzol Kobzol marked this pull request as ready for review February 26, 2025 15:47
@Kobzol
Copy link
Contributor Author

Kobzol commented Feb 26, 2025

r? @onur-ozkan

@rustbot
Copy link
Collaborator

rustbot commented Feb 26, 2025

Some changes occurred in src/tools/opt-dist

cc @Kobzol

To distribute the prebuilt libgccjit.so from CI.
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Feb 28, 2025
@Kobzol
Copy link
Contributor Author

Kobzol commented Feb 28, 2025

@rustbot ready

@onur-ozkan
Copy link
Member

Feel free to r=me once CI is green.

@Kobzol
Copy link
Contributor Author

Kobzol commented Feb 28, 2025

@bors r=onur-ozkan rollup=iffy

@bors
Copy link
Contributor

bors commented Feb 28, 2025

📌 Commit e4bfad2 has been approved by onur-ozkan

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 28, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Mar 4, 2025
Add `dist::Gcc` build step

This PR adds a `dist:Gcc` bootstrap step to distribute a prebuilt `libgccjit.so` from CI on x64 Linux.

With primed sccache, the build takes ~4 minutes on CI, and produces a 50 MiB archive.

I want to land this before adding something akin to `[gcc] download-ci-gcc = true`, to already have the artifacts available on CI, to make it easier to setup the download merge-base logic.

r? `@ghost`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 4, 2025
Rollup of 10 pull requests

Successful merges:

 - rust-lang#134063 (dec2flt: Clean up float parsing modules)
 - rust-lang#136662 (Count char width at most once in `Formatter::pad`)
 - rust-lang#137011 (Promote ohos targets to tier2 with host tools.)
 - rust-lang#137077 (Postprocess bootstrap metrics into GitHub job summary)
 - rust-lang#137327 (Undeprecate env::home_dir)
 - rust-lang#137373 (Compile run-make-support and run-make tests with the bootstrap compiler)
 - rust-lang#137463 ([illumos] attempt to use posix_spawn to spawn processes)
 - rust-lang#137477 (uefi: Add Service Binding Protocol abstraction)
 - rust-lang#137569 (Stablize `string_extend_from_within`)
 - rust-lang#137667 (Add `dist::Gcc` build step)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 5, 2025
…kingjubilee

Rollup of 6 pull requests

Successful merges:

 - rust-lang#137077 (Postprocess bootstrap metrics into GitHub job summary)
 - rust-lang#137373 (Compile run-make-support and run-make tests with the bootstrap compiler)
 - rust-lang#137634 (Update `compiler-builtins` to 0.1.149)
 - rust-lang#137667 (Add `dist::Gcc` build step)
 - rust-lang#137722 (`librustdoc`: 2024 edition! 🎊)
 - rust-lang#137947 (Do not install rustup on Rust for Linux job)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit df2a263 into rust-lang:master Mar 5, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 5, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 5, 2025
Rollup merge of rust-lang#137667 - Kobzol:gcc-dist-build, r=onur-ozkan

Add `dist::Gcc` build step

This PR adds a `dist:Gcc` bootstrap step to distribute a prebuilt `libgccjit.so` from CI on x64 Linux.

With primed sccache, the build takes ~4 minutes on CI, and produces a 50 MiB archive.

I want to land this before adding something akin to `[gcc] download-ci-gcc = true`, to already have the artifacts available on CI, to make it easier to setup the download merge-base logic.

r? ``@ghost``
@Kobzol Kobzol deleted the gcc-dist-build branch March 5, 2025 06:37
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 11, 2025
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:
- For the rest of bootstrap, it should be transparent whether GCC was built locally or downloaded from CI.
- GCC is not downloaded eagerly unless you actually requested GCC (either you requested `x build gcc` or you asked to build/test the GCC backend).

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`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 11, 2025
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:
- For the rest of bootstrap, it should be transparent whether GCC was built locally or downloaded from CI.
- GCC is not downloaded eagerly unless you actually requested GCC (either you requested `x build gcc` or you asked to build/test the GCC backend).

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``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants