Skip to content

Fix run-make tests on musl hosts #144235

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

Merged
merged 1 commit into from
Jul 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/tools/run-make-support/src/external_deps/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,20 @@ impl Rustc {
// `rustc` invocation constructor methods

/// Construct a new `rustc` invocation. This will automatically set the library
/// search path as `-L cwd()` and also the compilation target.
/// search path as `-L cwd()`, configure the compilation target and enable
/// dynamic linkage by default on musl hosts.
/// Use [`bare_rustc`] to avoid this.
#[track_caller]
pub fn new() -> Self {
let mut cmd = setup_common();
cmd.arg("-L").arg(cwd());

// FIXME: On musl hosts, we currently default to static linkage, while
// for running run-make tests, we rely on dynamic linkage by default
if std::env::var("IS_MUSL_HOST").is_ok_and(|i| i == "1") {
cmd.arg("-Ctarget-feature=-crt-static");
}

// Automatically default to cross-compilation
Self { cmd, target: Some(target()) }
}
Expand Down
Loading