The other Py2.4 issue
Acceptance for Py2.4 partially hinges on how quickly third party apps have their binaries updated. I wonder if there is anything we can do to help. Raymond -----Original Message----- From: image-sig-bounces@python.org [mailto:image-sig-bounces@python.org] On Behalf Of Tuure Laurinolli Sent: Tuesday, December 07, 2004 2:51 AM To: image-sig@python.org Subject: [Image-SIG] Re: Python 2.4 Spencer Ogden wrote:
I was wondering if there was a time frame for a windows binary for Py 2.4. Is it possible to compile the source against 2.4 myself?
There didn't seem to be any problems compiling it against 2.4. I managed to get some version up and running, but problems with the required shared libraries(I seem to have many, incompatible versions of jpeg around...) killed my enthusiasm and I returned to 2.3. _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig
Hi, On Wed, Dec 08, 2004 at 11:43:49PM -0500, Raymond Hettinger wrote:
Acceptance for Py2.4 partially hinges on how quickly third party apps have their binaries updated.
I wonder if there is anything we can do to help.
For people like myself, Linux programmers not developing on Windows every day, there is precious little information available about how to compile our extension modules for the new Windows distribution. I was actually very disappointed to have to google my way around until I found a page that explained to me that to use Microsoft's free compilers you need to manually patch the distutils included with 2.4. (I know this is being worked on right now but I'd have expected it to be present in the 2.4 release.) (The only page I could find still refers to a pre-final 2.4 so their distutils patch doesn't apply without hand-editing, though that should be fixed by now.) Moreover, the standard documentation's "Extending and Embedding" has apparently not been updated at all since 2.3. That's quite unexpected too... In other words, if you want 3rd parties to compile Windows binaries for 2.4, tell them how. (I even hoped that just doing "python setup.py build" would fail but refer me to a web page that explains me which free compilers I should get and install from Microsoft.) A bientot, Armin.
On Fri, 10 Dec 2004 10:06:59 +0000, Armin Rigo
For people like myself, Linux programmers not developing on Windows every day, there is precious little information available about how to compile our extension modules for the new Windows distribution. I was actually very disappointed to have to google my way around until I found a page that explained to me that to use Microsoft's free compilers you need to manually patch the distutils included with 2.4. (I know this is being worked on right now but I'd have expected it to be present in the 2.4 release.) (The only page I could find still refers to a pre-final 2.4 so their distutils patch doesn't apply without hand-editing, though that should be fixed by now.) [...] In other words, if you want 3rd parties to compile Windows binaries for 2.4, tell them how.
I think that the details about the Microsoft free compilers is a bit misleading. Sure, it's great that it exists, but at the present time, it is not the best free option (too many downloads required, too many rough edges). For most C extensions, the best free option is mingw. This is fully supported by distutils, and has been for a while. It is documented in the manuals, but basically all you need is to do the following: 1. Obtain a reasonably recent mingw (3.3.3 definitely works, you need msvcr71 support). 2. Install it, and make sure it is in your PATH. 3. Build libpython24.a as documented in the Python manuals (recent versions of mingw can read MS import libraries, so this may no longer be needed, but I haven't tested this yet). 4. python setup.py build --compiler=mingw32. The only difficulties are: 1. Obtaining support libraries like jpeg, sdl, etc. It *may* be a nuisance getting mingw-compatible build, but as I say above, MS-format libraries may now be fine, and there are good sources of mingw-compatible libraries like gnuwin32.sourceforge.net. 2. Microsoft-specific code. (As I'm replying to Armin, maybe the fact that inline assembler formats are different is relevant :-) :-)) To be honest, I'd only ever use the MS free compilers if I had a critical need to build an extension which had some highly MS-specific code or build processes. And even then, I'd probably give up and wait for someone with MSVC7 to produce a binary... If anyone has any particular modules (of their own, or third party) they have problems with, I'd be happy to have a go at building, and report back. Maybe a page on the Python Wiki about building modules using mingw would be worth adding. Hmm, might do that tonight... Hope this helps, Paul.
Hi, On Fri, Dec 10, 2004 at 12:06:01PM +0000, Paul Moore wrote:
For most C extensions, the best free option is mingw.
Sorry, I was not aware that mingw supports the new VC7.1-type of runtime that is needed for the extension module to load with the official Python 2.4 distribution. Note that compiling with Microsoft's free compiler (after the huge downloads and the manual patching) worked just fine, so I think it is worth a note somewhere. Another note: can you report on whether building libpython24.a can be skipped for mingw? I'm thinking about the specific situation where we want on-site compilation of extension modules with a minimal number of things to install first. E.g. if we need to compile libpython24.a it means we need to fetch the Python sources themselves first. (A use case is for prorgams that dynamically produce and compile extension modules, as "weave" or the PyPy test suite do.) A bientot, Armin.
At 05:19 PM 12/10/04 +0000, Armin Rigo wrote:
Another note: can you report on whether building libpython24.a can be skipped for mingw? I'm thinking about the specific situation where we want on-site compilation of extension modules with a minimal number of things to install first. E.g. if we need to compile libpython24.a it means we need to fetch the Python sources themselves first.
Actually, no, you don't need the sources. See: http://mail.python.org/pipermail/python-dev/2004-January/041676.html for a script that builds libpython24.a from the python24.lib distributed with Python for Windows.
On Dec 10, 2004, at 1:05 PM, Phillip J. Eby wrote:
At 05:19 PM 12/10/04 +0000, Armin Rigo wrote:
Another note: can you report on whether building libpython24.a can be skipped for mingw? I'm thinking about the specific situation where we want on-site compilation of extension modules with a minimal number of things to install first. E.g. if we need to compile libpython24.a it means we need to fetch the Python sources themselves first.
Actually, no, you don't need the sources. See:
http://mail.python.org/pipermail/python-dev/2004-January/041676.html
for a script that builds libpython24.a from the python24.lib distributed with Python for Windows.
Shouldn't this be distributed with binary distributions of Python, to save people the trouble? Or, if it can be skipped, the procedure for doing a mingw build with the .lib should be documented and that'd be the end of it. -bob
At 01:12 PM 12/10/04 -0500, Bob Ippolito wrote:
On Dec 10, 2004, at 1:05 PM, Phillip J. Eby wrote:
At 05:19 PM 12/10/04 +0000, Armin Rigo wrote:
Another note: can you report on whether building libpython24.a can be skipped for mingw? I'm thinking about the specific situation where we want on-site compilation of extension modules with a minimal number of things to install first. E.g. if we need to compile libpython24.a it means we need to fetch the Python sources themselves first.
Actually, no, you don't need the sources. See:
http://mail.python.org/pipermail/python-dev/2004-January/041676.html
for a script that builds libpython24.a from the python24.lib distributed with Python for Windows.
Shouldn't this be distributed with binary distributions of Python, to save people the trouble?
The Python developers who produce the Windows binaries don't use mingw/cygwin, so this would put a maintenance burden on them.
Or, if it can be skipped, the procedure for doing a mingw build with the .lib should be documented and that'd be the end of it.
It's actually documented now, in the "Installing Python Modules" manual. See: http://docs.python.org/inst/tweak-flags.html#SECTION000622000000000000000 It just would need to have the libpython.a instructions removed in that case.
Phillip J. Eby wrote:
The Python developers who produce the Windows binaries don't use mingw/cygwin, so this would put a maintenance burden on them.
If this were completely automatic (e.g. part of msi.py), I'd happily add all utilities needed to integrated this into the build process. For this to happen: 1. Somebody else needs to do the actual work. I.e. write a patch to msi.py that invokes all the necessary magic, and test that patch. 2. The patch should avoid manual configuration of the "use cygwin" case. I.e. it should try to find the cygwin on the path, or in their standard location, or use any other mechanism available to locate cygwin. It should produce an error message if cygwin tools cannot be found, and then proceed without out creating libpython24.a Regards, Martin
Hi, On Fri, Dec 10, 2004 at 01:19:10PM -0500, Phillip J. Eby wrote:
http://mail.python.org/pipermail/python-dev/2004-January/041676.html
Shouldn't this be distributed with binary distributions of Python, to save people the trouble?
The Python developers who produce the Windows binaries don't use mingw/cygwin, so this would put a maintenance burden on them.
This thread started as "how to convince people to build their extension modules quickly for Python 2.4". I was just suggesting that taking a bit of that burden away from us non-Windows-users would be helpful :-)
Or, if it can be skipped, the procedure for doing a mingw build with the .lib should be documented and that'd be the end of it.
It's actually documented now, in the "Installing Python Modules" manual.
Oh right... Well, I didn't notice because, oddly, there is another set of pages on the same subject (but with different details and up-to-date-ness) in "Extending and Embedding the Python Interpreter". I guess that one of them should be removed and point to the other... A bientot, Armin.
E.g. if we need to compile libpython24.a it means we need to fetch the Python sources themselves first.
Actually, no, you don't need the sources. See:
http://mail.python.org/pipermail/python-dev/2004-January/041676.html
for a script that builds libpython24.a from the python24.lib distributed with Python for Windows.
Previously I built libpython24.a; it can be downloaded from my website. See http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/cygwin.html --Michiel. -- Michiel de Hoon, Assistant Professor University of Tokyo, Institute of Medical Science Human Genome Center 4-6-1 Shirokane-dai, Minato-ku Tokyo 108-8639 Japan http://bonsai.ims.u-tokyo.ac.jp/~mdehoon
On Fri, 10 Dec 2004 17:19:21 +0000, Armin Rigo
Another note: can you report on whether building libpython24.a can be skipped for mingw?
A first attempt seems to almost work. There is a problem with structures, however - I get an error about unresolved references to _imp___Py_NoneStruct. My guess is that there's some issue with resolving references to data (as opposed to functions) from DLLs. I'll investigate further and then report back. But this is specifically if you *don't* build libpytho24.a. If you build that, there's no problem at all. Paul.
On Fri, 10 Dec 2004 20:40:10 +0000, Paul Moore
On Fri, 10 Dec 2004 17:19:21 +0000, Armin Rigo
wrote: Another note: can you report on whether building libpython24.a can be skipped for mingw?
A first attempt seems to almost work. There is a problem with structures, however - I get an error about unresolved references to _imp___Py_NoneStruct. My guess is that there's some issue with resolving references to data (as opposed to functions) from DLLs. I'll investigate further and then report back.
OK. After some more extensive investigation: 1. You cannot use python24.lib (ie, skip building libpython24.a). If you do, data values exported from python24.dll (specifically, Py_NoneStruct, which is quite important :-)) do not get exported correctly. I don't know exactly why - I guess it's something to do with how the MS LIB format works. 2. You can, however, link direct to python24.dll, which works fine. Unfortunately, there are 2 problems with this - first, distutils doesn't support it as things stand, and second, it isn't possible to get the full path of the Python DLL without using Mark Hammond's pywin32, or custom C code :-( (You need to get from sys.dllhandle to the filename, and the API to do this isn't exposed). 3. In some cases, an extension built with mingw still contains references to msvcrt (I think Martin has noted this). This seems *not* to be an issue. What is happening, is that any symbols referenced from user code are satisfied from msvcr71, and so match the Python DLL. However, if the mingw startup code uses symbols which have not been satisfied by the time all references from user code are resolved, then these references are satisfied from msvcrt. But I can't see any way that these references are going to do any harm, as they are startup code, which by its nature will have been written to work cleanly in this situation (linking like this is explicitly supported by mingw). Martin, as the CRT compatibility expert, does this sound reasonable? The mingw people certainly seem to think that the situation is OK... You could probably incorporate Philip Eby's script, posted here a while ago, which he mentioned earlier in this thread, into a setup.py so that if libpython24.a didn't already exist, the setup script would build it. This would give you a reasonably clean way of making sure it was present. Philip's script doesn't need anything but mingw installed, AIUI. Longer term, I'll see if I can put together a distutils patch to make it reference pythonXX.dll directly, so removing the need for libpythonXX.a in the future. Obviously, this is only going to be relevant for Python 2.5 and later, though. Sorry for the long mail, but I thought it would be useful to get the details in the archives... Paul.
At 10:06 AM 12/10/04 +0000, Armin Rigo wrote:
Hi,
On Wed, Dec 08, 2004 at 11:43:49PM -0500, Raymond Hettinger wrote:
Acceptance for Py2.4 partially hinges on how quickly third party apps have their binaries updated.
I wonder if there is anything we can do to help.
For people like myself, Linux programmers not developing on Windows every day, there is precious little information available about how to compile our extension modules for the new Windows distribution.
I personally find MinGW (by way of Cygwin) to be the easiest way to do it. I posted here previously with the procedure and even a script to prepare the necessary libpython24.a file.
Hi Martin, On Sat, Dec 11, 2004 at 12:45:01AM +0100, "Martin v. Löwis" wrote:
The straight-forward answer is: Get VC7.1 (aka VS.NET 2003), and invoke
python setup.py bdist_wininst
That's not too hard to do, I think.
Hum, this is getting into a Linux-vs-Windows argument. I don't want to invest time and money on Windows tools just to compile my extension module for Windows users... Armin
Armin Rigo wrote:
Hi Martin,
On Sat, Dec 11, 2004 at 12:45:01AM +0100, "Martin v. Löwis" wrote:
The straight-forward answer is: Get VC7.1 (aka VS.NET 2003), and invoke
python setup.py bdist_wininst
That's not too hard to do, I think.
Hum, this is getting into a Linux-vs-Windows argument. I don't want to invest time and money on Windows tools just to compile my extension module for Windows users...
Maybe we can set this up as a service? I have the compiler and could do something like doing a checkout, build, and upload new binary for a number of projects. What is needed is a simple but secure notification method. Probably I need one windows machine which is always online. ciao - chris -- Christian Tismer :^) mailto:tismer@stackless.com tismerysoft GmbH : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/
Christian Tismer wrote:
Maybe we can set this up as a service? I have the compiler and could do something like doing a checkout, build, and upload new binary for a number of projects.
I don't think this needs to be too automated. Offering this service is a good thing, and if somebody volunteers, I will applaud. However, I believe that it will be used less often than this thread might suggest: Many developers do have VS.NET available, or know somebody in their user community who does (or would know if they asked), so a "global" compilation service would likely be an infrequently-used fallback. Nevertheless: if somebody wants to offer this for, say, 6 months, I'd be really curious what the feedback will be. We could announce this on pydotorg and elsewhere if that volunteers desires. Regards, Martin
On Sat, 11 Dec 2004 19:57:55 +0100, Christian Tismer
Armin Rigo wrote:
Hum, this is getting into a Linux-vs-Windows argument. I don't want to invest time and money on Windows tools just to compile my extension module for Windows users...
First of all, I'm assuming this is a timing issue. If I understood your initial posting, your concern was that people wanted Windows build of your extension *now*, and it was going to take you time to make it available. That's a different issue from you not having the facilities to build the Windows installers at all, where you rely on 3rd parties making builds available. As Martin points out, ultimately the provision of Windows binaries is an issue for the extension project - is the demand high enough to justify the effort, can you find tools and/or a helper, etc etc. But the former issue (how quickly you can provide binaries, assuming that you will do so ultimately) is more relevant for python-dev. Specifically, because lack of binary extensions can be a barrier to take-up of the new version. Certainly, in the past, you could pretty much guarantee that there would be very few Windows users testing beta releases, because pywin32 binaries weren't available. With 2.4, I have at least one system I'd upgrade *now* but for the lack of a critical extension in binary form (I haven't yet had the time to try to adapt the build process to mingw for myself).
Maybe we can set this up as a service?
That sounds like a good idea. What I'd suggest is needed is a website where the following can take place: 1. People have a way of posting rquests for particular modules. 2. Installers can be uploaded to satisfy those requests. 3. There is somewhere to put step-by-step "build it yourself" instructions, using free components, so that people *without* access to VS.NET can make progress themselves. Obviously, if a particular extension can't be built with free compilers, then binaries or access to VS.NET are the only options. The installers should be clearly noted as having no warranty or support implied, to encourage people to offer binaries they have built without feeling that they are taking on a support burden. Conversely, as soon as "official" binaries are available from the extension project, the binaries available here should be removed (and replaced with a link to the official site) to reinforce the "unofficial" nature of the binaries provided here. The biggest potential issue with such a site is clearly validation. I've no idea how to make something like this work without it being a major virus risk. Which may, sadly, be enough to kill the idea :-( Paul.
Armin Rigo wrote:
Hum, this is getting into a Linux-vs-Windows argument. I don't want to invest time and money on Windows tools just to compile my extension module for Windows users...
If you don't have Windows at all, you cannot create Windows installers for your users, anyway. If you do have Windows, but you normally don't use it for software development (so you have no copy of MSVC), you have to invest money, indeed. You don't have to invest time - atleast not as much time as you need to invest finding out how these alternative compilers work. However, for free software, things work quite differently, anyway: if you (as a package author) don't have the time and money to create a Windows package, tell your users that you won't create one. Instead, ask for a volunteer to create a package for you. If your package has a large Windows user community, somebody will have the money, and they will find the time if the build process is as simple as bdist_wininst. If none of your users volunteers to do the build for you, I would stop worrying about the Windows users. Regards, Martin
On Sun, 12 Dec 2004 16:40:22 +0100, Martin v. Löwis
If none of your users volunteers to do the build for you, I would stop worrying about the Windows users.
Sorry, Martin. I understand your point, but I think you are not being realistic. I for myself took the decision to use only free tools for my own development, but I still have to suport my Windows customers. I can't force them to change to Linux. I don't own a copy of MSVC. Also, one of the reasons to choose a third part module is to save time. The moment I am required to recompile everything myself I'm losing this convenience. This of course impacts my ability to focus on my own work, and so the story goes. I'm not saying that module authors should work for free just to save me some time & hassle. It's fair if an author decides to release a Linux-only module. But again -- this is not realistic. The world has a lot of Windows users, and I depend on them for my own income. If I can't find a good set of Python tools for my projects, what should I do? Picking another language is not a choice, mind you :-) All in all, I sincerely hope that this discussion end up in a high note. I'm not qualified to talk about the particulars of C compilers & development environments, but as a Python user, I have hope that a good solution will be found to make the process of building Python extensions for Windows more convenient. The dream scenario is not to require recompiling, at least inside the same major release (2.4 to 2.5, for example). That would be really great. -- Carlos Ribeiro Consultoria em Projetos blog: http://rascunhosrotos.blogspot.com blog: http://pythonnotes.blogspot.com mail: carribeiro@gmail.com mail: carribeiro@yahoo.com
Carlos Ribeiro wrote:
If none of your users volunteers to do the build for you, I would stop worrying about the Windows users.
Sorry, Martin. I understand your point, but I think you are not being realistic. I for myself took the decision to use only free tools for my own development, but I still have to suport my Windows customers. I can't force them to change to Linux. I don't own a copy of MSVC. Also, one of the reasons to choose a third part module is to save time. The moment I am required to recompile everything myself I'm losing this convenience. This of course impacts my ability to focus on my own work, and so the story goes.
I did not suggest that *all* your Windows users should recompile your module - just a single one would be sufficient.
I'm not saying that module authors should work for free just to save me some time & hassle. It's fair if an author decides to release a Linux-only module. But again -- this is not realistic. The world has a lot of Windows users, and I depend on them for my own income. If I can't find a good set of Python tools for my projects, what should I do? Picking another language is not a choice, mind you :-)
As I said: Find a volunteer that has the necessary build infrastructure, and have that volunteer build the extension for you.
The dream scenario is not to require recompiling, at least inside the same major release (2.4 to 2.5, for example). That would be really great.
That is guaranteed. Extensions built for 2.4 will certainly continue to work in 2.4.1, and later 2.4.x. They will stop working with 2.5 (as they are linked with python24.dll). Regards, Martin
On Sun, Dec 12, 2004 at 04:40:22PM +0100, "Martin v. L?wis" wrote:
Armin Rigo wrote:
Hum, this is getting into a Linux-vs-Windows argument. I don't want to invest time and money on Windows tools just to compile my extension module for Windows users...
If you don't have Windows at all, you cannot create Windows installers for your users, anyway.
Actually you are wrong there! We cross compile our major application
(about 500k lines of C/C++) on linux/x86 for various architectures,
Windows/x86 being one of them. We create the Windows installer using
the Nullsoft installer (which we run under Wine) and compile with a
gcc / mingw cross compiler. This all works very well and means we can
build all our architectures every night on a single machine.
I'm following this thread with interest because we are considering
embedding Python into this project, and I'm wondering whether we can
cross compile python using mingw (almost certainly by the sound of
it), but probably harder would be to make python module build and
install system work cross-wise.
--
Nick Craig-Wood
participants (10)
-
"Martin v. Löwis"
-
Armin Rigo
-
Bob Ippolito
-
Carlos Ribeiro
-
Christian Tismer
-
Michiel Jan Laurens de Hoon
-
Nick Craig-Wood
-
Paul Moore
-
Phillip J. Eby
-
Raymond Hettinger