rust-lang / cargo-bisect-rustc

Bisects rustc, either nightlies or CI artifacts
https://rust-lang.github.io/cargo-bisect-rustc/
Apache License 2.0
174 stars 55 forks source link

Can't run nightlies installed by `cargo-bisect-rustc` on NixOS? #265

Open langston-barrett opened 1 year ago

langston-barrett commented 1 year ago

I'm having trouble using cargo-bisect-rustc on NixOS. I think the trouble is that I can't run the binaries installed by cargo-bisect-rustc, whereas I can run binaries installed via rustup:

~/.rustup/toolchains/bisector-nightly-2017-01-20-x86_64-unknown-linux-gnu/bin/rustc --version

zsh: no such file or directory: /home/langston/.rustup/toolchains/bisector-nightly-2017-01-20-x86_64-unknown-linux-gnu/bin/rustc

~/.rustup/toolchains/1.68.0-x86_64-unknown-linux-gnu/bin/rustc --version

rustc 1.68.0 (2c8cc3432 2023-03-06)

The output of file shows different dynamic linker paths:

file ~/.rustup/toolchains/bisector-nightly-2017-01-20-x86_64-unknown-linux-gnu/bin/rustc

/home/langston/.rustup/toolchains/bisector-nightly-2017-01-20-x86_64-unknown-linux-gnu/bin/rustc: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, not stripped

file ~/.rustup/toolchains/1.68.0-x86_64-unknown-linux-gnu/bin/rustc

/home/langston/.rustup/toolchains/1.68.0-x86_64-unknown-linux-gnu/bin/rustc: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/0xxjx37fcy2nl3yz6igmv4mag2a7giq6-glibc-2.33-123/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, with debug_info, not stripped

ldd also shows more shared libraries for the bisector-nightly-* executables, but none of them are missing.

FWIW, this is cargo-bisect-rustc installed from https://github.com/rust-lang/cargo-bisect-rustc/commit/95eaf5b24e00efa5ce5415ebdd6c8814dfc80720.

Nilstrieb commented 5 months ago

rustup packaged by nixpkgs (also rustup-toolchain-install-master has patches to patchelf the toolchains. I have patched it myself: https://github.com/Nilstrieb/nixos/blob/4edca36ab7e7d4a04640e77bb3b6d44d8ec849da/custom-pkgs/cargo-bisect-rustc/0001-patchelf.patch Maybe cargo-bisect-rustc should use the rustup-toolchain-install-master binary instead of it's found? Or someone would upstream it with the patches to nixpkgs.