Skip to content

macOS: venvs lacking python3-config causes some builds to fail #2021

Description

@donn

Description

Some more complex C/C++ libraries need python3-config to get ldflags, include directories, etc.

On Linux, because each version of Python is in its own container, this works fine.

On macOS, because cibuildwheel relies entirely on virtualenvs and does not put /Library/Frameworks/Python.framework/Versions/{current_version}/bin in PATH, python3-config defaults to the system-wide Python 3.11/3.12 installation. Meaning any non-trivial C/C++ extensions may fail (and not even outright fail to build- wheels produced may fail to import because of missing symbols due to ABI breaks.)

A fix to this would be to prepend /Library/Frameworks/Python.framework/Versions/{current_version}/bin to PATH during builds.

For users currently blocked by this, a possible workaround is adding this in your CIBW_BEFORE_BUILD:

ln -s $(dirname $(readlink -f $(which python3)))/python3-config $(dirname $(which python3))/python3-config

Build log

https://github.com/donn/cibw_clobber/actions/runs/11091306625/job/30814862405

CI config

https://github.com/donn/cibw_clobber/blob/main/.github/workflows/ci.yml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions