[issue2445] Use The CygwinCCompiler Under Cygwin

Roumen Petrov report at bugs.python.org
Wed Sep 24 11:52:50 CEST 2008

Roumen Petrov <bugtrack at roumenpetrov.info> added the comment:

May be check for compiler.compiler_type (from sysconfig.py ) has to be
replaced with a check for descendant classes of UnixCCompiler, i.e. to
include mingw32 too ?

Also CygwinCCompiler __init__ has to be reviewed too. As example :
        # Hard-code GCC because that's what this is all about.
        # XXX optimization, warnings etc. should be customizable.
        self.set_executables(compiler='gcc -mcygwin -O -Wall',
May override in unexpected way settings from customize_compiler.

I thin that proposed modification in sysconfig.py with removing(or
replacing)  of self.set_executables from CygwinCCompiler __init__  will
help me for issue3871 (cross building python for mingw32 with distutils). 

As example I will remove a hack in the setup.py:
@@ -196,8 +196,26 @@
         if compiler is not None:
             (ccshared,cflags) =
             args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
+        # FIXME: Is next correct ?
+        # To link modules we need LDSHARED passed to setup.py otherwise
+        # distutils will use linker from build system if cross-compiling.
+        linker_so = os.environ.get('LDSHARED')
+        if linker_so is not None:
+            args['linker_so'] = linker_so
Thanks to Hirokazu who point me, in an another thread, that cygwin build
don't use CygwinCCompiler.

nosy: +rpetrov

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list