-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Building Rust with rpath disabled causes ~3k test failures in Cargo #140299
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
Comments
Here's a little more output:
That comes from here: let output = ProcessBuilder::new("rustc")
.arg("-vV")
.exec_with_output()
.expect("rustc should exec"); Note that this is not using |
Couldn't reproduce this on 6e23095 with the following config: profile = "dist"
[llvm]
download-ci-llvm = false
[rust]
lld = false
rpath = false
[target.x86_64-unknown-linux-gnu]
llvm-config = "/home/nimda/devspace/.other/llvm-19/bin/llvm-config" |
I just tried a clean build with your config on that commit, only changing the llvm-config path, and |
Maybe it was due to my existing build cache, will try it again later tomorrow. |
…ieyouxu extend the list of registered dylibs on `test::prepare_cargo_test` self-explanatory Fixes rust-lang#140299
Rollup merge of rust-lang#140563 - onur-ozkan:extend-dylib-paths, r=jieyouxu extend the list of registered dylibs on `test::prepare_cargo_test` self-explanatory Fixes rust-lang#140299
Summary
When building Rust with rpath disabled (using
--disable-rpath
), the majority of Cargo tests fail due to a missing librustc_driver:Fedora disables rpath in its builds, and this has not been an issue up to Rust 1.86.0, since the bootstrap process correctly passed the appropriate
LD_LIBRARY_PATH
. We started encountering failures while preparing builds for the 1.87.0 beta.I was able to reproduce and bisect the issue using a clean repository with the following script:
Using this, I traced the regression to the following PR: #137215
From inspecting the output of
x.py test -vv
, it seems the issue is related to the combination of howLD_LIBRARY_PATH
is set by bootstrap and possibly some cleanup logic. I wasn't able to fully trace the exact logic, but here are my observations.Before that PR, Cargo tests were run using the stage 2 compiler, and the library path passed by bootstrap was:
This directory does include the librustc_driver dynamic library.
After the PR, the compiler being used is now stage 1, as indicated by bootstrap logs such as:
The library path passed now is:
But in this case, the test errors with:
If I search for that library, I can find it in several locations, but not in the path that bootstrap passes:
As a workaround, the tests can be run successfully using:
However, I believe this behavior deserves closer attention from the bootstrap team. It's possible that the stage 1 switch introduced an unintended change in how the dynamic libraries are located, especially when rpath is disabled.
Let me know if you need help reproducing the issue in a clean environment.
When building Rust with
--disable-rpath
, most Cargo tests fail due to missing dynamic libraries, notably librustc_driver. This started happening after PR #137215, which changed Cargo to use the stage1 compiler instead of stage2 during tests. The bootstrap no longer passes the correct LD_LIBRARY_PATH for the dynamic libraries in this configuration, breaking Fedora builds (which disable rpath).Command used
Expected behaviour
Cargo tests are run without rustc reporting any missing dynamic libraries
Actual behaviour
+3000 cargo test failures due to missing rustc_driver dynamic library
Bootstrap configuration (bootstrap.toml)
Operating system
Fedora 43 Rawhide (reproducible on a clean environment)
HEAD
bb2cc59
Also reproducible on current beta (386abeb) and master(7f69523) branches.
Additional context
Build Log
The text was updated successfully, but these errors were encountered: