Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
donn opened this issue Sep 29, 2024 · 1 comment
Open

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

donn opened this issue Sep 29, 2024 · 1 comment

Comments

@donn
Copy link

donn commented Sep 29, 2024

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

@henryiii
Copy link
Contributor

henryiii commented Oct 2, 2024

You should not depend on python3-config being present if you are in Python - instead, you should use sysconfig directly. (Or use a modern build system like scikit-build-core or meson-python).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants