Oscar Benjamin added the comment:
I'm attaching one more patch "check_mno_cywin_py34.patch". This is my
preferred patch for Python 3.4 (default). It fixes building with MinGW
and removes all support for using Cygwin gcc with --compiler=mingw32.
The user would see the following error message:
'''
Q:\current\testing\hello>testbuild q:\tools\cygwin\bin -3.3
running build_ext
error: Cygwin gcc cannot be used with --compiler=mingw32
'''
I think that this is reasonable as '-mno-cygwin' is a previously
experimental and now long deprecated, discouraged and discontinued
feature of Cygwin's gcc. Removing support for it in future Pythons
would make problems involving MinGW build (like this one) much easier
to solve in future: there would be no need to consider anything other
than the behaviour of MinGW's gcc.
----------
Added file: http://bugs.python.org/file30698/check_mno_cywin_py34.patch
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12641>
_______________________________________
diff -r 7aab60b70f90 Lib/distutils/cygwinccompiler.py
--- a/Lib/distutils/cygwinccompiler.py Sun Jun 23 15:47:03 2013 -0700
+++ b/Lib/distutils/cygwinccompiler.py Tue Jun 25 11:38:05 2013 +0100
@@ -54,7 +54,8 @@
from distutils.ccompiler import gen_preprocess_options, gen_lib_options
from distutils.unixccompiler import UnixCCompiler
from distutils.file_util import write_file
-from distutils.errors import DistutilsExecError, CompileError, UnknownFileError
+from distutils.errors import (DistutilsExecError, CCompilerError,
+ CompileError, UnknownFileError)
from distutils import log
from distutils.version import LooseVersion
from distutils.spawn import find_executable
@@ -294,11 +295,15 @@
else:
entry_point = ''
- self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
- compiler_so='gcc -mno-cygwin -mdll -O -Wall',
- compiler_cxx='g++ -mno-cygwin -O -Wall',
- linker_exe='gcc -mno-cygwin',
- linker_so='%s -mno-cygwin %s %s'
+ if is_cygwingcc():
+ raise CCompilerError(
+ 'Cygwin gcc cannot be used with --compiler=mingw32')
+
+ self.set_executables(compiler='gcc -O -Wall',
+ compiler_so='gcc -mdll -O -Wall',
+ compiler_cxx='g++ -O -Wall',
+ linker_exe='gcc',
+ linker_so='%s %s %s'
% (self.linker_dll, shared_option,
entry_point))
# Maybe we should also append -mthreads, but then the finished
@@ -393,3 +398,15 @@
"""
commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version']
return tuple([_find_exe_version(cmd) for cmd in commands])
+
+def is_cygwingcc():
+ '''Try to determine if the gcc that would be used is from cygwin.'''
+ from subprocess import Popen, PIPE
+ out = Popen(['gcc', '-dumpmachine'], shell=True, stdout=PIPE).stdout
+ try:
+ out_string = out.read()
+ finally:
+ out.close()
+ # out_string is the target triplet cpu-vendor-os
+ # Cygwin's gcc sets the os to 'cygwin'
+ return out_string.decode('ascii').strip().endswith('cygwin')
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com