Support for the clang subsystems on mingw

Hi all,

Although cpython mentions support for Cygwin as the only POSIX styled build available for Windows, the actual build has been left in a state of disrepair for a long time. I’d like to change this by adding support for a more modern toolchain instead: the mingw subsystems that use clang to build executables. The relevant issue and pull request can be seen at Recognise Windows as a platform in configure · Issue #105790 · python/cpython (github.com) and gh-105790: Recognise Windows as a platform in configure by TheShermanTanker · Pull Request #105789 · python/cpython (github.com). I welcome any feedback and thoughts, as well as help and advice with doing this, since there are some areas in which I’ve ran into a snag

best regards,
Julian

1 Like

yes,

  • the despair with relying on the giant 12GB[1] piece of bloat which is Microsoft Visual Studio™
  • … is felt by each and every windows using python developer
  • … doing anything with dlib machine learning/ML library (official site)
  • … as it is pretty evident on dlib issue tracker (over 100 issues), and on youtube

while all it requires on UI side is just the ability to pick a generator in cmake invocation, so that the awesome mingw toolchain (gcc or clang) can be used from msys2 or cygwin.

Following from cmake --help (cmake documentation on web)

Options
  -G <generator-name>          = Specify a build system generator.

Generators
The following generators are available on this platform (* marks default):

  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.


  1. 12GB: charlielito / install-dlib-python-windows on github ↩︎

Note that the person who knows most about our Windows builds is currently on vacation. Expect delays.

Just for my own records, there was this prior topic about this which contains links to further discussions relevant to (and almost like a backstage for) the merge-requests posted above:

I wonder if we could absorb the Visual C++ toolchain into the configure system one of these days, then for each module call a specific Makefile from a central one and so on. This approach is already used by Java in the official JDK for instance, and it makes it very easy to pass specific flags or disable each module individually based on toolchain and OS, something which can quickly become a massive roadblock if done directly in configure for every single possible combination. I’ve heard that there is a wishlist about how the build system could be better, so these are my 2 cents on that, but it would require a Unix environment on Windows to build Python unfortunately

it already exists :slight_smile:
msys2 provides unix environment (bash, curl, bsdtar, etc) for building stuff natively on windows.

RubyInstaller2, Git-for-windows, Inkscape, R project rtools40 are some of the projects using msys2 for their windows builds

1 Like

I’ve halted work on this effort to take a different angle at tackling this problem. Too hacky and messy at the moment

That may be the case, but being able to build cpython on windows without requiring a Unix environment is likely something that is not compromisable