From f5d75594bbb70a666313a1f82a9e77ca796f8bee Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Sun, 15 Sep 2024 21:31:30 +0200 Subject: [PATCH] Freetype fails to find freetype on macos src/checkdep_freetype2.c:8:10: fatal error: 'ft2build.h' file not found #include ^~~~~~~~~~~~ 2 errors generated. error: command '/usr/bin/gcc' failed with exit code 1 Sage skips installing zlib on macos because it is installed as part of XCode. The freetype configuration uses freetype-config which ends up using pkg-config to find zlib. In their infinite wisdom, Apple does not ship the .pc file: vbraun@Mini-M2 local % ./bin/freetype-config Package zlib was not found in the pkg-config search path. Perhaps you should add the directory containing `zlib.pc' to the PKG_CONFIG_PATH environment variable Package 'zlib', required by 'libpng', not found Package zlib was not found in the pkg-config search path. Perhaps you should add the directory containing `zlib.pc' to the PKG_CONFIG_PATH environment variable Package 'zlib', required by 'libpng', not found Solution is to require a zlib.pc file via PKG_CHECK_MODULES([zlib], ... --- build/pkgs/freetype/dependencies | 2 +- build/pkgs/zlib/spkg-configure.m4 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build/pkgs/freetype/dependencies b/build/pkgs/freetype/dependencies index af0f47547a8..f4fd858f697 100644 --- a/build/pkgs/freetype/dependencies +++ b/build/pkgs/freetype/dependencies @@ -1,4 +1,4 @@ -libpng bzip2 +libpng bzip2 zlib ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/zlib/spkg-configure.m4 b/build/pkgs/zlib/spkg-configure.m4 index c2e3b7059c0..dc1a3cd9ab1 100644 --- a/build/pkgs/zlib/spkg-configure.m4 +++ b/build/pkgs/zlib/spkg-configure.m4 @@ -1,7 +1,8 @@ SAGE_SPKG_CONFIGURE([zlib], [ + PKG_CHECK_MODULES([zlib], [zlib >= 1.2.11], [zlib_cv_pc=yes], [zlib_cv_pc=no]) AC_CHECK_LIB([z], [inflateEnd], [zlib_cv_libz=yes], [zlib_cv_libz=no]) AC_CHECK_HEADER([zlib.h], [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no]) - if test "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes"; then + if test "$zlib_cv_pc" = "yes" && "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes"; then PKG_CHECK_MODULES([LIBPNG], [libpng >= 1.2], [], [ dnl inflateValidate is needed for Sage's libpng, newer than 1.2; this ensures dnl we have the minimum required for building zlib version