[Python-Dev] Why is Python for Windows compiled with MSVC?

Paul Moore p.f.moore at gmail.com
Thu Feb 1 04:30:04 EST 2018


On 1 February 2018 at 00:42, Gregory P. Smith <greg at krypto.org> wrote:
> TL;DR of Steve's post - MSVC is the compiler of choice for most serious
> software on Windows. So we use it to best integrate with the world. There is
> no compelling reason to change that.
>
> The free-as-in-beer MSVC community edition is finally non-sucky (their
> earlier efforts were crippled, they seem to have learned the lesson)
>
> There are other viable Windows compilers.  If we want to support those in
> CPython someone needs to contribute the work to do so, ongoing maintenance,
> and buildbots.  I'd love to see a Clang based Windows build (Google Chrome
> is built using that).  But I have no motivating reason to do the work.  I
> believe such a build could be made to integrate and inter-operate fully with
> MSVC builds and ABIs.  We could probably even make cross-compilation of
> extensions from Linux -> Windows work that way.
>
> We're highly unlikely to ever stop shipping python.org Windows binaries
> built with anything other than MSVC unless Microsoft takes a turn toward the
> dark side again.

I would also point out that CPython (distutils, specifically)
supported mingw builds (that's the original mingw 32-bit version) for
a long time. Support for that bit-rotted as the mingw project
fragmented with various 64-bit versions, and slow progress from the
mingw project(s) for supporting newer CRTs on Windows. No-one from the
community who used mingw was providing patches back to distutils or
Python, and so the support for mingw was (I believe) dropped. It
sounds as if people have since then got things to a point where
building extensions with (some form of ) mingw is possible, but I
don't know the details, and I'm not aware of any documentation that's
been contributed back to Python on how "mingw support for building
extensions" works these days.

We'd be more than happy to support building extensions with
alternative compilers (such as one of the various gcc builds that go
under the banner of "mingw") - that's a completely different matter
than switching the CPython build process to use mingw - but it's down
to the community of users of such a compiler to contribute that
support. Expecting "someone else", and particularly someone who
doesn't need it, to provide that support, is unreasonable.

Disclaimer: This all comes under "as far as I know" - I did a lot of
work on mingw support back when it was supported (including trying to
push patches back to the mingw people) but haven't been following it
for a long time. Things could be very different now than I remember.

Paul


More information about the Python-Dev mailing list