This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [MinGW] Crash at start when compiled by MinGW for 64-bit Windows using PC/pyconfig.h
Type: compile error Stage: resolved
Components: Build, Windows Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder: MinGW is unsupported - close all open issues and list them here.
View: 45538
Assigned To: Nosy List: martin.panter, paul.moore, steve.dower, tim.golden, vmurashev, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2016-09-25 09:45 by vmurashev, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pyconfig.h.3.5.mingw.patch vmurashev, 2016-09-25 09:45
pyconfig.h.2.7.mingw.patch vmurashev, 2016-09-25 09:47
Messages (6)
msg277352 - (view) Author: Vitaly Murashev (vmurashev) * Date: 2016-09-25 09:45
Hi,here the issue:
We (crystax.net) use custom builds of cpython,
which for windows are compiled by MinGW with pyconfig.h taken from PC/pyconfig.h
And for 32-bit Windows everything works well, but for 64-bit Windows - doesn't.

The root cause of this issue is actauly very simple:

Python code for windows is very sensitive on properly defined macro MS_WIN32/MS_WIN64
And while MS_WIN32 is predefined unconditionally in PC/pyconfig.h,
the MS_WIN64 is defined only in conjunction with _MSC_VER, like

#ifdef _MSC_VER
...
#ifdef _WIN64
#define MS_WIN64
#endif
...
#endif /* _MSC_VER */

So suggested patch (for 3.5.2 and 2.7.12) just appropriately define MS_WIN64 for MinGW
msg277355 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-25 10:06
This probably duplicates Issue 17590, although the extra context here is nice :)

What do you think of my patch there, which also removes them from PC/pyconfig.h? I think it is better to define things in one place if possible.
msg277364 - (view) Author: Vitaly Murashev (vmurashev) * Date: 2016-09-25 11:17
Patch suggested here is actually the most trivial as it could be.

And at the same time we (crystax.net) can prove that after this patch Python being compiled by MInGW for 64-bit Windows actually works well. There are other minor fixes but this one is the most important and again - is really trivial
msg277368 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-25 12:12
It looks like Issue 4709 may also be a duplicate.

Your added definition is distant from the comment explaining it. And why not open MS_WIN64 to any Windows compiler, rather than limiting it to just MSC and MINGW?

I presume you are not building by running the configure script, but some other method. The advantage of moving this stuff out of PC/pyconfig.h is it can also be used with the pyconfig.h generated by the configure script.
msg277373 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-09-25 12:52
FWIW I'm not bothered by this patch. Maybe we can one day tidy this all up but merging this now is a good stop-gap. (I probably won't get a chance in the next week.)

Other compilers can pass architecture flags on the command line instead of inferring them at build.
msg277374 - (view) Author: Vitaly Murashev (vmurashev) * Date: 2016-09-25 12:59
> And why not open MS_WIN64 to any Windows compiler
It would be very good idea

Patches suggested here are just the drafts which just work.
Actually I don't believe they will be accepted, so just dropped here for history
History
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72454
2021-10-21 10:04:38iritkatrielsetresolution: duplicate -> wont fix
2021-10-20 13:00:42iritkatrielsetstatus: open -> closed
resolution: duplicate
superseder: MinGW is unsupported - close all open issues and list them here.
stage: patch review -> resolved
2019-12-12 16:06:06vstinnersetnosy: + vstinner
2016-09-25 12:59:25vmurashevsetmessages: + msg277374
2016-09-25 12:52:43steve.dowersettype: crash -> compile error
messages: + msg277373
stage: patch review
2016-09-25 12:12:09martin.pantersetmessages: + msg277368
2016-09-25 11:25:28vmurashevsettype: crash
2016-09-25 11:17:41vmurashevsetmessages: + msg277364
2016-09-25 10:06:34martin.pantersetnosy: + martin.panter
messages: + msg277355
2016-09-25 09:47:51vmurashevsetfiles: + pyconfig.h.2.7.mingw.patch
2016-09-25 09:45:48vmurashevcreate