Skip to content

Commit

Permalink
sagemathgh-38663: Freetype fails to find freetype on macos
Browse files Browse the repository at this point in the history
Freetype fails to find freetype on macos (Mac mini M2 with only XCode
installed):

    src/checkdep_freetype2.c:8:10: fatal error: 'ft2build.h' file not
found
    #include <ft2build.h>
             ^~~~~~~~~~~~
    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], ...

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->

URL: sagemath#38663
Reported by: Volker Braun
Reviewer(s):
  • Loading branch information
Release Manager committed Sep 22, 2024
2 parents d1f99d1 + d1d2045 commit 9237da3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
sha1=2cdffd348b8a4de62b51e1f6c37a7d414004c09e
sha256=273c37842eedefc3575e34bb14819ab3738a32c39ae634f2342bb50baa740c60
sha1=3626b3080612482186852b8ce9f2444373bc3da3
sha256=4203271d92d1a9152a75ac5c0b40f80ecd3d235d108e0711de9d3e33570e2973
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9b58ceaa68960b38142f27fdfc04373301da4e46
e322c219ac0cc4e41bf974a2f7a0c2b019da85d3
3 changes: 2 additions & 1 deletion build/pkgs/zlib/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -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" && test "$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
Expand Down

0 comments on commit 9237da3

Please sign in to comment.