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

Give a better error when std is missing for a target #2732

Merged
merged 1 commit into from
Apr 29, 2021

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Apr 25, 2021

  • Note that not all platforms have std pre-compiled
  • Suggest cargo build -Zbuild-std on nightly

After rust-lang/rust#84450, you can end up with a situation like this:

$ rustc +stage1 src/main.rs --target x86_64-unknown-uefi
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-uefi` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-unknown-uefi`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.

$ rustup target add x86_64-unknown-uefi

error: toolchain 'nightly-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target 'x86_64-unknown-uefi'

That doesn't give you much info on how to proceed. After this PR, it will be more clear:

$ rustup target add x86_64-unknown-uefi

error: toolchain 'nightly-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target 'x86_64-unknown-uefi'
note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html
help: consider using `cargo build -Z build-std` instead

- Note that not all platforms have std pre-compiled
- Suggestion `cargo build -Zbuild-std` on nightly
@jyn514
Copy link
Member Author

jyn514 commented Apr 25, 2021

Unlike rust-lang/rust#84450, this recommends -Z build-std whenever you're using a nightly toolchain, because you can always install cargo with rustup and it seems strange to be using rustup but not cargo.

@rbtcollins
Copy link
Contributor

rustup and no cargo will occur when someone builds a rust toolchain from source and links it in. However I agree that this is the common case suggestion to make, and I think anyone using such a non-downloadable toolchain will be sophisticated enough to figure it out with the pointer this gives them. @kinnison thoughts?

@kinnison kinnison merged commit 2d75c09 into rust-lang:master Apr 29, 2021
@jyn514 jyn514 deleted the platform branch April 29, 2021 18:58
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

Successfully merging this pull request may close these issues.

3 participants