1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
From: Jesus Checa Hidalgo <jchecahi@redhat.com>
Date: Wed, 7 May 2025 16:32:46 +0200
Subject: run-make-support: set rustc dylib path for cargo wrapper
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
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 #140738
(cherry picked from commit cd2dc67eadb6105790520223965deef6c5887f7a)
---
src/tools/run-make-support/src/external_deps/cargo.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/tools/run-make-support/src/external_deps/cargo.rs b/src/tools/run-make-support/src/external_deps/cargo.rs
index e91d101..8da9f00 100644
--- a/src/tools/run-make-support/src/external_deps/cargo.rs
+++ b/src/tools/run-make-support/src/external_deps/cargo.rs
@@ -1,8 +1,11 @@
use crate::command::Command;
use crate::env_var;
+use crate::util::set_host_compiler_dylib_path;
/// Returns a command that can be used to invoke cargo. The cargo is provided by compiletest
/// through the `CARGO` env var.
pub fn cargo() -> Command {
- Command::new(env_var("CARGO"))
+ let mut cmd = Command::new(env_var("CARGO"));
+ set_host_compiler_dylib_path(&mut cmd);
+ cmd
}
|