Building extensions with mingw32 -- bdist_wininst fails.

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Thu Aug 7 23:04:03 EDT 2003


----- Original Message -----
From: "Thomas Heller" <theller at python.net>

> > I checked the archives regarding that error message and
> > found a conversation wherein Jeremy Hylton claimed he
> > might have added the code to detect this, and Paul Moore
> > asked to have it removed/disabled at least for mingw32
> > (which makes binaries 100% compatible with MSVC6).  In
> > the case given then, the extension wouldn't build at
> > all; now it builds but I can't make a Windows installer
> > from it.
>
> Can you point me to this discussion, please? Then I'll
> try to look after this.
>
> Thomas

Thanks!  First, here's where I found the messages I refer
to above:

http://mail.python.org/pipermail/distutils-sig/2003-July/003339.html

OK, here's the problem.  The distutils bdist_wininst
script calls build (illustrated below) but does not
accept --compiler=mingw32.  This is obviously wrong,
but I'm unsure how to fix it (I'm still trying to wrap
my fuzzy and tired mind around the entire distutils
thing).

Here it is with Python 2.2.2 and Python 2.3.  I never
realized this before, but the --compiler option doesn't
work with bdist_wininst in that version either.  I've
been doing the build first, then bdist_wininst as a
separate command, and that works... evidently because
the MSVC compiler version check isn't there, the
MSVCCompiler class accepts the binaries built by a
previous pass of the mingw32 compiler.

Adding the compiler version check simply makes the error
in the bdist_wininst script obvious.

With PYTHON 2.2.2 (downloaded from python.org)
----------------------------------------------------------

C:\usr\WConio-1.5>python setup.py bdist_wininst --compiler=mingw32
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --compiler not recognized

C:\usr\WConio-1.5>python setup.py build --compiler=mingw32
running build
running build_py
creating build
creating build\lib.win32-2.2
copying WConio.py -> build\lib.win32-2.2
running build_ext
building '_WConio' extension
creating build\temp.win32-2.2
creating build\temp.win32-2.2\Release
C:\MINGW32\BIN\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\PYTHON\include -c
WConiom
odule.c -o build\temp.win32-2.2\Release\wconiomodule.o
WConiomodule.c:139: warning: `ConPuts' defined but not used
writing build\temp.win32-2.2\Release\_WConio.def
C:\MINGW32\BIN\dllwrap.exe -mno-cygwin -mdll -static --output-lib
build\temp.win
32-2.2\Release\lib_WConio.a --def
build\temp.win32-2.2\Release\_WConio.def -s
build\temp.win32-2.2\Release\wconiomodule.o -LC:\PYTHON\libs -lpython22 -o
build\lib.win32-2.2\_WConio.pyd


With PYTHON 2.3 (also downloaded from python.org)
----------------------------------------------------------

C:\usr\WConio-1.5>python setup.py build --compiler=mingw32
running build
running build_py
creating build
creating build\lib.win32-2.3
copying WConio.py -> build\lib.win32-2.3
running build_ext
building '_WConio' extension
creating build\temp.win32-2.3
creating build\temp.win32-2.3\Release
C:\MINGW32\BIN\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\PYTHON\include -IC:\P
YTHO
N\PC -c WConiomodule.c -o build\temp.win32-2.3\Release\wconiomodule.o
WConiomodule.c:139: warning: `ConPuts' defined but not used
writing build\temp.win32-2.3\Release\_WConio.def
C:\MINGW32\BIN\dllwrap.exe -mno-cygwin -mdll -static --output-lib
build\temp.win
32-2.3\Release\lib_WConio.a --def
build\temp.win32-2.3\Release\_WConio.def -s
build\temp.win32-2.3\Release\wconiomodule.o -LC:\PYTHON\libs -LC:\PYTHON\PCB
uild -lpython23 -o build\lib.win32-2.3\_WConio.pyd

C:\usr\WConio-1.5>python setup.py bdist_wininst
running bdist_wininst
running build
running build_py
running build_ext
error: Python was built with version 6 of Visual Studio, and extensions need
to
be built with the same version of the compiler, but it isn't installed.

------------------------------------------------------------
Note that the error message for adding --compiler=mingw32
to bdist_wininst is the same for both versions, so I've
omitted it here.

Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net








More information about the Python-list mailing list