Skip to content

run-make test failures when building rust-with rpath disabled #140738

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

Open
jchecahi opened this issue May 7, 2025 · 0 comments
Open

run-make test failures when building rust-with rpath disabled #140738

jchecahi opened this issue May 7, 2025 · 0 comments
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-test-infra Area: test infrastructure (may span bootstrap/compiletest/more) C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jchecahi
Copy link

jchecahi commented May 7, 2025

Similar to #140299, we're seeing some run-make tests failing to run due to missing librustc_driver when building with rpath disabled:

<build-dir>/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-b8b100cea390592b.so: cannot open shared object file: No such file or directory

Tests that fail:

* [run-make] tests/run-make/broken-pipe-no-ice
* [run-make] tests/run-make/compiler-builtins
* [run-make] tests/run-make/rustc-crates-on-stable

The root cause is that these tests either:

  • Create a Command::new(env_var("RUSTC")) instead using the rustc() wrapper provided by run-make-support, or
  • Use the cargo() wrapper from run-make-support, which doesn't set the runtime library path (e.g. LD_LIBRARY_PATH) like rustc() does.

To reproduce in a clean tree:

./config --disable-rpath
python x.py test --force-rerun tests/run-make/{broken-pipe-no-ice,compiler-builtins,rustc-crates-on-stable}

Originally reproduced on beta (973ec11), still happens on latest master (71b68da).

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 7, 2025
jchecahi pushed a commit to jchecahi/rust that referenced this issue May 7, 2025
Some run-make tests invoke Cargo via run_make_support::cargo(), but fail to
execute correctly when rustc is built without rpath. In these setups, runtime
loading of rustc’s shared libraries fails unless the appropriate dynamic library
path is set manually.

This commit updates the cargo() wrapper to call set_host_compiler_dylib_path(),
aligning its behavior with the existing rustc() wrapper:
https://github.com/rust-lang/rust/blob/f76c7367c6363d33ddb5a93b5de0d158b2d827f6/src/tools/run-make-support/src/external_deps/rustc.rs#L39

This ensures that Cargo invocations during tests inherit the necessary dylib
paths, avoiding errors related to missing shared libraries in rpath-less builds.

Fixes part of rust-lang#140738
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. A-run-make Area: port run-make Makefiles to rmake.rs A-test-infra Area: test infrastructure (may span bootstrap/compiletest/more) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 7, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue May 7, 2025
…stc-dylib, r=jieyouxu

run-make-support: set rustc dylib path for cargo wrapper

Some run-make tests invoke Cargo via run_make_support::cargo(), but fail to execute correctly when rustc is built without rpath. In these setups, runtime loading of rustc’s shared libraries fails unless the appropriate dynamic library path is set manually.

This commit updates the cargo() wrapper to call set_host_compiler_dylib_path(), aligning its behavior with the existing rustc() wrapper: https://github.com/rust-lang/rust/blob/f76c7367c6363d33ddb5a93b5de0d158b2d827f6/src/tools/run-make-support/src/external_deps/rustc.rs#L39-L43

This ensures that Cargo invocations during tests inherit the necessary dylib paths, avoiding errors related to missing shared libraries in rpath-less builds.

Fixes part of rust-lang#140738
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 8, 2025
Rollup merge of rust-lang#140745 - jchecahi:run-make-support-cargo-rustc-dylib, r=jieyouxu

run-make-support: set rustc dylib path for cargo wrapper

Some run-make tests invoke Cargo via run_make_support::cargo(), but fail to execute correctly when rustc is built without rpath. In these setups, runtime loading of rustc’s shared libraries fails unless the appropriate dynamic library path is set manually.

This commit updates the cargo() wrapper to call set_host_compiler_dylib_path(), aligning its behavior with the existing rustc() wrapper: https://github.com/rust-lang/rust/blob/f76c7367c6363d33ddb5a93b5de0d158b2d827f6/src/tools/run-make-support/src/external_deps/rustc.rs#L39-L43

This ensures that Cargo invocations during tests inherit the necessary dylib paths, avoiding errors related to missing shared libraries in rpath-less builds.

Fixes part of rust-lang#140738
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-test-infra Area: test infrastructure (may span bootstrap/compiletest/more) C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants