2011-11-17 150 views
2

所以,我想编译py2exe使用mingw &我得到一个错误。有人知道如何解决这个问题吗?py2exe mingw编译

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 

如何从构建选项中删除-mno-cygwin?

回答

1

这是一个已知的问题,因为由Python开发者unmaintenance遵循MinGW的GCC开发:

http://bugs.python.org/issue12641

自2010年以来,一些GCC删除的选择,由于混淆谁使用交换机的人。该错误报告包含了一个修复了Python的distutils配置文件之一,您可以在不重建Python或任何东西的情况下应用这些文件。


UPDATE:错误是明确的,你编译代码是重新定义了在一个Python头定义的类型:

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' 

在你的代码删除的Py_ssize_t typedef的。可能有一些配置错误。修复-mno-cygwin问题后,请务必进行彻底重建。

+0

我有删除的distutils -mno-cygwin的,所以现在在编译打破 [下面是代码(http://paste.pound-python.org/show/3384)没有任何人知道如何解决这个问题? – alex