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

Ray Donnelly mingw.android at gmail.com
Sun Oct 12 16:31:58 CEST 2014

On Sun, Oct 12, 2014 at 9:43 AM, Roumen Petrov
<bugtrack at roumenpetrov.info> wrote:
> Victor Stinner wrote:
>> Hi,
> [SKIP]
>> === MinGW
>> Some people tried to compile Python. See for example:
>> https://bitbucket.org/puqing/python-mingw
>> We even got some patches:
>> http://bugs.python.org/issue3871 (rejected)
> [SNIP]
> As "all in one" patch it was rejected , but you could find splits:
> 17605 - mingw-meta: build interpeter core
> 18653 - mingw-meta: build core modules
> Lot of people post links to possible issues using GCC windows compiler. A
> lot of them are not real issues for CPython.
> In addition for those why would like to cross compile C-extensions for MS
> Windows either from linux of cygwin then could use this set:
> 18654 - modernize mingw&cygwin compiler classes
> I could step in as maintainer for Cygwin and builds based on GCC using
> mingw* APIs.

+1 for Roumen maintaining GCC cross builds using mingw*.

As Rafael Villar Burke mentioned, the MSYS2 project has Native Windows
Python builds (for both 3.4.2 and 2.7.8). We use Roumen's split
patches (and then our own on top):
and https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-python2.

To install MSYS2, build then test 32bit and 64bit mingw-w64-python3 on
a fresh 64bit Windows installation:
Download http://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-x86_64-20141003.exe/download
Run msys2-x86_64-20141003.exe and install to a (short) path without
spaces or non-ascii characters (C:\msys64 is good), keep "Run MSYS2
64bit now." ticked. The remaining commands are to be entered in the
MSYS2 mintty shell.
# Install the packages necessary to build mingw-w64-python*
#  using Pacman package manager (answer Y or press enter when prompted):
pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-i686-toolchain
# Download the source recipes and patches
#  that are used to build all of MSYS2's mingw-w64 packages:
git clone https://github.com/Alexpux/MINGW-packages
cd MINGW-packages/mingw-w64-python3
# Build it:
# (s == sync (install) necessary {make,}dependencies
#  L == write log files)
# answer Y or press enter when prompted
# (remove --nocheck if you want to run the testsuite before packaging)
makepkg-mingw -sL --nocheck

# To install the newly built packages:
pacman -U mingw-w64-*.xz

# To run them, you should add /mingw64/bin or /mingw32/bin to your PATH
# (or launch a new shell via mingw32_shell.bat or mingw64_shell.bat)
# Of course, if you don't want to build it from source you can simply issue:
pacman -S mingw-w64-python3

.. all of the above applies equally to mingw-w64-python2.

If anyone would like to help us to get our work into shape and then
merged we would be extremely grateful. Unfortunately Python is one of
our most patched packages.

In response to Steve Dower's request for discussion:

Having an alternative, fully Open Source build system for Python on
Windows using a stable Win32 ABI which is compatible all the way back
to Windows XP SP3 and Windows XP 64 and can interoperate out of the
box with many other tools and libraries (numpy, GNU Fortran - yes we
have this, pyQt, pyGTK etc) is something many people would dearly
like. We don't wish to usurp Visual Studio as the recommended build
system for Windows, we simply want to enable an Open Source choice.
For philosophical and practical reasons there are many people who wish
to limit their exposure to proprietary, closed build tools such as
Visual Studio. That Windows has always been a much more difficult
platform for Open Source development is not something that the Open
Source community should accept and then work around, rather something
we should try to fix. For information on contributing to MSYS2 please
see https://sourceforge.net/p/msys2/wiki/Contributing%20to%20MSYS2/

Finally, this thread has contained many references to mingw, care
should be taken to be explicit about which of MinGW-w64 or mingw is
being referred to, since they are two different projects. MinGW-w64
supports 64bit and a lot of work is being done to support ARM.

Best regards,

Ray Donnelly.

> Regards,
> Roumen Petrov
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/mingw.android%40gmail.com

More information about the Python-Dev mailing list