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

bootstrap rustNightly from rustBeta never works with the 'correct' channels #38026

Closed
qknight opened this issue Nov 27, 2016 · 10 comments
Closed

Comments

@qknight
Copy link

qknight commented Nov 27, 2016

what we want

hey,
on NixOS we want to have stable, beta and nightly built as according to the docs of rust but we tried many different versions and it always fails with errors like this:

https://gist.github.com/qknight/15550e3b24b8a503897ac92fffe88804

or in short:

error[E0554]: #[feature] may not be used on the beta release channel
  --> src/libcore/lib.rs:93:1
   |
93 | #![feature(never_type)]
   | ^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: #[feature] may not be used on the beta release channel
  --> src/libcore/lib.rs:94:1
   |
94 | #![feature(prelude_import)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 25 previous errors

that said have a look at these files:
https://github.com/nixcloud/nixpkgs/blob/experimentalUpdate/pkgs/development/compilers/rust/default.nix
https://github.com/nixcloud/nixpkgs/blob/experimentalUpdate/pkgs/development/compilers/rust/beta.nix
https://github.com/nixcloud/nixpkgs/blob/experimentalUpdate/pkgs/development/compilers/rust/nightly.nix

we use these channels:

  • "--release-channel=stable" to build stable
  • "--release-channel=beta" to build beta from stable
  • "--release-channel=nightly" to build nightly from beta

and then it fails.

if we do this:

  • "--release-channel=nightly" for building stable, beta and nightly we don't see the channel errors listed above.

what is going wrong here?

@the-kenny
Copy link
Contributor

the-kenny commented Nov 27, 2016

(I've seen this before and the following is my recollection, so it might not be completely correct)

This happens when there's a mismatch between the version used to bootstrap the compiler and what the compiler being bootstrapped expects. The current build system uses a secret to enable unstable features for stable compilers.

For a given compiler to bootstrap correctly you need to bootstrap it with the versions/snapshots specified in https://github.com/rust-lang/rust/blob/master/src/stage0.txt in the source tree of the compiler being built.

The link above specifies rustc: beta-2016-09-28 for bootstrap of today's unstable. The beta in your nix expression is way newer and isn't expected to work.

@the-kenny
Copy link
Contributor

Also note that it could be related to #34722 - but that would be a rather fringe case (and I added a big fat warning to our build code to not use wrapProgram).

My bet is on the beta/stage0.txt mismatch.

@qknight
Copy link
Author

qknight commented Nov 27, 2016

@alexcrichton do you have an idea?

@the-kenny
Copy link
Contributor

the-kenny commented Nov 27, 2016

@qknight Did you try my suggestion above? I'm pretty sure it's related to the (likely) usage of incompatible versions used for bootstrapping.

On another note: @alexcrichton: We ran into this error twice now - is it possible to extend the build system of rustc to guard against this kind of misconfiguration and show a warning/error that's more clear than the can't use unstable features on stable error? If you give me a pointer where to start I'd be happy to provide a PR :)

@nagisa
Copy link
Member

nagisa commented Nov 27, 2016

Relevant recent changes to bootstrap key logic: #37265 #37566.

If I count the releases correctly, then it should be possible to bootstrap nightly with beta just by setting RUSTC_BOOTSTRAP=1.


EDIT: indeed, it works

# rustup run beta rustc test.rs
error[E0554]: #[feature] may not be used on the beta release channel
 --> test.rs:1:1
  |
1 | #![feature(core_intrinsics)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

# set -x RUSTC_BOOTSTRAP '1'
# rustup run beta rustc test.rs

@the-kenny
Copy link
Contributor

@nagisa Thanks for the pointers! :) I just enabled this proactively in our tree in NixOS/nixpkgs@bfc187f

@qknight Can you rebase/merge current master into your branch and give it a try? It should be fine now if rustc really picks up the env var :)

@qknight
Copy link
Author

qknight commented Nov 28, 2016

@the-kenny i will play with your advice in a bit, thanks very much!

for now i plan to include this commit into nixpkgs:

why is this cool? this expression downloads a nightly rustc (no cargo) and totally bypasses hydra! this way everyone might be happy. installation in less time than a 100 mb download ;-)

@the-kenny
Copy link
Contributor

the-kenny commented Nov 28, 2016 via email

@alexcrichton
Copy link
Member

Was the bootstrap logic resolved here as well? Is this closed now?

@qknight qknight closed this as completed Nov 28, 2016
@qknight
Copy link
Author

qknight commented Nov 28, 2016

thanks a lot everyone! this bug-hunt was amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants