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

./x check std should not try to check no_std targets #128027

Closed
ChrisDenton opened this issue Jul 21, 2024 · 2 comments · Fixed by #128182
Closed

./x check std should not try to check no_std targets #128027

ChrisDenton opened this issue Jul 21, 2024 · 2 comments · Fixed by #128182
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@ChrisDenton
Copy link
Member

no_std targets don't support std so checking is pointless and can be skipped. Or at the very least it could inform users that failing checks is expected and not an error.

Maybe there could be some way to force a check if someone really wants to.

@ChrisDenton ChrisDenton added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jul 21, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 21, 2024
@onur-ozkan onur-ozkan removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 21, 2024
@onur-ozkan
Copy link
Member

For no_std targets bootstrap does this:

if builder.no_std(target) == Some(true) {
features += " compiler-builtins-mem";
if !target.starts_with("bpf") {
features.push_str(compiler_builtins_c_feature);
}
// for no-std targets we only compile a few no_std crates
cargo
.args(["-p", "alloc"])
.arg("--manifest-path")
.arg(builder.src.join("library/alloc/Cargo.toml"))
.arg("--features")
.arg(features);

which seems good enough already. Do we need to skip the whole std step?

@ChrisDenton
Copy link
Member Author

It doesn't seem to work though? Picking aarch64-unknown-none-softfloat as it's the first none on the list of targets:

> .\x check std --target aarch64-unknown-none-softfloat
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.09s
cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `cc` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `c++` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `c++` installed? (see https://github.com/rust-lang/cc-rs#compile-time-requirements for help)
Checking stage0 library artifacts {std} (x86_64-pc-windows-msvc -> aarch64-unknown-none-softfloat)
    Checking std v0.0.0 (F:\rust\library\std)
warning: dropping unsupported crate type `dylib` for target `aarch64-unknown-none-softfloat`

error[E0432]: unresolved imports `crate::sys::thread_local::key::get`, `crate::sys::thread_local::key::set`, `crate::sys::thread_local::key::Key`, `crate::sys::thread_local::key::LazyKey`
 --> library\std\src\sys\thread_local\os.rs:5:37
  |
5 | use crate::sys::thread_local::key::{get, set, Key, LazyKey};
  |                                     ^^^  ^^^  ^^^  ^^^^^^^ no `LazyKey` in `sys::thread_local::key`
  |                                     |    |    |
  |                                     |    |    no `Key` in `sys::thread_local::key`
  |                                     |    no `set` in `sys::thread_local::key`
  |                                     no `get` in `sys::thread_local::key`
  |
note: module `crate::collections::hash::set` exists but is inaccessible
 --> library\std\src\collections\hash\mod.rs:4:1
  |
4 | pub mod set;
  | ^^^^^^^^^^^^ not accessible

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

Some other non-std targets print a lot more errors.

tgross35 added a commit to tgross35/rust that referenced this issue Jul 28, 2024
…rk-Simulacrum

handle no_std targets on std builds

This PR unifies the `Step::run_make` logic and improves it by skipping std specific crates for no_std targets. In addition, since we now handle library crates properly, bootstrap is capable of running `x doc library` even for no_std targets as it is able to generate documentation for `alloc` crate from the standard library.

Resolves rust-lang#128027

cc `@ChrisDenton`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 29, 2024
…rk-Simulacrum

handle no_std targets on std builds

This PR unifies the `Step::run_make` logic and improves it by skipping std specific crates for no_std targets. In addition, since we now handle library crates properly, bootstrap is capable of running `x doc library` even for no_std targets as it is able to generate documentation for `alloc` crate from the standard library.

Resolves rust-lang#128027

cc `@ChrisDenton`
@bors bors closed this as completed in 7e6943d Jul 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 29, 2024
Rollup merge of rust-lang#128182 - onur-ozkan:fix-no-std-crates, r=Mark-Simulacrum

handle no_std targets on std builds

This PR unifies the `Step::run_make` logic and improves it by skipping std specific crates for no_std targets. In addition, since we now handle library crates properly, bootstrap is capable of running `x doc library` even for no_std targets as it is able to generate documentation for `alloc` crate from the standard library.

Resolves rust-lang#128027

cc ``@ChrisDenton``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants