From 817bbc0c6d3596a06ab5374dba6d0ad298397040 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Thu, 2 Apr 2026 23:29:46 -0400 Subject: [PATCH] fix(zlib): remove unnecessary defines in madler/zlib@81cc0bebe, zlib started using EWOULDBLOCK, which when `-D_POSIX_SOURCE` is set, FreeBSD would hide `#define EWOULDBLOCK EAGAIN`. See However, `_POSIX_SOURCE` isn't really set in `./configure` or `CMakeLists.txt`. We should follow whatever upstream native build does, rather than do our own way. Along with `_POSIX_SOURCE`, `_C99_SOURCE` (apple), `_XOPEN_SOURCE` (solaris) are removed aslo. This was found in * * The rust-lang/rust try-build suceeded with a couple of tier 2 platforms: * dist-powerpc-linux * dist-riscv64-linux * dist-s390x-linux * dist-sparcv9-solaris * dist-x86_64-apple * dist-x86_64-illumos * dist-x86_64-netbsd * dist-x86_64-solaris * x86_64-freebsd --- build.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/build.rs b/build.rs index 84d87f7d..4cd8291d 100644 --- a/build.rs +++ b/build.rs @@ -135,15 +135,8 @@ fn build_zlib(cfg: &mut cc::Build, target: &str) { if !target.contains("windows") { cfg.define("_LARGEFILE64_SOURCE", None); - cfg.define("_POSIX_SOURCE", None); cfg.flag("-fvisibility=hidden"); } - if target.contains("apple") { - cfg.define("_C99_SOURCE", None); - } - if target.contains("solaris") { - cfg.define("_XOPEN_SOURCE", "700"); - } cfg.compile("z");