Open
Description
Currently libz-sys is always building a static zlib library when cross-compiling, except on Apple platforms. Can I ask the reason of this? I have a shared zlib library in my rootfs, and pkg-config is working fine. With this config, I have a build failure because of library collision, like this:
/tmp/rustc0ZqD0F/liblibz_sys-84983a050a121d20.rlib(inflate.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol '__stack_chk_guard' which may bind externally can not be used when making a shared object; recompile with -fPIC
If I remove forcing this static library build, it is building fine:
index cab160ae6e6f..87e3e8664fd6 100644
--- a/build.rs
+++ b/build.rs
@@ -81,11 +81,11 @@ fn main() {
//
// Apple platforms have libz.1.dylib, and it's usually available even when
// cross compiling (via fat binary or in the target's Xcode SDK)
- let cross_compiling = target != host;
+ // let cross_compiling = target != host;
if target.contains("msvc")
|| target.contains("pc-windows-gnu")
|| want_static
- || (cross_compiling && !target.contains("-apple-"))
+ // || (cross_compiling && !target.contains("-apple-"))
{
return build_zlib(&mut cfg, &target);
}```