PR summary
Freetype 2.6.1 has an outdated copy of a zlib header (like from ~1998) which has a bad check for choosing whether to define Byte on macOS. This adds a patched version of the zconf.h header that has a proper check forMACTYPES, which is defined by the macOS SDK.
For posterity, the failure occurred over on conda-forge and looked like:
FAILED: subprojects/freetype-2.6.1/libfreetype.a.p/src_gzip_ftgzip.c.o x86_64-apple-darwin13.4.0-clang -Isubprojects/freetype-2.6.1/libfreetype.a.p -Isubprojects/freetype-2.6.1 -I../subprojects/freetype-2.6.1 -I../subprojects/freetype-2.6.1/include -fvisibility=hidden -flto -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -O3 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -isystem /Users/runner/miniforge3/conda-bld/matplotlib-suite_1733188751163/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/matplotlib-suite_1733188751163/work=/usr/local/src/conda/matplotlib-base-3.9.3 -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/matplotlib-suite_1733188751163/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl=/usr/local/src/conda-prefix -D_FORTIFY_SOURCE=2 -isystem /Users/runner/miniforge3/conda-bld/matplotlib-suite_1733188751163/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include -mmacosx-version-min=10.13 -mmacosx-version-min=10.13 -DFT2_BUILD_LIBRARY '-DFT_CONFIG_CONFIG_H=<ftconfig.h>' '-DFT_CONFIG_OPTIONS_H=<ftoption.h>' -MD -MQ subprojects/freetype-2.6.1/libfreetype.a.p/src_gzip_ftgzip.c.o -MF subprojects/freetype-2.6.1/libfreetype.a.p/src_gzip_ftgzip.c.o.d -o subprojects/freetype-2.6.1/libfreetype.a.p/src_gzip_ftgzip.c.o -c ../subprojects/freetype-2.6.1/src/gzip/ftgzip.cIn file included from ../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:65:In file included from ../subprojects/freetype-2.6.1/src/gzip/zlib.h:34:../subprojects/freetype-2.6.1/src/gzip/zconf.h:228:12: error: unknown type name 'Byte' 228 | typedef Byte FAR Bytef; | ^In file included from ../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:83:../subprojects/freetype-2.6.1/src/gzip/inftrees.h:22:7: error: unknown type name 'Byte' 22 | Byte Exop; /* number of extra bits or operation */ | ^../subprojects/freetype-2.6.1/src/gzip/inftrees.h:23:7: error: unknown type name 'Byte' 23 | Byte Bits; /* number of bits in this code or subcode */ | ^In file included from ../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:91:../subprojects/freetype-2.6.1/src/gzip/inftrees.c:247:21: error: use of undeclared identifier 'Byte' 247 | r.bits = (Byte)l; /* bits to dump before this table */ | ^../subprojects/freetype-2.6.1/src/gzip/inftrees.c:248:21: error: use of undeclared identifier 'Byte' 248 | r.exop = (Byte)j; /* bits in this table */ | ^../subprojects/freetype-2.6.1/src/gzip/inftrees.c:258:17: error: use of undeclared identifier 'Byte' 258 | r.bits = (Byte)(k - w); | ^../subprojects/freetype-2.6.1/src/gzip/inftrees.c:263:19: error: use of undeclared identifier 'Byte' 263 | r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ | ^../subprojects/freetype-2.6.1/src/gzip/inftrees.c:268:19: error: use of undeclared identifier 'Byte' 268 | r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */ | ^In file included from ../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:93:../subprojects/freetype-2.6.1/src/gzip/infcodes.c:50:3: error: unknown type name 'Byte' 50 | Byte lbits; /* ltree bits decoded per branch */ | ^../subprojects/freetype-2.6.1/src/gzip/infcodes.c:51:3: error: unknown type name 'Byte' 51 | Byte dbits; /* dtree bits decoder per branch */ | ^../subprojects/freetype-2.6.1/src/gzip/infcodes.c:70:17: error: use of undeclared identifier 'Byte' 70 | c->lbits = (Byte)bl; | ^../subprojects/freetype-2.6.1/src/gzip/infcodes.c:71:17: error: use of undeclared identifier 'Byte' 71 | c->dbits = (Byte)bd; | ^../subprojects/freetype-2.6.1/src/gzip/infcodes.c:204:9: error: use of undeclared identifier 'Byte' 204 | OUTBYTE(*f++) | ^../subprojects/freetype-2.6.1/src/gzip/infutil.h:83:27: note: expanded from macro 'OUTBYTE' 83 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} | ^In file included from ../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:93:../subprojects/freetype-2.6.1/src/gzip/infcodes.c:213:7: error: use of undeclared identifier 'Byte' 213 | OUTBYTE(c->sub.lit) | ^../subprojects/freetype-2.6.1/src/gzip/infutil.h:83:27: note: expanded from macro 'OUTBYTE' 83 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} | ^../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:305:23: warning: incompatible pointer types assigning to 'Bytef *' (aka 'int *') from 'FT_Byte[4096]' (aka 'unsigned char[4096]') [-Wincompatible-pointer-types] 305 | zstream->next_in = zip->buffer; | ^ ~~~~~~~~~~~../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:354:26: warning: incompatible pointer types assigning to 'Bytef *' (aka 'int *') from 'FT_Byte[4096]' (aka 'unsigned char[4096]') [-Wincompatible-pointer-types] 354 | zstream->next_in = zip->input; | ^ ~~~~~~~~~~../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:356:26: warning: incompatible pointer types assigning to 'Bytef *' (aka 'int *') from 'FT_Byte[4096]' (aka 'unsigned char[4096]') [-Wincompatible-pointer-types] 356 | zstream->next_out = zip->buffer; | ^ ~~~~~~~~~~~../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:401:23: warning: incompatible pointer types assigning to 'Bytef *' (aka 'int *') from 'FT_Byte[4096]' (aka 'unsigned char[4096]') [-Wincompatible-pointer-types] 401 | zstream->next_in = zip->input; | ^ ~~~~~~~~~~../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:416:24: warning: incompatible pointer types assigning to 'Bytef *' (aka 'int *') from 'FT_Byte *' (aka 'unsigned char *') [-Wincompatible-pointer-types] 416 | zstream->next_out = zip->cursor; | ^ ~~~~~~~~~~~../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:435:20: warning: incompatible pointer types assigning to 'FT_Byte *' (aka 'unsigned char *') from 'Bytef *' (aka 'int *') [-Wincompatible-pointer-types] 435 | zip->limit = zstream->next_out; | ^ ~~~~~~~~~~~~~~~~~../subprojects/freetype-2.6.1/src/gzip/ftgzip.c:730:22: warning: incompatible pointer types assigning to 'Bytef *' (aka 'int *') from 'FT_Byte *' (aka 'unsigned char *') [-Wincompatible-pointer-types] 730 | stream.next_out = output; | ^ ~~~~~~7 warnings and 14 errors generated.
I'm using the Meson support for dropping in a new entire file, but the diff vs. the version that shipped with freetype 2.6.1:
--- zconf.h.orig2024-12-02 16:53:07+++ zconf.h2024-12-02 16:53:14@@ -215,7 +215,7 @@ # define FAR #endif-#if !defined(MACOS) && !defined(TARGET_OS_MAC)+#if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */
Research shows this change came tozlib around 1.2.0, released over 20 years ago. 🤯
PR summary
Freetype 2.6.1 has an outdated copy of a zlib header (like from ~1998) which has a bad check for choosing whether to define Byte on macOS. This adds a patched version of the zconf.h header that has a proper check forMACTYPES, which is defined by the macOS SDK.
For posterity, the failure occurred over on conda-forge and looked like:
I'm using the Meson support for dropping in a new entire file, but the diff vs. the version that shipped with freetype 2.6.1:
Research shows this change came tozlib around 1.2.0, released over 20 years ago. 🤯