Skip to content

bootstrap tries to patch the wrong cargo on NixOS when download-rustc is set #84702

Closed
@jyn514

Description

@jyn514

I tried this code: x.py check

I expected to see this happen: x.py patches stage0/cargo

Instead, this happened: x.py tries to patch ci-rustc/cargo, fails, and never patches stage0/cargo, causing a build failure.

[nix-shell:~/rustc2]$ x check --all-targets
Updating only changed submodules
Submodules updated in 0.03 seconds
extracting /home/joshua/rustc2/build/cache/llvm-5f1aeb52c22e3784928765e34be6dc0d17a350b4-True/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-llvm/bin/llvm-config
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-11-rust-1.51.0-nightly.so
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-12-rust-1.53.0-nightly.so
downloading https://ci-artifacts.rust-lang.org/rustc-builds/78c963945aa35a76703bf62e024af2d85b2796e2/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################### 100.0%
extracting /home/joshua/rustc2/build/cache/78c963945aa35a76703bf62e024af2d85b2796e2/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
downloading https://ci-artifacts.rust-lang.org/rustc-builds/78c963945aa35a76703bf62e024af2d85b2796e2/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################### 100.0%
extracting /home/joshua/rustc2/build/cache/78c963945aa35a76703bf62e024af2d85b2796e2/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz
extracting /home/joshua/rustc2/build/cache/2021-04-07/cargo-nightly-x86_64-unknown-linux-gnu.tar.xz
downloading https://ci-artifacts.rust-lang.org/rustc-builds/78c963945aa35a76703bf62e024af2d85b2796e2/rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################### 100.0%
extracting /home/joshua/rustc2/build/cache/78c963945aa35a76703bf62e024af2d85b2796e2/rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/bin/rustc
warning: working around a Linux kernel bug by creating a hole of 1007616 bytes in ‘/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/bin/rustc’
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/bin/rustdoc
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/bin/cargo
stat: No such file or directory
warning: failed to call patchelf: Command '['/home/joshua/rustc2/build/.nix-deps/bin/patchelf', '--set-rpath', '$ORIGIN/../lib:/nix/store/cl4qhnp02xg2mq8x8v8ms70v4x9rmp8p-rust-stage0-dependencies/lib', '--set-interpreter', '/nix/store/9rabxvqbv0vgjmydiv59wkz768b5fmbc-glibc-2.30/lib/ld-linux-x86-64.so.2', '/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/bin/cargo']' returned non-zero exit status 1.
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/lib/libstd-c6dddd3d354e6bea.so
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/lib/libLLVM-12-rust-1.53.0-nightly.so
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/lib/libtest-e0d08a82dcb7da7b.so
info: you seem to be running NixOS. Attempting to patch /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/ci-rustc/lib/librustc_driver-bcac88c1fda1187d.so
Traceback (most recent call last):
  File "/home/joshua/rustc2/x.py", line 27, in <module>
    bootstrap.main()
  File "/home/joshua/rustc2/src/bootstrap/bootstrap.py", line 1191, in main
    bootstrap(help_triggered)
  File "/home/joshua/rustc2/src/bootstrap/bootstrap.py", line 1162, in bootstrap
    build.build_bootstrap()
  File "/home/joshua/rustc2/src/bootstrap/bootstrap.py", line 919, in build_bootstrap
    run(args, env=env, verbose=self.verbose)
  File "/home/joshua/rustc2/src/bootstrap/bootstrap.py", line 148, in run
    ret = subprocess.Popen(args, **kwargs)
  File "/nix/store/h980gmq4lgrgmzlvcav2v85nypvhhh3k-python3-3.9.0a4/lib/python3.9/subprocess.py", line 956, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/h980gmq4lgrgmzlvcav2v85nypvhhh3k-python3-3.9.0a4/lib/python3.9/subprocess.py", line 1837, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0/bin/cargo'

In particular, ci-rustc/bin/cargo does not exist:

[nix-shell:~/rustc2]$  ls build/x86_64-unknown-linux-gnu/ci-rustc/bin/
rustc  rustdoc  rust-gdb  rust-gdbgui  rust-lldb

and stage0/bin/cargo is never patched.

Meta

$ git merge-base origin/master HEAD

78c9639

Metadata

Metadata

Assignees

Labels

A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustC-bugCategory: This is a bug.O-NixOSOperating system: NixOS, https://nixos.org/T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions