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

50.0.0 can't build extensions for Python < 3.8 if Py_ENABLE_SHARED #9

Closed
godlygeek opened this issue Aug 31, 2020 · 2 comments · Fixed by #10
Closed

50.0.0 can't build extensions for Python < 3.8 if Py_ENABLE_SHARED #9

godlygeek opened this issue Aug 31, 2020 · 2 comments · Fixed by #10

Comments

@godlygeek
Copy link

For Python 3.7 and lower, if the interpreter is built as Py_ENABLE_SHARED, the interpreter core is built into a libpython shared library, and extension modules built for that interpreter need to link against that shared library when they are built. This changed in 3.8:

On Unix, C extensions are no longer linked to libpython except on Android and Cygwin.

setuptools 50.0.0 does not include libpython in the link command when building for a Python 3.7 Py_ENABLE_SHARED interpreter, so extensions that can build successfully with 49.6.0 fail to link with 50.0.0.

Presumably this is because 50.0.0 is using a vendored distutils that was copied from a recent CPython, and support for linking against libpython was dropped there because it is no longer used after 3.8, but it is still required for older versions.

@godlygeek
Copy link
Author

godlygeek commented Aug 31, 2020

Specifically python/cpython@8c3ecc6 removed the logic to use Py_ENABLE_SHARED to decide whether to include libpython in the link command, and it was later added back in for Cygwin and Android. The version vendored into 50.0.0: https://github.com/pypa/setuptools/blob/17cb9d6bf249cefe653d3bdb712582409035a7db/setuptools/_distutils/command/build_ext.py#L736-L750 never sets link_libpython to True on non-Cygwin, non-Android platforms.

openstack-mirroring referenced this issue in openstack/project-config Aug 31, 2020
setuptools==50 doesn't work with python older than python3.8. There are
a number of issues [0][1][2] the first of which we are tripping over. Be
conservative here and install older setuptools until these issues on
python3.5, 3.6, and 3.7 are sorted out.

[0] pypa/setuptools#2352
[1] https://github.com/pypa/setuptools/issues/2363
[2] pypa/setuptools#2357

Change-Id: I1ae7251c8a4c214544524871fdfe51e947b638f8
@jaraco jaraco transferred this issue from pypa/setuptools Sep 1, 2020
@jaraco jaraco closed this as completed in #10 Sep 2, 2020
@jaraco
Copy link
Member

jaraco commented Sep 2, 2020

Fix releasing with setuptools 50.0.3.

This was referenced Sep 2, 2020
This was referenced Oct 15, 2020
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

Successfully merging a pull request may close this issue.

2 participants