about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-03 11:33:33 +0200
committerGitHub <noreply@github.com>2025-06-03 11:33:33 +0200
commit2da4bae07df9b7f8134b9ac57a43e4213938511d (patch)
tree360dfef3ea8091f3f66e50e697a01d7f21e525b3
parent807778ab7800b765ddf308fdcaf60ada3f23a305 (diff)
parent81f61acf77b539af47291f23d5eb2617878a3e2a (diff)
downloadrust-2da4bae07df9b7f8134b9ac57a43e4213938511d.tar.gz
rust-2da4bae07df9b7f8134b9ac57a43e4213938511d.zip
Rollup merge of #141817 - mati865:fix-system-libs-when-cross-compiling, r=cuviper
rustc_llvm: add Windows system libs only when cross-compiling from Wi…

…ndows

This obviously doesn't work when cross-compiling from Linux.

Split out from: https://github.com/rust-lang/rust/pull/140772

Fixes the issue described at [#general > Problems while trying to cross compile rustc for windows](https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/Problems.20while.20trying.20to.20cross.20compile.20rustc.20for.20windows/with/520508561)
-rw-r--r--compiler/rustc_llvm/build.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index a662694ac38..9a6549379d3 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -228,10 +228,10 @@ fn main() {
     let mut cmd = Command::new(&llvm_config);
     cmd.arg(llvm_link_arg).arg("--libs");
 
-    // Don't link system libs if cross-compiling unless targeting Windows.
+    // Don't link system libs if cross-compiling unless targeting Windows from Windows host.
     // On Windows system DLLs aren't linked directly, instead import libraries are used.
     // These import libraries are independent of the host.
-    if !is_crossed || target.contains("windows") {
+    if !is_crossed || target.contains("windows") && host.contains("windows") {
         cmd.arg("--system-libs");
     }