Skip to content

Commit 90883f0

Browse files
committed
Fix linking to zlib when cross-compiling
1 parent 83b8942 commit 90883f0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/rustc_llvm/build.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ fn main() {
234234
// of llvm-config, not the target that we're attempting to link.
235235
let mut cmd = Command::new(&llvm_config);
236236
cmd.arg(llvm_link_arg).arg("--libs");
237+
cmd.arg("--system-libs");
238+
cmd.args(&components);
237239

238-
if !is_crossed {
239-
cmd.arg("--system-libs");
240-
} else if target.contains("windows-gnu") {
240+
if target.contains("windows-gnu") {
241241
println!("cargo:rustc-link-lib=shell32");
242242
println!("cargo:rustc-link-lib=uuid");
243243
} else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") {
@@ -250,7 +250,6 @@ fn main() {
250250
// 32-bit targets need to link libatomic.
251251
println!("cargo:rustc-link-lib=atomic");
252252
}
253-
cmd.args(&components);
254253

255254
for lib in output(&mut cmd).split_whitespace() {
256255
let name = if let Some(stripped) = lib.strip_prefix("-l") {

0 commit comments

Comments
 (0)