On Windows 7, when trying to compile pygraphviz, I run
python setup.py build -c mingw32
I get
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-IC:\Program Files (x86)\Graphv iz 2.28\include\graphviz" -Ic:\Python27\include -Ic:\Python27\PC -c pygraphviz/g raphviz_wrap.c -o build\temp.win-amd64-2.7\Release\pygraphviz\graphviz_wrap.o cc1.exe: error: unrecognized command line option '-mno-cygwin' error: command 'gcc' failed with exit status 1
Where is that '-mno-cygwin' coming from? Greping through the pygraphviz-1.1 directory shows no occurences of "no-cygwin".
See this answer: https://stackoverflow.com/a/6035864/1516291
In short, you may need to modify distutils\cygwinccompiler.py
in your python installation dir to remove traces of -mno-cygwin
.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With