Open genotrance opened 7 months ago
Hi @genotrance , as far as I remember setuptools/ distutils do not fully support mingw
yet. There is a feature request in distutils
that mentions that:
https://github.com/pypa/distutils/issues/34
If you are interested in such feature I believe, you can join the discussion and/or contribute to the implementation via PRs.
@abravalheri - mingw32 works great, except for linking to the specific Python version. If I manuallly change the link command and update the wheel, it works on all Python versions. So the compile works fine, just not the link.
If this is a distutils issue, can this ticket be moved to that repo?
I believe that all the MingW discussions are happening in the pypa/distutils
repository, so yeah, I think it would be better to investigate the issue there. Although I don't have the admin rights to manually transfer the issue, you might be interested in opening a new one there.
We currently patch this downstream like this: https://github.com/msys2/MINGW-packages/blob/10f6dec302dc204bc084baa5a68b24e1ef29405e/mingw-w64-python-setuptools/0010-support-py_limited_api.patch
Since the py-limited-api is a setuptools and not a distutils feature I think it makes sense to keep the discussion here. Unless we make distutils optionally depend on the setuptools subclass.
setuptools version
69.0.3
Python version
3.12
OS
Windows
Additional environment information
No response
Description
Using cffi to generate a wrapper for libcurl. On Windows, cffi links with
-lpython312
for mingw and so the build does not work on other versions of Python.Manually changing the
-lpython312
to-lpython3
fixes the issue. I'm not sure where this command gets generated - opened issue with cffi who redirected to setuptools.Python build command line I used is as follows:
This works fine on Linux and OSX which don't need the
--compiler=mingw32
flag but link with-lpython3
, making the wheels generated functional with all versions of Python since 3.2.Expected behavior
setuptools should link with
-lpython3
when using--py-limited-api
with mingw32.How to Reproduce
On Windows with mingw32-x64 installed (scoop install mingw):
Will get a wheel created which will only run on the Python version that was used to build the wheel.
Output