Skip to content

Commit

Permalink
rustc_llvm: Link zlib on cross Solaris builds
Browse files Browse the repository at this point in the history
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 rust-lang#75713 and rust-lang#75655.
  • Loading branch information
Alex Zepeda committed Aug 8, 2023
1 parent 14dd4e9 commit 6ef7813
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 6ef7813

Please sign in to comment.