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

Victor Stinner victor.stinner at gmail.com
Fri Oct 10 02:29:29 CEST 2014


Windows is not the primary target of Python developers, probably
because most of them work on Linux. Official Python binaries are
currently built by Microsoft Visual Studio. Even if Python developers
get free licenses thanks for Microsoft, I would prefer to use an open
source compiler if it would be possible. So *anyone* can build Python
from scatch. I don't like the requirement of having a license to build
Python. The free version (Visual Studio Express) only supports 32-bit
and doesn't support PGO build (Profile-Guided Optimizations, which are
disabled if I remember correctly because of compiler bugs).

I know that it's hard to replace Visual Studio. I don't want to do it
right now, but I would like to discuss that with you.

=== Open Watcom

Jeffrey Armstrong is working on the Python support of OpenWatcom(v2), see:

This compiler was initially written on MS-DOS in 32-bit, but it now
supports Windows and Linux as well. The 64-bit mode is new and
experimental. The Open Watcom "v2" project is actively developed at:


On Linux, Open Watcom don't support dynamic linking. On Windows, it
uses its own C library. I'm not sure that Open Watcom is the best
choice to build Python on Windows.

=== MinGW

Some people tried to compile Python. See for example:

We even got some patches:
http://bugs.python.org/issue3871 (rejected)

See also:

MinGW reuses the Microsoft C library and it is based on GCC which is
very stable, actively developed, supports a lot of archiectures, etc.
I guess that it should be possible to reuse third party GCC tools like
the famous GDB debugger?

=== Cywin

Cygwin was written compile POSIX applications on Windows and it
provides a DLL for that. Python doesn't need that, it uses directly
the Windows native API. I don't think that we should use Cygwin.

=== Clang

I have no idea of the support of Clang on Windows. Which C library is
used? I found some pages:

This article starts with "It’s time for an update on Clang’s support
for building native Windows programs, compatible with Visual C++!".

I see binaries for Windows.

=== Other compilers?

Do you know other C compiler which can be used to build Python?

=== Requirements

A compiler alone is not enough. To develop, we need tools to automate
the compilation, we need a good debugger, and other similar tools.
(Personally, I don't need an IDE. I mostly write code on Linux and
only run Windows to ensure that my code works on Windows before
pushing it.)

IMO 64-bit support is simply required (we currently provide 64-bit
binaries on Windows). Supporting ARM can be interesting for Windows 8
and Windows 9.

Some parts of Python are low-level like ctypes with libffi. The
_decimal module uses libmpdec which is highly optimized. In short, the
goal is to have a full working standard Python library.

It's probably better to reuse the Microsoft C library instead of
having to embed a different C library. What do you think?

What about the Python stable ABI? Would it be broken if we use a
different compiler?

What about third party Python extensions?

What about external dependencies like gzip, bz2, Tk, Tcl, OpenSSL, etc.?


More information about the Python-Dev mailing list