2

So, I'd like to compile py2exe using mingw & I got an error. Does anybody know how to fix that?

D:\devel\py2exe-0.6.9>python setup.py build -cmingw32
running build
running build_py
creating build
creating build\lib.win32-2.7
copying zipextimporter.py -> build\lib.win32-2.7
creating build\lib.win32-2.7\py2exe
copying py2exe\boot_common.py -> build\lib.win32-2.7\py2exe
copying py2exe\boot_com_servers.py -> build\lib.win32-2.7\py2exe
copying py2exe\boot_ctypes_com_server.py -> build\lib.win32-2.7\py2exe
copying py2exe\boot_service.py -> build\lib.win32-2.7\py2exe
copying py2exe\build_exe.py -> build\lib.win32-2.7\py2exe
copying py2exe\mf.py -> build\lib.win32-2.7\py2exe
copying py2exe\__init__.py -> build\lib.win32-2.7\py2exe
creating build\lib.win32-2.7\py2exe\resources
copying py2exe\resources\StringTables.py -> build\lib.win32-2.7\py2exe\resources
copying py2exe\resources\VersionInfo.py -> build\lib.win32-2.7\py2exe\resources
copying py2exe\resources\__init__.py -> build\lib.win32-2.7\py2exe\resources
running build_ext
building '_memimporter' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\source
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DPYTHONDLL=\"PYTHON27.DLL\" -DPYTHONCOM=\"pythoncom27.dll\" -IC:\Python27\include -IC:\Python27\PC -c source/MemoryModule.c -o build\temp.win32-2.7\Release\source\memorymodule.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1

How to remove -mno-cygwin from build options?

alex
  • 521
  • 1
  • 5
  • 17

1 Answers1

1

This is a known problem due to unmaintenance by the Python devs to follow MinGW GCC development:

http://bugs.python.org/issue12641

Since 2010-something GCC removed that option due to confusing the people who used the switch. The bug report contains a fix to one of Python's distutils configuration files that you can apply without rebuilding Python or anything.


UPDATE: the error is clear, the code you are compiling is redefining a type that is defined in a Python header:

source/Python-version.h:13:18: error: redefinition of typedef 'Py_ssize_t'
C:\Python27\include/pyport.h:172:25: note: previous declaration of 'Py_ssize_t'

Remove the typedef of Py_ssize_t in your code. There might be some configury stuff going wrong. Be sure to do a clean rebuild after fixing the -mno-cygwin problem.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • I have remove -mno-cygwin from distutils, so now compilation broken at [Here is code](http://paste.pound-python.org/show/3384) does anybody know how to fix that? – alex Nov 17 '11 at 14:16