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

tools no longer find librustc_driver #137469

Closed
matthiaskrgr opened this issue Feb 23, 2025 · 11 comments · Fixed by #137476
Closed

tools no longer find librustc_driver #137469

matthiaskrgr opened this issue Feb 23, 2025 · 11 comments · Fixed by #137476
Labels
C-bug Category: This is a bug. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Feb 23, 2025

~/.cargo/bin/cargo +master fmt

/home/matthias/.rustup/toolchains/master/bin/rustfmt: error while loading shared libraries: librustc_driver-db25bd44b4d5bdcc.so: cannot open shared object file: No such file or directory

~/.cargo/bin/cargo +master clippy

/home/matthias/.rustup/toolchains/master/bin/cargo-clippy: error while loading shared libraries: librustc_driver-db25bd44b4d5bdcc.so: cannot open shared object file: No such file or directory
rustc 1.87.0-nightly (bb2cc59a2 2025-02-23)
binary: rustc
commit-hash: bb2cc59a2172d6e35c89b409a4e6b5058d9039d7
commit-date: 2025-02-23
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

cc @onur-ozkan #137215

@matthiaskrgr matthiaskrgr added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Feb 23, 2025
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 23, 2025
@matthiaskrgr matthiaskrgr added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 23, 2025
@onur-ozkan
Copy link
Member

I will check it today

@onur-ozkan
Copy link
Member

I tried this: x build compiler std cargo clippy rustfmt

and they seem to be working:

$  ~/devspace/.other/rustc-builds  $ ls ./build/host/stage1/bin
cargo-clippy  cargo-fmt  clippy-driver  rustc  rustfmt
$  ~/devspace/.other/rustc-builds  $ ./build/host/stage1/bin/cargo-fmt --version
rustfmt 1.8.0-dev (bb2cc59a21 2025-02-23)
$  ~/devspace/.other/rustc-builds  $ ./build/host/stage1/bin/rustfmt --version
rustfmt 1.8.0-dev (bb2cc59a21 2025-02-23)
$  ~/devspace/.other/rustc-builds  $ ./build/host/stage1/bin/cargo-clippy --version
clippy 0.1.86 (bb2cc59a21 2025-02-23)

How did you perform your test?

@onur-ozkan onur-ozkan removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 23, 2025
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Feb 23, 2025

with https://github.com/kennytm/rustup-toolchain-install-master I do a

rustup-toolchain-install-master -f -n master -c rustc-dev llvm-tools rust-src clippy rust-analyzer rustfmt miri rustc-codegen-cranelift rust-docs
(installs master toolchain with a bunch of components)

and then
~/.cargo/bin/cargo +master clippy
to run this master toolchain via cargo

@Noratrieb
Copy link
Member

nora@nixos /t/t/meow (main)> readelf -d /home/nora/.rustup/toolchains/master/bin/rustfmt

Dynamic section at offset 0x50b6c8 contains 32 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]
 0x0000000000000001 (NEEDED)             Shared library: [librustc_driver-db25bd44b4d5bdcc.so]

It has the rpath and NEEDED, so the tool binary itself looks fine.

nora@nixos /t/t/meow (main)> ll /home/nora/.rustup/toolchains/master/lib/librustc*
-rw-r--r-- 1 nora users 141684152 Feb 23 11:06 /home/nora/.rustup/toolchains/master/lib/librustc_driver-19054624313a00ee.so

But the librustc_driver has a different hash..... somehow the tools are built against the wrong rustc.

@Noratrieb
Copy link
Member

This feels related to #123384, maybe that tool staging bug messed up your new build logic?

@Noratrieb Noratrieb added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. P-critical Critical priority and removed regression-untriaged Untriaged performance or correctness regression. labels Feb 23, 2025
@onur-ozkan
Copy link
Member

$  ~/devspace/.other/rustc-builds  $ readelf -d build/host/stage2/bin/rustdoc

Dynamic section at offset 0xc051b0 contains 32 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [librustc_driver-e09e126965159615.so]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]
$  ~/devspace/.other/rustc-builds  $ ls build/host/stage2/lib
librustc_driver-e09e126965159615.so  rustlib

Regular builds seems fine, will look into x dist results.

@onur-ozkan
Copy link
Member

Yeah, dist logic doesn't seem to be right... Working on the fix now.

@matthiaskrgr
Copy link
Member Author

I wonder if we can have a little smoke test on CI

  1. create dist artifacts
  2. install them via rustup
  3. cargo new testcrate
  4. cd testcrate
  5. cargo +dist build
  6. cargo +dist fmt
  7. cargo +dist clippy
  8. cargo +dist doc

or something like that

@Noratrieb
Copy link
Member

ohhhhh, your #137215 did #123384, that's very cool! nice.

@matthiaskrgr yeah, having dist-smoke-tests would be useful. see #136822 when recently i686-pc-windows-gnu suddenly had x86-64 libraries :D

@Noratrieb
Copy link
Member

I've prepared a revert in #137475 in case we don't find a fix for the bug in time, so there's no rush :).

@onur-ozkan
Copy link
Member

I found the bug and did the fix, just preparing the PR now :)

@jieyouxu jieyouxu removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Feb 23, 2025
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 23, 2025
avoid `compiler_for` for dist steps and force the current compiler

Using `compiler_for` in dist steps was causing to install stage1 tools into the dist tarballs, which doesn't match with the stage2 compiler.

Fixes rust-lang#137469
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 23, 2025
avoid `compiler_for` for dist tools and force the current compiler

Using `compiler_for` in dist steps was causing to install stage1 tools into the dist tarballs, which doesn't match with the stage2 compiler.

Fixes rust-lang#137469
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 23, 2025
avoid `compiler_for` for dist tools and force the current compiler

Using `compiler_for` in dist steps was causing to install stage1 tools into the dist tarballs, which doesn't match with the stage2 compiler.

Fixes rust-lang#137469
@bors bors closed this as completed in f8a913b Feb 23, 2025
RalfJung pushed a commit to RalfJung/miri that referenced this issue Feb 24, 2025
avoid `compiler_for` for dist tools and force the current compiler

Using `compiler_for` in dist steps was causing to install stage1 tools into the dist tarballs, which doesn't match with the stage2 compiler.

Fixes rust-lang/rust#137469
github-merge-queue bot pushed a commit to rust-lang/rust-analyzer that referenced this issue Feb 24, 2025
avoid `compiler_for` for dist tools and force the current compiler

Using `compiler_for` in dist steps was causing to install stage1 tools into the dist tarballs, which doesn't match with the stage2 compiler.

Fixes rust-lang/rust#137469
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. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

5 participants