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

document args for -Zbuild-std when folks aren't building everything #126992

Open
robertbastian opened this issue Jun 26, 2024 · 5 comments
Open
Labels
-Zbuild-std Unstable Cargo option: Compile the standard library yourself. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@robertbastian
Copy link
Contributor

I tried this code:

$ cargo init repro
$ cd repro
$ cargo +nightly check --target thumbv8m.main-none-eabihf -Zbuild-std=std

I expected to see this happen: builds successfully

Instead, this happened:

   Compiling std v0.0.0 (.../.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std)
error[E0432]: unresolved import `crate::sys::thread_local::key::StaticKey`
 --> .../.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/thread_local/os.rs:5:5
  |
5 | use crate::sys::thread_local::key::StaticKey as OsKey;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `StaticKey` in `sys::thread_local::key`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std` (lib) due to 1 previous error

Meta

$ rustc +nightly --version --verbose
rustc 1.81.0-nightly (fda509e81 2024-06-25)
binary: rustc
commit-hash: fda509e817abeeecb5b76bc1de844f355675c81e
commit-date: 2024-06-25
host: aarch64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7
@robertbastian robertbastian added the C-bug Category: This is a bug. label Jun 26, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 26, 2024
@bjorn3
Copy link
Member

bjorn3 commented Jun 26, 2024

Isn't thumbv8m.main-none-eabihf (supposed to be) a no_std target? There is no OS such code runs on.

@robertbastian
Copy link
Contributor Author

We're using -Zbuild-std=std to get -Zbuild-std-features=panic_immediate_abort. This works on older nightlies but might have changed?

@robertbastian
Copy link
Contributor Author

We probably need to use -Zbuild-std=core,alloc -Zbuild-std-features=panic_immediate_abort

robertbastian added a commit to unicode-org/icu4x that referenced this issue Jun 26, 2024
@workingjubilee workingjubilee changed the title unresolved import crate::sys::thread_local::key::StaticKey document args for -Zbuild-std when folks aren't building everything Jun 27, 2024
@workingjubilee workingjubilee added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools -Zbuild-std Unstable Cargo option: Compile the standard library yourself. labels Jun 27, 2024
@workingjubilee
Copy link
Member

probably in the unstable book for the option?

@workingjubilee
Copy link
Member

sorry for absconding with your issue @robertbastian but it seems to me that not being able to build std is uhhh expected on a no_std target, even if it might have slightly funny results, whereas "how to steer -Zbuild-std correctly" seems to be inadequately documented for your particular usage, based on your remarks in unicode-org/icu4x#5132

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zbuild-std Unstable Cargo option: Compile the standard library yourself. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants