7

i'm trying to learn a lot of python on windows and that includes installing several packages, however everytime i invoke python setup.py install i have a problem with -mno -cygwin for gcc.

i've have read already a lot of articles and it seems they want that these individual packages to wait for the fix on their own builds.

can anyone just provide me a gcc version that i can install that still supports -mno -cygwin so i can go on studying the areas i would like to focus?

thanks!

user1260765
  • 81
  • 1
  • 2
  • 1
    The deprecated -mno-cygwin option was removed in gcc 4.7.0. See [this question](http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o) for more details. – Ben Hoyt Dec 06 '12 at 19:26

2 Answers2

18

I had this problem too, and this is a bug in the Python code. The only way I found to fix it was to edit the file C:\Python27\Lib\distutils\cygwinccompiler.py.

In this file you must remove every occurence of -mno-cygwin.

The same goes for GCC installed through MinGW.

orlp
  • 112,504
  • 36
  • 218
  • 315
  • Just to clarify this, there should only be four occurrences of it, in `Mingw32CCompiler.__init__`. Fix should be reliable. – brianmearns Oct 17 '13 at 17:51
1

I had the same problem which has been fixed by replacing instances of the string "-mno-cygwin" with "" in the C:\Python27\Lib\distutils\cygwinccompiler.py

i.e.

Original code:

    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'
                                    % (self.linker_dll, shared_option,
                                       entry_point))

Updated code:

    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))

What version GCC compiler do you use? You will not get this issue if you use GCC 3.4.4 otherwise you need to replace "-mno-cygwin" string with empty quotes as mentioned above especially for GCC 4.3.7.

Khokhar
  • 685
  • 1
  • 9
  • 22