Skip to content

Commit a872a8d

Browse files
committed
(qb) Prefer system zlib on macOS
The vendored zlib in deps/libz (zlib 1.3) fails to compile against recent macOS SDKs (tested with macOS 26.x / Xcode CLT 21). Its zutil.h defines fdopen() as a macro expanding to NULL, which collides with the fdopen declaration in <stdio.h>: error: expected identifier or '(' FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(...); Upstream zlib fixed this in 1.3.1, but rather than bump the bundled copy for one platform, default HAVE_BUILTINZLIB to "no" on Darwin so the system libz is used. macOS has shipped a working libz for years and it's what the vast majority of Mac builds end up linking against anyway. Users who want the vendored copy can still pass --enable-builtinzlib explicitly; the override only triggers when HAVE_BUILTINZLIB is still at its default "auto" value.
1 parent 4e75fde commit a872a8d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

qb/config.libs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ if [ "$OS" = 'Darwin' ]; then
375375
HAVE_X11=no # X11 breaks on recent OSXes even if present.
376376
HAVE_SDL=no
377377
HAVE_SW2=no
378+
# Prefer the system zlib on macOS. The vendored copy in deps/libz
379+
# (zlib 1.3) no longer compiles against recent macOS SDKs because
380+
# its zutil.h defines fdopen() as a macro that collides with the
381+
# fdopen declaration in <stdio.h>. The system libz works fine.
382+
[ "$HAVE_BUILTINZLIB" = 'auto' ] && HAVE_BUILTINZLIB=no
378383
else
379384
check_lib '' AL -lopenal alcOpenDevice
380385
fi

0 commit comments

Comments
 (0)