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

Paul Moore p.f.moore at gmail.com
Mon Oct 27 19:55:07 CET 2014

On 27 October 2014 18:47, Case Van Horsen <casevh at gmail.com> wrote:
> I've managed to build gmpy2 (which requires GMP, MPFR, and MPC
> libraries) using msys2. I've detailed the steps (hacking) at:
> https://code.google.com/p/gmpy/source/browse/trunk/msys2_build.txt

Thanks for this. I don't have the time to read your notes right now,
but I will do so.

> One of the hacks I made addresses the linking bug. The extension
> does run with the both the 32-bit and 64-bit versions of CPython 2.7,
> 3.2, 3.3, and 3.4.

Did you report the linking bug to the mingw-w64 project? They key
thing here is that without gcc -lmsvcrt100 foo.c working (i.e., not
resulting in linking with msvcrt), building Python extensions will
always need hacks to workaround that bug.

> It is possible, just not easy. Anything that makes is easier would
> be very helpful.

With the bug fixed, the steps should be as trivial as:

1. Using python.org Python, with gcc on your PATH.
2. Install any dependencies (e.g., gmp) where gcc can see them.
3. python setup.py build_ext --compiler=mingw32 bdist_wheel

(or whatever setup.py invocation suits you, as long as you set


More information about the Python-Dev mailing list