Skip to content

Commit

Permalink
Fix x.py check for download-stage1
Browse files Browse the repository at this point in the history
Previously, it would error out:

```
Checking compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Checking cfg-if v0.1.10
   Compiling autocfg v1.0.0
   Compiling libc v0.2.79
   Compiling proc-macro2 v1.0.19
error[E0464]: multiple matching crates for `std`
  |
  = note: candidates:
          crate `std`: /home/joshua/src/rust/rust/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-25c6acf8063a3802.so
          /home/joshua/src/rust/rust/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-25c6acf8063a3802.rlib
```

and the error would persist past `x.py check`:

```
   Compiling bootstrap v0.0.0 (/home/joshua/src/rust/rust/src/bootstrap)
error[E0464]: multiple matching crates for `std`
  |
  = note: candidates:
          crate `std`: /home/joshua/src/rust/rust/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-25c6acf8063a3802.rlib
```

I think the issue was that bootstrap was adding the check metadata to
the sysroot, so that it could check `libtest`; that ended up having two
different versions of libstd in sysroot. Now the metadata is added to
stage1 instead, which avoids the duplicate version.

Additionally, this doesn't check rustc artifacts when `download-stage1`
is set; it takes a relatively long time and the `compiler/` directory
shouldn't have changes anyway.
  • Loading branch information
jyn514 committed Jan 8, 2021
1 parent e29b201 commit 3418447
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ impl Step for Std {

fn run(self, builder: &Builder<'_>) {
let target = self.target;
let compiler = builder.compiler(0, builder.config.build);
let stage = if builder.config.download_stage1 { 1 } else { 0 };
let compiler = builder.compiler(stage, builder.config.build);

let mut cargo = builder.cargo(
compiler,
Expand All @@ -84,7 +85,10 @@ impl Step for Std {
);
std_cargo(builder, target, compiler.stage, &mut cargo);

builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target));
builder.info(&format!(
"Checking stage {} std artifacts ({} -> {})",
stage, &compiler.host, target
));
run_cargo(
builder,
cargo,
Expand Down Expand Up @@ -124,8 +128,8 @@ impl Step for Std {
}

builder.info(&format!(
"Checking std test/bench/example targets ({} -> {})",
&compiler.host, target
"Checking stage {} std test/bench/example targets ({} -> {})",
stage, &compiler.host, target
));
run_cargo(
builder,
Expand Down Expand Up @@ -163,6 +167,9 @@ impl Step for Rustc {
/// the `compiler` targeting the `target` architecture. The artifacts
/// created will also be linked into the sysroot directory.
fn run(self, builder: &Builder<'_>) {
if builder.config.download_stage1 {
return;
}
let compiler = builder.compiler(0, builder.config.build);
let target = self.target;

Expand Down

0 comments on commit 3418447

Please sign in to comment.