-
Notifications
You must be signed in to change notification settings - Fork 73
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
[BUG] self.linker_ex: TypeError: 'NoneType' object is not subscriptable #283
Comments
We are seeing the same problem with building Matplotlib wheels, though not directly. It's actually failing on A bisect points to 0ab156c3e12054503a0dac0ce172e241262881f4, which is not too surprising, I think. Bisecting |
It looks like PyPy only just added diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py
index fbdd5d73..19ea6aa0 100644
--- a/distutils/sysconfig.py
+++ b/distutils/sysconfig.py
@@ -321,6 +321,9 @@ def customize_compiler(compiler):
)
cxxflags = cflags
+ if ldcxxshared is None:
+ # Older versions of PyPy do not set LDCXXSHARED.
+ ldcxxshared = ldshared
if 'CC' in os.environ:
newcc = os.environ['CC'] |
Actually, looking at the commit again, it appears that diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py
index fbdd5d73..29a2ba36 100644
--- a/distutils/sysconfig.py
+++ b/distutils/sysconfig.py
@@ -362,11 +362,13 @@ def customize_compiler(compiler):
compiler_cxx=cxx_cmd,
compiler_so_cxx=cxx_cmd + ' ' + ccshared,
linker_so=ldshared,
- linker_so_cxx=ldcxxshared,
linker_exe=cc,
linker_exe_cxx=cxx,
archiver=archiver,
)
+ if ldcxxshared is not None:
+ # Older versions of PyPy do not set LDCXXSHARED.
+ compile.set_executable('linker_so_cxx', ldcxxshared)
if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None):
compiler.set_executables(ranlib=os.environ['RANLIB']) |
This is needed due to https://github.com/pypa/setuptools/issues/4571.
Due to https://github.com/pypa/setuptools/issues/4571, kiwisolver fails to build on PyPy. Until kiwisolver has PyPy 3.10 wheels (nucleic/kiwi#182), we should avoid the buggy setuptools.
Due to https://github.com/pypa/setuptools/issues/4571, kiwisolver fails to build on PyPy. Until kiwisolver has PyPy 3.10 wheels (nucleic/kiwi#182), we should avoid the buggy setuptools.
The patches above need a few more None checks for CXXFLAGS and LDCXXSHARED cases, but yeah, moving to distutils sounds good to me. I wonder why CI didn't catch this. |
setuptools version 72.2.0 contains the change that does not allow to build C++ native extension for PyPy, because it does not provide the LDCXXSHARED configuration variable: https://github.com/pypa/setuptools/issues/4571
See #228 where this behavior was added. That PR and the one that preceded it were tricky to get right, especially due to the nuances of manipulating the sysconfig variables and the different locations where those variables are defined. I see now how that PR caused a regression. Prior to this change, distutils and setuptools would treat C++ like C, only honoring the C configs and environment and disregarding the C++ settings. With the change, it now honors the C++ settings for C++ extensions, but there are some environments that don't yet have C++ settings configured. In that case, we want distutils to fall back to the old behavior (C settings).
We should definitely determine the answer. If the current tests don't cover the condition (and it seems they don't), we'll want to manifest a test that does capture the missed expectation. |
…f pp3.9 Error is: File "/tmp/build-env-xb6cqppy/lib/pypy3.9/site-packages/setuptools/_distutils/unixccompiler.py", line 268, in link linker = ( TypeError: 'NoneType' object is not subscriptable (key slice(None, None, None)) Unclear if this is due to pybind11 needing an adjustment for setuptools 72 https://github.com/pypa/setuptools/blob/main/NEWS.rst or cibuildwheel needs something patched.
Looking at the original PR, |
This has now been released in last week's PyPy3.10 v7.3.17:
GitHub Actions is still on 7.3.16: Reported: actions/setup-python#936 |
Could you add |
Thanks, that does force 7.3.17 to be installed and now it passes for Ubuntu but fails for macOS with a different error:
https://github.com/hugovk/ultrajson/actions/runs/10676841128 |
I wonder where that is coming from. As far as I can tell, it is not here (distutils) nor in PyPy. Is it an xcode default? |
It avoids issue pypa/distutils#283, which currently breaks the PyPI workflow.
Until pypa/distutils#283 is fixed upstream.
Until pypa/distutils#283 is fixed upstream.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
##### v1.2.1 - Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). - Rebuild Cython wrapper with Cython 3.0.11.
…version 1.2.1 1.2.1 (2024-10-12) ------------------ * Publish Python 3.13 wheels (only CPython ones, PyPy ones are skipped until pypa/distutils#283 is fixed). * Rebuild Cython wrapper with Cython 3.0.11.
pypa/distutils#283 still seems not fixed... #216
disable pypy 3.8, see pypa/distutils#283
Fixes builds using the latest cibuildwheel. Due to incompatible changes introduced upstream pypy(pypa/distutils#283) had to be taken out for now.
setuptools version
setuptools==72.2.0
Python version
Python 3.8.16 (PyPy 7.3.11)
OS
Ubuntu 20.04
Additional environment information
This issue occurs only when I run setuptools with PyPy; it works fine with CPython. Downgrading to setuptools version 72.1.0 resolves the issue for both PyPy and CPython.
Description
When building a Cython extension that depends on a shared library, setuptools triggers a
TypeError
during the linking process.Expected behavior
setuptools doesn't fail.
How to Reproduce
Create a file named
hello_world.cpp
:Create a file named
hello_world.h
:On Linux, compile this into a shared library using:
Create a file named
hello.pyx
:Create a
setup.py
file to build the Cython extension:Run the following command in the terminal:
Output
The text was updated successfully, but these errors were encountered: