0

I am using Python27

My PATH contains

C:\MinGW\libexec\gcc\mingw32\4.6.2
C:\MinGW\bin
C:\MinGW\msys\1.0\bin
C:\Python27\
C:\Python27\Scripts

My PYTHONPATH contains

C:\Python27
C:\Python\Lib\site-packages

When I try to install certain packages I keep getting errors with gcc

cc1.exe: error: unrecognized command line option '-mno-cygwin'

seems like it is the culprit, but I've been unable to find information on how to fix this.

Some Examples of Errors:

pip install ctypes 
....
building '_ctypes' extension

    C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Isource/libffi_msvc -IC:\Python27\Lib\site-packages\numpy\core\include -IC:\boost_1_53_0 -IC:\Python27\include -IC:\Python27\PC -c source/_ctypes.c -o
    build\temp.win32-2.7\Release\source\_ctypes.o

    cc1.exe: error: unrecognized command line option '-mno-cygwin'

    error: command 'gcc' failed with exit status 1

another with the same issue

pip install bzr
....
building 'bzrlib._annotator_pyx' extension

C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32 -IC:\Python27\Lib\site-packages\numpy\core\include -IC:\boost_1_53_0 -IC:\Python27\include -IC:\Python27\PC -c bzrlib/_annotator_pyx.c -o build\
temp.win32-2.7\Release\bzrlib\_annotator_pyx.o

cc1.exe: error: unrecognized command line option '-mno-cygwin'



  Cannot build extension "bzrlib._annotator_pyx".
oz123
  • 27,559
  • 27
  • 125
  • 187
Erotemic
  • 4,806
  • 4
  • 39
  • 80

1 Answers1

3

-mno-cygwin in Python\Lib\distutils\cygwinccompiler.py causes this problem: see Compiling with cython and mingw produces gcc: error: unrecognized command line option '-mno-cygwin' or http://korbinin.blogspot.com/2013/03/cython-mno-cygwin-problems.html.

My Python distribution (Anaconda)'s cygwinccompiler.py does not have that though. Anyway, after removing all -mno-cygwin in the definition of the Mingw32CCompiler class you should be able to compile.

Community
  • 1
  • 1
joon
  • 3,899
  • 1
  • 40
  • 53