Skip to content

Conversation

skeuchel
Copy link
Contributor

@skeuchel skeuchel commented Oct 24, 2024

This uses the upstream version 1.82.0 binary to bootstrap the rust compiler of the same version instead of the binary of the previous version on riscv64-linux. The reason is that the older 1.81.0 cannot bootstrap the new version for this platform as discussed in rust-lang/rust#129268. This is a temporary fix that is only necessary for this version and it only applies to native compilation, not to cross compilation.

Edit: Update it for all platforms.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
    • riscv64-linux
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@skeuchel skeuchel requested a review from alyssais October 24, 2024 21:19
@github-actions github-actions bot added the 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. label Oct 24, 2024
@nix-owners nix-owners bot requested review from figsoda, Mic92, winterqt and zowoq October 24, 2024 21:21
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Oct 25, 2024
@skeuchel
Copy link
Contributor Author

But also, maybe it would be better to just use 1.82.0 on all platforms for this release, to avoid confusing divergences like this? I'm pretty sure the comment above that says "MUST be one version prior" is not accurate, because my understanding is that rustc also always supports building a released compiler with itself.

Maintainers what do you think?

@alyssais
Copy link
Member

FWIW while I'm not listed as a maintainer, that's basically an accident. I'm generally the one who handles rustc upgrades and a lot of other rust stuff.

Apparently in 2017 we were told that we should be using the previous version of rustc, not the current one. @workingjubilee do you know if that's still what we should be preferring in general?

@workingjubilee
Copy link

But also, maybe it would be better to just use 1.82.0 on all platforms for this release, to avoid confusing divergences like this? I'm pretty sure the comment above that says "MUST be one version prior" is not accurate, because my understanding is that rustc also always supports building a released compiler with itself.

Correct, the Rust compiler must be able to build itself.

@workingjubilee
Copy link

In 2017, our usual flow for bootstrapping the compiler was different, so it could have been much rockier, and it has always been touchy on 32-bit.

Nowadays, for development purposes, we build the standard library with the last beta version. From release to release, that means "the last version". This was easier to standardize on, and have everyone reuse it. Then we build the compiler with the beta + new library. Then it builds its own library again to complete its sysroot.

Then, after building the compiler with the beta, there is another build with the new compiler. In many cases there are no practical differences.

@skeuchel skeuchel marked this pull request as draft October 26, 2024 10:04
@skeuchel skeuchel changed the base branch from staging-next to staging October 26, 2024 10:04
@skeuchel skeuchel changed the title rustc: use 1.82 binary to bootstrap rustc 1.82 on riscv64-linux rustc: use 1.82.0 binary to bootstrap rustc 1.82.0 Oct 26, 2024
@skeuchel
Copy link
Contributor Author

So if upstream now ensures that each version can build itself, then I propose to change the bootstrap accordingly. I have updated the PR to do so.

@skeuchel skeuchel marked this pull request as ready for review October 26, 2024 10:08
@alyssais
Copy link
Member

Could you put an explanation of why we're making this change in the commit message please?

@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Oct 26, 2024
@winterqt winterqt requested a review from alyssais October 31, 2024 01:10
@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 31, 2024
Change the bootstrap on all platforms to use a version of the upstream binary
that is equal to the version that is being built, instead of a binary of one
version prior. This is necessary for the 1.82.0 release because on some
platforms (rust-lang/rust#129268) the 1.81.0 binary
can not build the 1.82.0 source. Furthermore, upstream reported that their
development process (now) usually involves building a release compiler with
itself and that "the Rust compiler must be able to build itself".
@winterqt
Copy link
Member

Thank you!

@winterqt winterqt merged commit 5ac7929 into NixOS:staging Oct 31, 2024
9 of 10 checks passed
@skeuchel skeuchel deleted the riscv64-rustc branch October 31, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants