FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[Bug]: Can't compile Mac · Issue #30480 · matplotlib/matplotlib · GitHub

Repository navigation

[Bug]: Can't compile Mac #30480

Closed
Closed

Description

Bug summary

When trying to build on a Mac (15.6.1), I get:

../../subprojects/freetype-2.6.1/src/gzip/infcodes.c:71:17: error: use of undeclared identifier 'Byte'
     71 |     c->dbits = (Byte)bd;
        |                 ^

This is in a micro mamba environment, made with environment.yml.

Matplotlib seems to run in dev mode, but I need to recompile to get pytest to work.

Code for reproduction

`python -m pip install --verbose --no-build-isolation --editable ".[dev]"`

Actual outcome

  In 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 */
        |       ^

...etc

Expected outcome

dev install

Additional information

No response

Operating system

MacOS 15.6.1

Matplotlib Version

main

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

conda

Activity

  1. tacaswell commented on Aug 28, 2025

    Member

    which compiler are you using ?

  2. jklymak commented on Aug 28, 2025

    MemberAuthor
    Obtaining file:///Users/jklymak/matplotlib
      Running command Checking if build backend supports build_editable
      Checking if build backend supports build_editable ... done
      Running command Preparing editable metadata (pyproject.toml)
      + meson setup /Users/jklymak/matplotlib /Users/jklymak/matplotlib/build/cp312 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/Users/jklymak/matplotlib/build/cp312/meson-python-native-file.ini
      The Meson build system
      Version: 1.9.0
      Source dir: /Users/jklymak/matplotlib
      Build dir: /Users/jklymak/matplotlib/build/cp312
      Build type: native build
      Program python found: YES 3.12.11 3.12.11
      Project name: matplotlib
      Project version: 3.11.0.dev1277+ge401f8235.d20250828
      C compiler for the host machine: arm64-apple-darwin20.0.0-clang (clang 19.1.7 "clang version 19.1.7")
      C linker for the host machine: arm64-apple-darwin20.0.0-clang ld64 954.16
      C++ compiler for the host machine: arm64-apple-darwin20.0.0-clang++ (clang 19.1.7 "clang version 19.1.7")
      C++ linker for the host machine: arm64-apple-darwin20.0.0-clang++ ld64 954.16
      Host machine cpu family: aarch64
      Host machine cpu: aarch64
      Program python found: YES (/Users/jklymak/micromamba/envs/mpl-dev/bin/python)
      Found pkg-config: YES (/Users/jklymak/micromamba/envs/mpl-dev/bin/pkg-config) 0.29.2
      Run-time dependency python found: YES 3.12
      Run-time dependency pybind11 found: YES 3.0.1
    
      Executing subproject freetype-2.6.1
    ...
    
  3. QuLogic commented on Aug 29, 2025

    Member

    Can you see if the text-overhaul branch (which has FreeType 2.13.3) works better?

  4. jklymak commented on Aug 29, 2025

    MemberAuthor

    @QuLogic Yes, that branch installs fine.

  5. QuLogic commented on Aug 29, 2025

    Member

    arm64-apple-darwin20.0.0-clang

    Is that the system compiler, or one that micromamba installed? If the latter, can you try removing it or vice versa?

  6. jklymak commented on Aug 29, 2025

    MemberAuthor

    Looks to be the micro mamba one:

    $ clang++ -v
    clang version 19.1.7
    Target: arm64-apple-darwin24.6.0
    Thread model: posix
    InstalledDir: /Users/jklymak/micromamba/envs/mpl-dev/bin
    

    I don't understand mamba well enough to know how to get the system C++. If I remove

    rm /Users/jklymak/micromamba/envs/mpl-dev/bin/arm64-apple-darwin20.0.0-clang*
    

    then I get

    raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'arm64-apple-darwin20.0.0-clang++'
    

    so the paths aren't set up properly to find the system clang.

  7. QuLogic commented on Aug 30, 2025

    Member

    Ah yes, after activating the environment, you can unset CC, CXX, CFLAGS, CXXFLAGS, and LDFLAGS I think, and then recreate your build directory to initialize with the system compiler.

  8. jklymak commented on Aug 30, 2025

    MemberAuthor

    I can unset all of those, but it still chooses arm64-apple-darwin20.0.0-clang which is the mamba clang (etc).

    Sorry, I can't really tell what meson is doing to "recreate (my) build directory". This is all using the matplotlib mamba environment, so do we need to be pinning the compiler somehow? Note we ask for c-compiler and cxx-compiler. Should we not?

  9. QuLogic commented on Aug 30, 2025

    Member

    Sorry, I can't really tell what meson is doing to "recreate (my) build directory".

    For an editable install, you would need to delete the build directory; it won't change compilers from environment variables for an existing build.

    This is all using the matplotlib mamba environment, so do we need to be pinning the compiler somehow?

    Possibly; I'm just unsure what changed. It seems like it was last updated a few weeks ago, but that was for the llvm21 release candidate, and you don't appear to be using that.

    Note we ask for c-compiler and cxx-compiler. Should we not?

    IIRC, we added these so we could have a self-contained environment on e.g., Windows or in devcontainers or indeed on macOS with Xcode.

  10. rongshaohzr-lang commented on Sep 8, 2025

    Do you solve this problem?

  11. jklymak commented on Sep 8, 2025

    MemberAuthor

    Not yet, I haven't had a lot of time. I tried pinning various versions of the micro mamba c compilers but didn't have any luck with that.

  12. jklymak commented on Oct 17, 2025

    MemberAuthor

    Attached is my meson log. This sees to be using the Xcode compilers (versus micro mamba). I got this by doing pixi init and then pixi install.

    meson-log.txt

  13. jklymak commented on Oct 17, 2025

    MemberAuthor

    #29247 purports to fix this, but unless I manually copy the zconf.h file into the subprojects/freetype-2.6.1/src/gzip directory, freetype will not compile. I found I also have to do

    pixi add meson-python meson ninja
    

    and then I had an editable pixi install on my Mac. If I didn't do that it was trying to pull ninja from a cache, and meson-python was not installed.

    So I'm not really at all clear on what meson is or how to fix this so it's more turnkey. At least on my system, it seems that the build scripts are not fully robust.

    To summarize:

    If I do

    cp subprojects/packagefiles/freetype-2.6.1-meson/src/gzip/zconf.h subprojects/freetype-2.6.1/src/gzip
    pixi init
    pixi add meson-python meson ninja
    

    I can run matplotlib from a local pixi environment.

  14. QuLogic commented on Jun 12, 2026

    Member

    We no longer use FreeType 2.6.1, and given #31384 (comment), I think this is well enough fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL