[Python-Dev] Status of C compilers for Python on Windows

Paul Moore p.f.moore at gmail.com
Mon Oct 27 18:48:40 CET 2014


On 26 October 2014 23:44, Paul Moore <p.f.moore at gmail.com> wrote:
> On 26 October 2014 23:11, Ray Donnelly <mingw.android at gmail.com> wrote:
>> I don't know where this "ABI compatible" thing came into being;
>
> Simple. If a mingw-built CPython doesn't work with the same extensions
> as a MSVC-built CPython, then the community gets fragmented (because
> you can only use the extensions built for your stack). Assuming numpy
> needs mingw and ultimately only gets built for a mingw-compiled Python
> (because the issues building for MSVC-built Python are too hard) and
> assuming that nobody wants to make the effort to build pywin32 under
> mingw, then what does someone who needs both numpy and pywin32 do?
>
> Avoiding that issue is what I mean by ABI-compatible. (And that's all
> I mean by it, nothing more subtle or controversial).
>
> I view it as critical (because availability of binaries is *already*
> enough of a problem in the Windows world, without making it worse)
> that we avoid this sort of fragmentation. I'm not seeing an
> acknowledgement from the mingw side that they agree. That's my
> concern. If we both agree, there's nothing to argue about.

I have just done some experiments with building CPython extensions
with mingw-w64. Thanks to Ray for helping me set this up.

The bad news is that the support added to the old 32-bit mingw to
support linking to alternative C runtime libraries (specifically
-lmsvcr100) has bitrotted, and no longer functions correctly in
mingw-w64. As a result, not only can mingw-w64 not build extensions
that are compatible with python.org Python, it can't build extensions
that function at all [1]. They link incompatibly to *both* msvcrt and
msvcr100.

This is a bug in mingw-w64. I have reported it to Ray, who's passed it
onto one of the mingw-w64 developers. But as things stand, mingw
builds will definitely produce binary extensions that aren't
compatible with python.org Python.

Paul

[1] Note, that's if you just use --compiler=mingw32 as supported by
distutils. Looking at how the numpy folks build, they seem to hack
their own version of the distutils C compiler classes. I don't know
whether that's just to work around this bug, or whether they do it for
other reasons as well (but I suspect the latter).


More information about the Python-Dev mailing list