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
标题: [MinGW] Crash at start when compiled by MinGW for 64-bit Windows using PC/pyconfig.h
类型: compile error Stage: resolved
Components: Build, Windows Versions:
process
状态: closed Resolution: wont fix
Dependencies: 后续: MinGW is unsupported - close all open issues and list them here.
View: 45538
分配给: 抄送列表: martin.panter, paul.moore, steve.dower, tim.golden, vmurashev, vstinner, zach.ware
优先级: normal 关键字: patch

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

文件
文件名 上传时间 Description 编辑
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) * 日期: 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) 日期: 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) * 日期: 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) 日期: 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) 日期: 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) * 日期: 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
历史
日期 用户 动作 参数
2022-04-11 14:58:37admin修改github: 72454
2021-10-21 10:04:38iritkatriel修改resolution: duplicate -> wont fix
2021-10-20 13:00:42iritkatriel修改状态: open -> closed
resolution: duplicate
后续: MinGW is unsupported - close all open issues and list them here.
stage: patch review -> resolved
2019-12-12 16:06:06vstinner修改抄送: + vstinner
2016-09-25 12:59:25vmurashev修改消息: + msg277374
2016-09-25 12:52:43steve.dower修改type: crash -> compile error
消息: + msg277373
stage: patch review
2016-09-25 12:12:09martin.panter修改消息: + msg277368
2016-09-25 11:25:28vmurashev修改type: crash
2016-09-25 11:17:41vmurashev修改消息: + msg277364
2016-09-25 10:06:34martin.panter修改抄送: + martin.panter
消息: + msg277355
2016-09-25 09:47:51vmurashev修改文件: + pyconfig.h.2.7.mingw.patch
2016-09-25 09:45:48vmurashev创建