Skip to content

Conversation

@lazka
Copy link
Member

@lazka lazka commented Jun 6, 2025

range diff:

  1:  70bab433cb2 =   1:  6ba0de42da0 sysconfig: make _sysconfigdata.py relocatable
  2:  e2584afdd5d =   2:  38561b67591 build: add --with-nt-threads and make it default on mingw
  3:  651a0f883d0 =   3:  d565b952e65 Define `MS_WINDOWS` (and others) when compiling with MINGW
  4:  b5e144ec009 =   4:  396c8847eda configure: add `MACHDEP` and `platform` on MINGW
  5:  b0ffdfd713f =   5:  989e86b3b48 Add default configuration for MINGW
  6:  c870543ffff =   6:  b17d5e39dbc configure: enable largefile support by default for Mingw
  7:  4ef28f8442b =   7:  5f97c1f9acd Add `PC/` to `CPPFLAGS` and to `SRCDIRS` on Mingw
  8:  1056ca4f216 =   8:  cda6ac76637 posixmodule.c: Define necessary headers for compiling on MINGW
  9:  1dc9a695b3f =   9:  8046053fef0 Build winreg by default when compiling for MINGW
 10:  fb030fb2a32 =  10:  65a95395727 pyport.h: Add support for MINGW
 11:  f89e260e1f4 =  11:  17ac42a9e03 configure: add options so that shared build is possible on MINGW
 12:  2fa60d12a1a =  12:  3f6018afd94 Add dynamic loading support for MINGW
 13:  622d44dc20f =  13:  1dd0573aac7 Ignore main program for frozen scripts on MINGW
 14:  15603f8ced0 =  14:  9c79fca7a73 Detect winsock2 and setup _socket module on MINGW
 15:  4c4fa2f9ea5 =  15:  a2f90025512 Enable some windows specific modules
 16:  da21e492b2b =  16:  e8f2489cdc8 sysconfig: MINGW build extensions with GCC
 17:  b072673826d =  17:  0d4ec3ee1ae sysconfig: treat MINGW builds as POSIX builds
 18:  0316a861afa =  18:  3071b5192ab Add support for stdcall without underscore
 19:  62916588cd5 =  19:  dc7508ee314 Customize site for MINGW
 20:  12201dc4c32 =  20:  a3da6c38d96 add python config sh
 21:  c7e92a60765 =  21:  608ce98d369 mingw: prefer unix sep if MSYSTEM environment variable
 22:  67aef226b98 =  22:  061c843266b msys cygwin semi native build sysconfig
 23:  315d81f1380 =  23:  99a6cac7eb2 sysconfig: mingw sysconfig like posix
 24:  072ff409964 =  24:  e0ac3546061 mingw use backslashes in compileall py
 25:  d1b24d4094b =  25:  73e185f320f mingw pdcurses_ISPAD
 26:  64ea6e4606f =  26:  b78fb154797 remove_path_max.default
 27:  303ceeef9ed =  27:  a872b0c721d dont link with gettext
 28:  79a179c4b4d =  28:  8f7da60248a ctypes python dll
 29:  1a19840bf32 =  29:  dff5e634a9a gdbm module includes
 30:  3d35ed826d1 =  30:  86525e28956 use gnu_printf in format
 31:  98c7f8274cb =  31:  93979947206 mingw fix ssl dont use enum_certificates
 32:  b7edd90db7f =  32:  be3f6f4ff43 fix using dllhandle and winver mingw
 33:  ee575fff905 =  33:  28bfd9dcda9 Add AMD64 to sys config so msvccompiler get_build_version works
 34:  80a547937af =  34:  013c102dd2f MINGW link with additional library
 35:  419b5853ac0 =  35:  e1e7676fb6e install msilib
 36:  79b4fd359ba =  36:  550b26d8426 fix signal module build
 37:  009243381f3 =  37:  cfdd9f74aef build: build winconsoleio and _testconsole
 38:  ecec00a45a5 =  38:  4276906624d expose sem_unlink
 39:  3e5da55bf95 =  39:  2d45102621b Use cygpty while using isatty
 40:  9417841c859 =  40:  07aece0a501 build: link win resource files and build pythonw
 41:  40d892835e2 =  41:  fe710f6c733 fix isselectable
 42:  4f7f9903caf =  42:  f3c6343501e configure.ac: fix inet_pton check
 43:  4ba545deb11 =  43:  52f1dd30b77 pass gen profile ldflags
 44:  856611ce52d =  44:  49c4354cf12 pkg config windows must link ext with python lib
 45:  f1c012dd69b =  45:  2df9f65c696 importlib bootstrap path sep
 46:  90e63e3df53 =  46:  6c285f5e9b9 warnings fixes
 47:  d4699e752d4 =  47:  5eaa5ec6b5f fix build testinternalcapi
 48:  f14104a8345 =  48:  468ecaee879 clang arm64
 49:  9ca9a3808f8 =  49:  1d05f487a39 configure.ac: set MINGW stack reserve
 50:  c7cfa8e12af =  50:  d14cee31124 Don't use os.pathsep to find EOF not all distributions in win32 have them as \ instead check using sys.platform
 51:  813b8b784c1 =  51:  231b2d4d380 Fix extension suffix for c-extensions on mingw
 52:  92f9d3c3d0f =  52:  097c217e47e Change the `get_platform()` method in sysconfig
 53:  566627ccb5f =  53:  b8a2d27b763 build: Fix ncursesw include lookup
 54:  9f78c203fd7 =  54:  2e26b3e95ea tests: fix test_bytes
 55:  37d370c2b99 =  55:  03671ce0bf4 time: fix strftime not raising for invalid year values
 56:  06ce4a2f7fd =  56:  8d8a7d89d49 ctypes: find_library('c') should return None with ucrt
 57:  c2575851ee0 =  57:  fcde121343d build: Disable checks for dlopen/dlfcn
 58:  70aa50adf18 =  58:  c9f994502e2 Fix install location of the import library
 59:  1c3a6ce01cd =  59:  5146f248c12 build: Integrate venvlauncher build/installation into the Makefile
 60:  c20a829f269 =  60:  2a336b4478e configure.ac: set _WIN32_WINNT version
 61:  4262bd547ae =  61:  2ceeedcaf13 configure.ac: don't check for clock_ functions
 62:  75bd12c92f4 =  62:  1cb7dcd8732 expanduser: normpath paths coming from env vars
 63:  6c4b8c8a6a5 =  63:  23ec3fc8317 CI: test the build and add some mingw specific tests
 64:  f61cd58e012 =  64:  42eaab00bb6 Define PY3_DLLNAME to fix build
 65:  dace02eeabf =  65:  41c2be507eb _testconsole.c: Fix casing & path sep
 66:  d7f45cc3cd1 =  66:  2c9a95669e3 Return consistent architecture markers for python on mingw/armv7
 67:  d162f1d6456 =  67:  c45f5f0f98a handle ncursesw pkg-config when cross-compiling
 68:  5520f77b3de =  68:  76fa04a3505 mingw_smoketests: fix _UCRT condition
 69:  d77bb16baa8 =  69:  3debb2dd3a0 Modify `sys.winver` to match upstream
 70:  e808beb9cff =  70:  4283ac7a890 Change user site-packages path to include the environment info
 71:  e2ca452eb62 =  71:  5410b83fa92 configure: Include a header in the check for _beginthread
 72:  dc09df53393 =  72:  c7f7a151a52 configure.ac: Default to --without-c-locale-coercion on Windows
 73:  9d27166789b =  73:  3b22a18b72c Fix failing tests
 74:  8f547fc3174 =  74:  b31b52e48af Don't change os.sep with an empty MSYSTEM env var, not just a missing one
 75:  86fe7abb79d =  75:  df24bb7652e def VPATH when compiling `Python/sysmodule.c`
 76:  17921da9193 =  76:  418477991a2 Make `_Py_CheckPython3` extern
 77:  7f44e200324 =  77:  67b6568629d link with bcrypt
 78:  7d377bd3410 =  78:  2726b17d9ed correctly find native python
 79:  3cf81b7479d =  79:  fa9ea58652b Add extra flags for `_bootstrap_python`
 80:  435ac83e736 =  80:  9d6027c1cdd posixmodule: undefine `HAVE_OPENDIR`
 81:  5d62a5dc914 =  81:  dc3cb94a0bc getpath.py: add support for mingw
 82:  b8cde35a1b0 =  82:  3ac5f2fc5c3 Don't  build _posixsubprocess on Windows.
 83:  b54da9f5ea3 =  83:  abc76648354 `_ssl`: link with `ws2_32`
 84:  1222380ac23 =  84:  f1102c49003 Always normalize path in abspath
 85:  42f3b79365d =  85:  a54560597e2 Include `winsock.h` when checking for netdb function
 86:  c0c7ce1a1d7 =  86:  97bbe1f347c include `_multiprocessing/semaphore.c` on win32
 87:  beb7ceaca41 =  87:  c2545fb9dfe configure: build `mmap` module on win32
 88:  21f62ecb462 =  88:  1441e1caba6 venv creation fixes
 89:  f1073a36dc9 =  89:  117dc5b8a35 move the `shutdown` function where `winsock.h` is included
 90:  fc0dd6b35c8 =  90:  0cce81ea6f0 configure.ac: set BUILDEXEEXT and EXEEXT
 91:  d35b2e5ed3d =  91:  0b0a72541f5 configure.ac: fix building some test modules
 92:  ee9142c25dc =  92:  a27d2bb96d5 Don't convert `sysconfig.get_config_var('VPATH')` to an absolute path
 93:  943177704aa =  93:  e7b37fa1777 Always convert `/` to `\\` before passing though pathcch functions
 94:  316fbde1e7c =  94:  a935bf37197 Build venvlauncher.exe from PC/launcher.c
 95:  6e1d779959b =  95:  8dd0930f7dd getpath.py: fix `dirname`
 96:  638d1dafcee =  96:  1f2a2898c05 getpath: use normpath on all generated paths
 97:  50b88dd6762 =  97:  b0908f8b64b pathconfig: normpath sys.path[0]
 98:  1b61d6bc2bf =  98:  38612d894aa smoketests: add some tests for sys/site paths
 99:  9825b41ff1c =  99:  066c14bd214 Search DLLs only on paths added using `add_dll_directory()`.
100:  47698143a89 = 100:  7347577f01a Build and install libpython3.dll
101:  1cb727a0e50 = 101:  f78fc1f81a1 Port GetPythonImport() to mingw
102:  e754b079c93 = 102:  8d63ba224d9 LoadLibraryExW: make sure to only use backslashes for paths
103:  f95b3194473 = 103:  34d859b152e mingw_smoketests: add a test to check if sysconfig returns correct values for `LIBDIR`
104:  442dc1bbd35 = 104:  618b83dd7e7 Add missing library for multiprocessing module
105:  05e22b51be8 = 105:  0f110546b3a selectmodule: add support for MINGW
106:  6968f18b6fa = 106:  1e2a68ccfaa readline: disable on MINGW
107:  ab99d16e539 = 107:  6fa96e4de4f Add libraries to fix compile of ctypes on MINGW
108:  bf939ee89d6 = 108:  6fbd5316a04 Add `-lpython<version>` while linking stdlib
109:  d6e7bc7b8a1 = 109:  6843f1f35a1 Enable `_uuid` on MINGW
110:  f291913c893 = 110:  ffe1a51f595 Enable curses library on MINGW
111:  53f904e06de = 111:  81fdef62bb3 mingw_smoketests: disable distutils related tests
112:  904c421dacf = 112:  ce67dc2ec03 configure.ac: use autoconf 2.69
113:  780ad6079e5 = 113:  494b9665344 CI: clean up ignored tests
114:  c202fe446df = 114:  8e9d8cda56d gcc: make `incompatible-pointer-types` as warning
115:  f5a51b24222 = 115:  d48b2d21436 test_makefile: normalize path
116:  bd5af5e8e61 = 116:  753581b306e `sysconfig.get_platform()`: use consistent naming
117:  1e212039792 = 117:  ce5f345ca13 Add ucrt to version string
118:  5a2828b6703 = 118:  33a869a80d7 socketmodule: fix captilization of headers
119:  62b2ff3b6b1 = 119:  884f1500fd1 mingw_smoketests: build extension in a venv
120:  271f0da2a1f = 120:  8f366d6aef7 venvlauncher: try looking for the versioned .exe first and then fall back
121:  082ef865aa8 = 121:  3fbe82e92e9 CI: update actions
122:  a02e0a47cbc = 122:  4fd52baa016 CI: test CLANGARM64
  -:  ----------- > 123:  5248fdecf1a CI: disable pkg-config

mingwandroid and others added 30 commits June 6, 2025 20:18
Co-authored-by: Алексей <[email protected]>
Co-authored-by: lovetox <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
This is used throughout the Python code but is not defined
when compiling with Mingw-w64 compilers, so define it.
In MSVC these are defined in PC/pyconfig.h, we have to
define it manually because pyconfig.h is created by
autotools.

Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Largefile is supported on Windows.

Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Also, build `nt` module instead of `posix` when compiling
with MINGW.

Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
This is the case used in MINGW

Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Co-authored-by: cat <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
lazka and others added 23 commits June 6, 2025 20:18
This provides the limited ABI as a separate DLL, forwarding to the
real one. This makes linking with "-lpython3" work.

Fixes #147
This looks for DLL names in the import table but while with MSVC the DLL
is named python311.dll in our case it is named libpython3.11.dll.
Adjust the strings and lengths accordingly.
It seems like in case the path passed to it is absolute, but contains
forward slashes then LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR does not work
and DLLs in the same directory as the extension are not considered.

This occurs in our fork because in MSYS2-mode the extension loader will
normalize to forward slashes before.

Normalize everything to backslashes again before passing it to LoadLibraryExW.

Fixes #151
`ws2_32` is required when building that module
Generalize the `MINGW` case.
In theory, it should be correct for other system too
and would fix cross-compilation
llvm-mingw only has autoconf 2.69
Remove tests which are passing now, or no longer exist, and
move tests which only fail with msvcrt into a separate file.
gcc 14 changed `incompatible-pointer-types` from warning to error
for now, make it as warning to avoid build failure
so that it passes on mingw
Currently, the platform names are hardcoded in many places,
and are not named consistently. This commit fixes it by
standardizing the names to be returned by `sysconfig.get_platform`.
The naming is based on #167 (comment)

Similarly, `EXT_SUFFIX` is also standardized to be consistent with the platform names.

Signed-off-by: Naveen M K <[email protected]>
`Rpc` should be `rpc`. It error's out in
cross-compilation.
ensurepip no longer works since we implement PEP 668, so do
everything in a venv.
…back

By default venvlauncher only looks for python.exe in the python "home",
which fails in the MSYS2 case where there could be multiple python versions
in the same prefix i.e. python.exe could be 3.12 while the venv was created
with python3.13.exe.

Upstream CPython doesn't have this problem since they never have multiple
Python versions in the same prefix.

On the other hand the Python test suite (test_sysconfig specifically) creates
a venv for the uninstalled Python build dir, where only python.exe exists.

To cover both cases we first try to look for the python3.XY.exe and then
fall back to python.exe.
test cross-compiled arm builds too
@lazka
Copy link
Member Author

lazka commented Jun 6, 2025

it detects the build zlib somehow

to avoid it finding build machine packages
@lazka lazka merged commit 5248fde into mingw-v3.12.11 Jun 7, 2025
44 of 45 checks passed
@lazka lazka deleted the wip/mingw-v3.12.11 branch June 7, 2025 10:10
lazka added a commit to lazka/MINGW-packages that referenced this pull request Jun 7, 2025
lazka added a commit to msys2/MINGW-packages that referenced this pull request Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants