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
标题: Can't build Python extension with mingw32 on Windows
类型: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.3
process
状态: closed Resolution: wont fix
Dependencies: 12641 后续: MinGW is unsupported - close all open issues and list them here.
View: 45538
分配给: 抄送列表: adityaatluri, amaury.forgeotdarc, cmcqueen1975, loewis, python-dev, rpetrov
优先级: normal 关键字:

Created on 2012-07-10 04:52 by cmcqueen1975, last changed 2022-04-11 14:57 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
log.txt adityaatluri, 2013-06-14 08:38
Messages (10)
msg165159 - (view) Author: Craig McQueen (cmcqueen1975) 日期: 2012-07-10 04:52
I'm trying this with my 'cobs' Python package:

    c:\Python33\python.exe setup.py build --compiler=mingw32 bdist_msi

With Python 3.3 beta, it fails with an exception:

    ValueError: Unknown MS Compiler version 1600

It works with Python 3.2.
msg165160 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2012-07-10 05:07
New changeset eee92b9ac4ad by Martin v. Löwis in branch 'default':
Issue #15315: Support VS 2010 in distutils cygwincompiler.
http://hg.python.org/cpython/rev/eee92b9ac4ad
msg165161 - (view) Author: Martin v. Löwis (loewis) * (Python committer) 日期: 2012-07-10 05:08
This should now be fixed in the repository. It would be good if you could manually apply the change to your installation, and report whether it works.
msg165174 - (view) Author: Craig McQueen (cmcqueen1975) 日期: 2012-07-10 07:54
That's definitely an improvement. It gets further, but on my PC, the compile fails:

...
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: cannot find -lmsvcr100
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

I'll have to see if I can get the required library I guess.
msg165176 - (view) Author: Craig McQueen (cmcqueen1975) 日期: 2012-07-10 08:12
I downloaded the latest MinGW, and now it tells me:

...
c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python33\include -IC:\Python33\PC -c python3/src/_cobs_ext.c -o bui
ld\temp.win32-3.3\Release\python3\src\_cobs_ext.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
msg165177 - (view) Author: Craig McQueen (cmcqueen1975) 日期: 2012-07-10 08:17
It sounds as though the option '-mno-cygwin' is related to issue #12641.

Does that mean I need to find a version of MinGW that is old enough to support the option '-mno-cygwin', but new enough to include a library for msvcr100?
msg165179 - (view) Author: Martin v. Löwis (loewis) * (Python committer) 日期: 2012-07-10 09:09
I'm not a Cygwin user myself, so it would be good if you could figure this out somehow. Feel free to ask on Cygwin lists how this is supposed to work. Our requirement is that the resulting pyd needs to link with msvcr100.dll. It may well be that *no* version of Cygwin ever supported this, in which case we should drop Cygwin support from Python 3.3.
msg165212 - (view) Author: Craig McQueen (cmcqueen1975) 日期: 2012-07-10 23:48
I've succeeded in building an extension for Python 3.3 (at least, on Windows XP, 32-bit; haven't tried any 64-bit), by the hack of copying libmsvcr100.a from a recent MinGW release (20120426) into an older MinGW release (20101030).

I haven't looked at MinGW releases to see if I can find one that supports both the -mno-cygwin option and msvcr100.

I guess the best solution for this is to resolve issue #12641 for Python 3.3.
msg191106 - (view) Author: Aditya Atluri (adityaatluri) 日期: 2013-06-14 08:38
I have found a hack for the issue.
First, install Microsoft Visual C++ 2010 Redistributable Package.
Second, copy the msvcr100.dll to C:\Python33\libs.

Reason: During compilation, the directory for linking is C:\Python44\libs. Both -lpython and -lmsvcr100 are pointed to the same location. So, they have to be in the same directory.

I have another problem here.
The log is attached. Is there a change in functions and objects in building extensions in C from 2.7 and 3.3?
msg191115 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) 日期: 2013-06-14 10:19
Aditya, python3 changed the API to create modules. See issue18210.
历史
日期 用户 动作 参数
2022-04-11 14:57:32admin修改github: 59520
2021-10-21 09:59:14iritkatriel修改resolution: duplicate -> wont fix
2021-10-20 12:40:56iritkatriel修改状态: open -> closed
后续: MinGW is unsupported - close all open issues and list them here.
resolution: duplicate
stage: resolved
2013-08-04 14:24:23rpetrov修改抄送: + rpetrov
2013-06-14 10:19:08amaury.forgeotdarc修改抄送: + amaury.forgeotdarc
消息: + msg191115
2013-06-14 08:38:20adityaatluri修改文件: + log.txt
抄送: + adityaatluri
消息: + msg191106

2012-09-11 22:57:40ezio.melotti修改dependencies: + Remove -mno-cygwin from distutils
type: behavior
2012-07-10 23:48:18cmcqueen1975修改消息: + msg165212
2012-07-10 09:09:44loewis修改消息: + msg165179
2012-07-10 08:17:19cmcqueen1975修改消息: + msg165177
2012-07-10 08:12:59cmcqueen1975修改消息: + msg165176
2012-07-10 07:54:07cmcqueen1975修改消息: + msg165174
2012-07-10 05:08:22loewis修改抄送: + loewis
消息: + msg165161
2012-07-10 05:07:33python-dev修改抄送: + python-dev
消息: + msg165160
2012-07-10 04:52:02cmcqueen1975创建