473,320 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Building extensions with mingw32 -- bdist_wininst fails.

I'll be quick. Here's a transcript:

C:\usr\WConio-1.5>python setup.py build --compiler=mingw32
running build
running build_py
running build_ext
building '_WConio' extension
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 bu
ild\temp.win32-2.3\Release\wconiomodule.o -LC:\PYTHON\libs -LC:\PYTHON\PCBui
ld -
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.

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.

mingw32 should be treated as 100% equivalent to MSVC6 in all cases...
please. I've got people clamoring for two of my extensions (and I didn't
even think they were popular) but I can't build installers.

Is there any way I can get this to work? If I have to I'll hack that check
out of Distutils with an axe, but still this should be fixed.

Chris Gonnerman -- ch*************@newcenturycomputers.net
http://newcenturycomputers.net
Jul 18 '05 #1
6 2381
[posted and mailed]
"Chris Gonnerman" <ch*************@newcenturycomputers.net> writes:
I'll be quick. Here's a transcript:

C:\usr\WConio-1.5>python setup.py build --compiler=mingw32
running build
running build_py
running build_ext
building '_WConio' extension
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 bu
ild\temp.win32-2.3\Release\wconiomodule.o -LC:\PYTHON\libs -LC:\PYTHON\PCBui
ld -
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.

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
Jul 18 '05 #2
----- Original Message -----
From: "David Rushby" <wo**********@rocketmail.com>

I have no trouble doing what you describe (with Python 2.1.3, 2.2.3,
or 2.3).

The core Pythons I'm using were compiled with MSVC 6 SP5 on Windows
2000 SP4, but I can build extension modules and installers just fine
with MinGW (3.0-rc4). The only preparatory step was to generate
libpythonXX.a, as described in the Section 6.2.2 of the standard
library docs.

Are you sure your compiler setup is correct? Was the core Python 2.3
you're using actually built with MSVC 6, as the error message claims?


Well, now I'm not sure. Is the installer binary from
python.org built with MSVC 6 or something else?

If it is something else, do I have to upgrade my MinGW32 gcc? It's
currently 2.95.2 I think.

Chris Gonnerman -- ch*************@newcenturycomputers.net
http://newcenturycomputers.net

Jul 18 '05 #3
"Chris Gonnerman" <ch*************@newcenturycomputers.net> writes:
----- Original Message -----
From: "Thomas Heller" <th*****@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.


Please excuse, if it is a bit out topic.

When I tried to build an extension module for Python2.2 with MingW3.0 I had
problems with the conversion of files. So

myfile = PyFile_AsFile(object);

would crash python2.2 when a standard Python2.2 was invoking an extension
module compiled with MinGW.

Do you use such conversions in your Module?

Thanks for your help
Best Regards
Pierre
Jul 18 '05 #4
[posted and mailed]

"Chris Gonnerman" <ch*************@newcenturycomputers.net> writes:
From: "Thomas Heller" <th*****@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/dis...ly/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).

There's an easy workaround.
python setup.py bdist_wininst --compiler=mingw32
does *not* work.
But this one does:

python setup.py build --compiler=mingw32 bdist_wininst

Maybe this should be documented somewhere?

I've tried it with one of my simple extension modules at least,
and after hacking msvccompiler so that this one isn't found any longer.

Thomas
Jul 18 '05 #5
----- Original Message -----
From: "Pierre Schnizer" <P.********@nospam.gsi.de>

Please excuse, if it is a bit out topic.

When I tried to build an extension module for Python2.2 with MingW3.0 I had problems with the conversion of files. So

myfile = PyFile_AsFile(object);

would crash python2.2 when a standard Python2.2 was invoking an extension
module compiled with MinGW.

Do you use such conversions in your Module?


No, I don't. That's interesting, though... thanks for
the information.

Chris Gonnerman -- ch*************@newcenturycomputers.net
http://newcenturycomputers.net

Jul 18 '05 #6
"Chris Gonnerman" <ch*************@newcenturycomputers.net> writes:
> 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).

There's an easy workaround.

python setup.py build --compiler=mingw32 bdist_wininst


Well, whaddaya know, it works! Thanks!

I still think the bdist*.py scripts should accept
--compiler=mingw32 (or whatever) as a matter of
correctness, if nothing else; but I can live with
this. Perhaps if I get time I'll work up a patch.


I'm not so convinced that this is needed. I always view the disutils
commands as a stack or chain, and the command line above can be used to
inject flags in vertain places in the chain. the build commands, for
example, accept quite some parameters which are not valid for the
install or (s|b)dist commands (--debug is another example).
So, to install debug versions, one would use
python setup.py build --debug install
which also looks natural to me.

The --compiler problem may be unique because obviously the build command
constructs a compiler instance even if it has nothing to do, and the
build command is run from bdist_wininst to make sure everything is ok.

Oh, and yet another way, which you may want to try, is to write an
(maybe even site-global) distutils configuration file containing
[build]
compiler = mingw32
If this works, you no longer have to remember to give the compiler
option on the command line.

Thomas
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andreou Giannis | last post by:
Allthough it is possible to build modules in Python2.3.3 and distutils with cygwin, by running: setup.py build --compiler=cygwin (after i created the libpython23.a) running: setup.py install...
2
by: C. Barnes | last post by:
Normally, one uses the following procedure to build and install a C/C++ extension: python setup.py build --compiler=your_compiler python setup.py install For Python 2.3.3 on Windows, with...
1
by: TPJ | last post by:
Hello, I have another, probably stupid, question. I'm working on some Python project, and I use some extensions written in C. I do all the development on my GNU/Linux box, so my setup.py script...
26
by: Kevin D. Smith | last post by:
I've written a simple Python extension for UNIX, but I need to get it working on Windows now. I'm having some difficulties figuring out how to do this. I've seen web pages that say that MS Visual...
6
by: JW | last post by:
I have a lousy little Python extension, generated with the generous help of Pyrex. In Linux, things are simple. I compile the extension, link it against some C stuff, and *poof*! everything...
3
by: Paolo Pantaleo | last post by:
Well I'm just courious: if I want to buid a C extension, I shoul use the same compiler that has been used to build python (right?). Since python has been built using Visual C, how can I build an...
6
by: Steven Bethard | last post by:
I just tried to upload new versions of the argparse module to PyPI, but it seems like I can no longer upload Windows installers: $ setup.py sdist bdist_wininst upload ... running upload...
15
by: kyosohma | last post by:
Hi, I am trying to get a small group of volunteers together to create Windows binaries for any Python extension developer that needs them, much like the package/extension builders who volunteer...
4
by: GHUM | last post by:
The compile works, BUT linking fails: 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc: \python25\PCBuild -Lc:/p ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.