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 fmt broken on NixOS since stage0 update #107676

Closed
est31 opened this issue Feb 5, 2023 · 0 comments · Fixed by #107842
Closed

x fmt broken on NixOS since stage0 update #107676

est31 opened this issue Feb 5, 2023 · 0 comments · Fixed by #107842
Assignees
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@est31
Copy link
Member

est31 commented Feb 5, 2023

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

@est31 est31 added the C-bug Category: This is a bug. label Feb 5, 2023
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 5, 2023
@fee1-dead fee1-dead self-assigned this Feb 9, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 12, 2023
…xos, r=Mark-Simulacrum

Patch `build/rustfmt/lib/*.so` for NixOS

fixes rust-lang#107676.
@bors bors closed this as completed in 2e1b78d Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. 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