about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Zepeda <github@inferiorhumanorgans.com>2023-08-07 17:11:01 -0700
committerAlex Zepeda <github@inferiorhumanorgans.com>2023-08-07 17:19:30 -0700
commit6ef7813cf0a7f591ec6709e06a4ce1c1ebc8f223 (patch)
treefdfe1714aee2a0d51ff277e9090ed1a95154538a
parent14dd4e97a80c55a9140017ab13d0d8000977b274 (diff)
downloadrust-6ef7813cf0a7f591ec6709e06a4ce1c1ebc8f223.tar.gz
rust-6ef7813cf0a7f591ec6709e06a4ce1c1ebc8f223.zip
rustc_llvm: Link `zlib` on cross Solaris builds
On native builds `llvm-config` picks up `zlib` and this gets pased into
the rust build tools, but on cross builds `llvm-config` is explicitly
ignored as it contains information for the host system and cannot be
trusted to be accurate for the target system.

Both DragonFly and Solaris contain `zlib` in the base system, so this is
both a safe assumption and required for a successful cross build unless
`zlib` support is disabled in LLVM.

This is more or less in the same vein as #75713 and #75655.
-rw-r--r--compiler/rustc_llvm/build.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index c3ab4312c02..a4986b94ea2 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -251,7 +251,9 @@ fn main() {
     } else if target.contains("windows-gnu") {
         println!("cargo:rustc-link-lib=shell32");
         println!("cargo:rustc-link-lib=uuid");
-    } else if target.contains("haiku") || target.contains("darwin") || target.contains("dragonfly")
+    } else if target.contains("haiku")
+        || target.contains("darwin")
+        || (is_crossed && (target.contains("dragonfly") || target.contains("solaris")))
     {
         println!("cargo:rustc-link-lib=z");
     } else if target.contains("netbsd") {