Closed
Description
x fmt
is broken on NixOS. Do ./x fmt
:
rustfmt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
$ ./x fmt
downloading https://static.rust-lang.org/dist/2023-01-25/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################## 100,0%
extracting /home/user/src/rust/build/cache/2023-01-25/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
downloading https://static.rust-lang.org/dist/2023-01-25/rustc-beta-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################## 100,0%
extracting /home/user/src/rust/build/cache/2023-01-25/rustc-beta-x86_64-unknown-linux-gnu.tar.xz
downloading https://static.rust-lang.org/dist/2023-01-25/cargo-beta-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################## 100,0%
extracting /home/user/src/rust/build/cache/2023-01-25/cargo-beta-x86_64-unknown-linux-gnu.tar.xz
info: You seem to be using Nix.
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/bin/rustc
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/bin/rustdoc
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/libexec/rust-analyzer-proc-macro-srv
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/lib/libLLVM-15-rust-1.68.0-beta.so
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/lib/libtest-63b73d86237cbf5d.so
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/lib/librustc_driver-c78d16bcb49dc5d0.so
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/stage0/lib/libstd-b13f8c20834489ed.so
Building bootstrap
Compiling libc v0.2.137
Compiling memchr v2.5.0
Compiling proc-macro2 v1.0.46
Compiling cfg-if v1.0.0
Compiling typenum v1.15.0
Compiling unicode-ident v1.0.0
Compiling version_check v0.9.4
Compiling syn v1.0.102
Compiling cc v1.0.73
Compiling serde_derive v1.0.137
Compiling generic-array v0.14.5
Compiling lazy_static v1.4.0
Compiling regex-automata v0.1.10
Compiling io-lifetimes v1.0.1
Compiling serde v1.0.137
Compiling pkg-config v0.3.25
Compiling quote v1.0.18
Compiling log v0.4.17
Compiling aho-corasick v0.7.18
Compiling bstr v0.2.17
Compiling crossbeam-utils v0.8.14
Compiling rustix v0.36.3
Compiling lzma-sys v0.1.17
Compiling regex-syntax v0.6.26
Compiling same-file v1.0.6
Compiling serde_json v1.0.81
Compiling bitflags v1.3.2
Compiling crypto-common v0.1.3
Compiling block-buffer v0.10.2
Compiling once_cell v1.12.0
Compiling linux-raw-sys v0.1.3
Compiling fnv v1.0.7
Compiling thread_local v1.1.4
Compiling digest v0.10.3
Compiling walkdir v2.3.2
Compiling filetime v0.2.16
Compiling xattr v0.2.3
Compiling bootstrap v0.0.0 (/home/user/src/rust/src/bootstrap)
Compiling unicode-width v0.1.9
Compiling ryu v1.0.10
Compiling cpufeatures v0.2.5
Compiling itoa v1.0.2
Compiling sha2 v0.10.2
Compiling getopts v0.2.21
Compiling tar v0.4.38
Compiling opener v0.5.0
Compiling object v0.29.0
Compiling cmake v0.1.48
Compiling regex v1.5.6
Compiling build_helper v0.1.0 (/home/user/src/rust/src/tools/build_helper)
Compiling hex v0.4.3
Compiling fd-lock v3.0.8
Compiling globset v0.4.8
Compiling ignore v0.4.18
Compiling xz2 v0.1.6
Compiling toml v0.5.9
Finished dev [unoptimized] target(s) in 36.94s
downloading https://static.rust-lang.org/dist/2023-01-30/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################## 100,0%
extracting /home/user/src/rust/build/cache/2023-01-30/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz to /home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt
downloading https://static.rust-lang.org/dist/2023-01-30/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz
############################################################################################################################## 100,0%
extracting /home/user/src/rust/build/cache/2023-01-30/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz to /home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt
info: You seem to be using Nix.
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt
/nix/store/<hash>-rust-stage0-dependencies
attempting to patch /home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt/bin/cargo-fmt
/home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
Running `"/home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt" "--config-path" "/home/user/src/rust" "--edition" "2021" "--unstable-features" "--skip-children" "/home/user/src/rust/src/rustdoc-json-types/lib.rs"` failed.
If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead.
/home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
/home/user/src/rust/build/x86_64-unknown-linux-gnu/rustfmt/bin/rustfmt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
Build completed successfully in 0:01:44
It's a regression of the stage 0 update, as it worked fine on 9467f95, but errors since dc1d9d5 .
The description of #107297 points to a possible cause (highlighting by me):
include the rustc component for the rustfmt pinned nightly toolchain, which is currently necessary due to rustfmt dynamically linking to that toolchain's librustc_driver and libstd.
I suppose we need to run patchelf on more stuff now?
cc #107547
@rustbot label T-bootstrap