Repository navigation
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = 'https://github.com/pitrou'
closed_at = <Date 2013-09-30.20:30:31.656>
created_at = <Date 2011-07-26.17:02:30.791>
labels = ['type-bug', 'library']
title = 'Remove -mno-cygwin from distutils'
updated_at = <Date 2015-03-14.01:46:04.938>
user = 'https://bugs.python.org/jonforums'bugs.python.org fields:
activity = <Date 2015-03-14.01:46:04.938>
actor = 'ned.deily'
assignee = 'pitrou'
closed = True
closed_date = <Date 2013-09-30.20:30:31.656>
closer = 'pitrou'
components = ['Distutils', 'Distutils2']
creation = <Date 2011-07-26.17:02:30.791>
creator = 'jonforums'
dependencies = []
files = ['22775', '29030', '29031', '29032', '29103', '30681', '30682', '30683', '30698', '30888', '30889', '30890', '31919']
hgrepos = []
issue_num = 12641
keywords = ['patch']
message_count = 86.0
messages = ['141172', '141173', '141230', '141231', '141265', '141271', '141277', '141296', '141301', '141613', '141614', '141661', '141662', '146384', '146499', '161514', '165178', '165181', '165182', '165184', '165210', '167620', '179175', '179176', '181830', '181831', '181834', '181865', '182090', '182277', '182726', '182737', '183032', '183048', '183077', '183081', '183213', '183224', '183227', '183240', '183241', '189748', '189756', '189769', '189770', '189786', '189805', '189813', '189814', '189871', '189874', '189878', '189887', '189906', '189941', '189943', '189946', '189947', '189948', '189958', '189962', '190060', '191714', '191735', '191749', '191753', '191755', '191845', '192758', '192763', '192764', '192766', '192877', '195576', '195809', '198650', '198690', '198691', '198732', '198733', '198734', '198763', '207498', '207499', '238062', '238067']
nosy_count = 35.0
nosy_names = ['lemburg', 'loewis', 'doko', 'paul.moore', 'pje', 'geertj', 'pitrou', 'christian.heimes', 'schmir', 'tarek', 'jkloth', 'jwilk', 'ned.deily', 'eric.araujo', 'rpetrov', 'cmcqueen1975', 'rubenvb', 'santoso.wijaya', 'alexis', 'python-dev', 'Seppo.Yli-Olli', 'jonforums', 'RubyTuesdayDONO', 'Jeffrey.Armstrong', 'danmbox', 'Martin.Fiers', 'oscarbenjamin', 'Pete.Forman', 'fratti', 'rivy', 'gaudyallure52', 'honorableinvasi', 'stakingrainbow2', 'lewisl', 'Michael.Clerx']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue12641'
versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
jonforums commentedon Jul 26, 2011
The use of -mno-cygwin at http://bit.ly/qAIsZV causes build failures with versions of MinGW GCC. For example http://bit.ly/llK3f3
I recently ran into it trying to build a Mercurial snapshot using a MinGW GCC v4.6.2 flavor http://pastie.org/2274486
Why is -mno-cygwin still be used, and is there any reason why it can't be removed?
Thanks, Jon
rubenvb commentedon Jul 26, 2011
I can confirm the option has been removed. For those that don't want to believe a random person's comment on a bugtracker, here's the commit:
http://repo.or.cz/w/official-gcc.git/commit/2637551aa9314c46cf4205d435ab5e8944e9ac8a
The changelog is a bit cryptic, but note the last two items "removing documentation from removed option".
merwok commentedon Jul 27, 2011
Hi! Thanks for the report. This can’t be fixed in 2.5, 2.6 or 3.1, which are in security-fix only mode, but we can do something for the active branches.
A quick web search finds reference of this deprecation/removal as far as 2007. Does anyone have more official documentation? If we can find the first gcc version that deprecates this option, then I’ll be able to make a patch with a version check (in order not to change previously working code).
(In the future, it would be nice of you not to use URL obfuscators or pastebins. Such services offer no guarantee of continued availability of hosted resources or links, but it is useful to keep information on this bug tracker for future reference. Thank you.
The first link is this: http://hg.python.org/cpython/file/4feb889d3bed/Lib/distutils/cygwinccompiler.py#l296
The second: http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-op
The compile log from the third link is attached as a file.)
merwok commentedon Jul 27, 2011
I forgot to answer this:
rubenvb commentedon Jul 27, 2011
The commit I linked to has the full option removal at October 7 2010 (see the fifth item in the changelog entry). Any GCC (major) version released after that will have it completely removed.
Deprecation happened (according to the first doc change mentioning this option as being deprecated) on 2009-03-25: http://repo.or.cz/w/official-gcc.git/commit/6609be22531f447aeddbb3f670ad7883036cb23f
It looks like GCC 4.4 and up have this change in them, by looking at their commit logs. Anyone using GCC 4.3 on MinGW should be shot (but that's just my humble opinion, rather radical I admit ;-) )
Note this has really nothing to do with current Cygwin or the cygwin platform; MinGW was part of the Cygwin source for a long time, and every MinGW compiler was burdened to search the Cygwin header and lib paths. These commits fixed that problem.
MinGW(-w64) is a native compiler for Win32 just as MSVC is. Links to msvcrt.dll and has no POSIX translation/compatibility layer like the Cygwin DLL.
May I ask for a reconsideration to commit a fix for this for Python 2.7 at least? With the version check it doesn't hurt anyone, instead it helps prevent further confusion and support requests on the MinGW side. Distutils pop up everywhere, and the projects depending on them rely on them working correctly. Thanks
jonforums commentedon Jul 27, 2011
I have confirmed on Win7 that the following 32bit MinGW flavors still recognize -mno-cygwin option and build without error:
(4.5.2) http://tdm-gcc.tdragon.net/download
(4.5.4) http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Automated%20Builds/ using the mingw-w32-1.0-bin_i686-mingw_20110624.zip download
...by compiling with:
[i686-w64-mingw32-]gcc -Wall -mno-cygwin -o helloworld.exe helloworld.c
...where helloworld.c was:
I have not yet checked the latest mingw.org download from the following, but I expect that it also recognizes -mno-cygwin. I will check later and report back if appropriate.
(4.5.2) http://sourceforge.net/projects/mingw/files/
Given Ruben's 4.4 comment, something is odd here. Looks like some gcc source spelunking as these doc links make no mention of the removal:
http://gcc.gnu.org/gcc-4.6/changes.html
http://gcc.gnu.org/gcc-4.5/changes.html
http://gcc.gnu.org/gcc-4.4/changes.html
and the gcc manual is inconsistent. This summary mentions the option
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Option-Summary.html#Option-Summary
but the details sections don't mention the option
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/i386-and-x86_002d64-Windows-Options.html#i386-and-x86_002d64-Windows-Options
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options
Ah, our good friend grep.
jonforums commentedon Jul 27, 2011
should the question be "what's the first mingw gcc version that -mno-cygwin usage unnecessary" rather than finding the first version the option was removed?
and, does it matter whether you're building on win for win, or cross compiling for win from nix?
sadly, i don't know gcc internals but a post to the mingw and/or mingw-w64 ml's should get the right people weighing in.
btw, can distutils do a lightweight configure-like check for feature presence rather than going a gcc version check?
merwok commentedon Jul 28, 2011
77 remaining items
pitrou commentedon Sep 29, 2013
Oscar, thanks for the patches. Two things:
oscarbenjamin commentedon Sep 30, 2013
Thanks for looking at this Antoine.
I've attached an updated patch for Python 2.7 called
check_mno_cywin_py27_2.patch. This explicitly closes the popen object
in the same way as the get_versions() function immediately above.
I've just signed an electronic contributor's agreement.
oscarbenjamin commentedon Sep 30, 2013
On 30 September 2013 12:08, Oscar Benjamin <report@bugs.python.org> wrote:
To be clear: I retested this patch (using the setup described above)
and the results are unchanged.
python-dev commentedon Sep 30, 2013
New changeset 7d9a1aa8d95e by Antoine Pitrou in branch '2.7':
Issue bpo-12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except when necessary.
http://hg.python.org/cpython/rev/7d9a1aa8d95e
python-dev commentedon Sep 30, 2013
New changeset 6b89176f1be5 by Antoine Pitrou in branch '3.3':
Issue bpo-12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except when necessary.
http://hg.python.org/cpython/rev/6b89176f1be5
New changeset 8e180b2067e4 by Antoine Pitrou in branch 'default':
Issue bpo-12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except when necessary.
http://hg.python.org/cpython/rev/8e180b2067e4
pitrou commentedon Sep 30, 2013
Thank you Oscar! This issue can endly be fixed.
oscarbenjamin commentedon Oct 1, 2013
Thanks Antoine!
lewisl commentedon Jan 7, 2014
This is broken for Python 2.7.4. Is it fixed in 2.7.6? gcc deprecated -mno-cygwin. It's not there any more. There shouldn't be a discussion. This is an incredibly poor example of how fragmentation and poor process result in poor quality open source software--in the corners, even when the overall code is excellent. Over 2 years on something this trivial. Hundreds of lines of discussion. There wasn't really any reason for this to have persisted.
pitrou commentedon Jan 7, 2014
The fix is in 2.7.6, yes.
MichaelClerx commentedon Mar 14, 2015
I'm seeing this bug in 2.7.9. The reason seems to be that the version detection doesn't work...
This snippet:
returns an empty out_string, causing gcc_version = None < '4'
Maybe the < '4' check could be restructured to see None as "probably modern" instead of "probably very out of date" ?
ned-deily commentedon Mar 14, 2015
Michael, this issue is closed and the changes have long since been released. Comments here will likely be ignored. Please open a new issue describing the problem you are seeing and under what environment, with exact steps to reproduce it.