compiling python2.5 on linux under wine
hey, has anyone investigated compiling python2.5 using winegcc, under wine? i'm presently working my way through it, just for kicks, and was wondering if anyone would like to pitch in or stare at the mess under a microscope. it's not as crazed as it sounds. cross-compiling python2.5 for win32 with mingw32 is an absolute miserable bitch of a job that goes horribly wrong when you actually try to use the minimalist compiler to do any real work. so i figured that it would be easier to get python compiled using wine. i _have_ got some success - a python script and a python.exe.so (which is winegcc's friendly way of telling you you have something that stands a chance of working) as well as a libpython25.dll.so. what i _don't_ yet have is an _md5.dll (or should it be _md5.lib?) i.e. the standard modules are a bit... iffy. the _winreg.o is compiled; the _md5.o is compiled; the winreg.lib is not. whoops. plus, it's necessary to enable nt_dl.c which is in PC/ _not_ in Modules/. one of the key issues that's a bit of a bitch is that python is compiled up for win32 with a hard-coded pyconfig.h which someone went to a _lot_ of trouble to create by hand instead of using autoconf. oh - and it uses visualstudio so there's not even a Makefile. ignoring that for the time-being was what allowed me to get as far as actually having a python interpreter (with no c-based modules). so there's a whole _stack_ of stuff that needs dragging kicking and screaming into the 21st century. there _is_ a reason why i want to do this. actually, there's two. firstly, i sure as shit do _not_ want to buy, download, install _or_ run visual studio. i flat-out refuse to run an MS os and visual studio runs like a dog under wine. secondly, i want a python25.lib which i can use to cross-compile modules for poor windows users _despite_ sticking to my principles and keeping my integrity as a free software developer. thirdly i'd like to cross-compile pywebkitgtk for win32 fourthly i'd like to compile and link applications to the extremely successful and well wicked MSHTML.DLL... in the _wine_ project :) not the one in windows (!) i want to experiment with DOM model manipulation - from python - similar to the OLPC HulaHop project - _but_ i want to compile or cross-compile everything from linux, not windows (see 1 above) fifthly i'd like to see COM (DCOM) working and pywin32 compiled and useable under wine, even if it means having to get a license to use dcom98 and oleauth.lib and oleauth.h etc. and all the developer files needed to link DCOM applications under windows. actually what i'd _really_ like to see is FreeDCE's DCOM work actually damn well finished, it's only been eight years since wez committed the first versions of the IDL and header files, and it's only been over fifteen years since microsoft began its world domination using COM and DCOM. ... but that's another story :) so that's ... five reasons not two. if anyone would like to collaborate on a crazed project with someone who can't count, i'm happy to make available what i've got up to so far, on github.org. l.
On Sat, Jan 3, 2009 at 9:22 PM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
hey, has anyone investigated compiling python2.5 using winegcc, under wine?
some people might find this kind of thing amusing. it's considered in very obtuse circles to be "progress"... :) lkcl@gonzalez:/mnt/src/python2.5-2.5.2/Lib$ ../build/python -v Could not find platform independent libraries <prefix> Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] # installing zipimport hook import zipimport # builtin # installed zipimport hook 'import site' failed; traceback: ImportError: No module named site Python 2.5.2 (r252:60911, Jan 7 2009, 20:33:53) [gcc] on win32 Type "help", "copyright", "credits" or "license" for more information.
import site fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored [....] [....] [....] import sre_compile # from Z:\mnt\src\python2.5-2.5.2\Lib\sre_compile.py fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored # wrote Z:\mnt\src\python2.5-2.5.2\Lib\sre_compile.pyc import _sre # builtin import sre_constants # from Z:\mnt\src\python2.5-2.5.2\Lib\sre_constants.py # wrote Z:\mnt\src\python2.5-2.5.2\Lib\sre_constants.pyc import sre_parse # from Z:\mnt\src\python2.5-2.5.2\Lib\sre_parse.py # wrote Z:\mnt\src\python2.5-2.5.2\Lib\sre_parse.pyc Traceback (most recent call last): File "<stdin>", line 1, in <module> File "site.py", line 415, in <module> main() File "site.py", line 406, in main aliasmbcs() File "site.py", line 356, in aliasmbcs import locale, codecs File "Z:\mnt\src\python2.5-2.5.2\Lib\locale.py", line 167, in <module> import re, operator File "Z:\mnt\src\python2.5-2.5.2\Lib\re.py", line 223, in <module> _pattern_type = type(sre_compile.compile("", 0)) File "Z:\mnt\src\python2.5-2.5.2\Lib\sre_compile.py", line 530, in compile groupindex, indexgroup OverflowError: signed integer is less than minimum
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
secondly, i want a python25.lib which i can use to cross-compile modules for poor windows users _despite_ sticking to my principles and keeping my integrity as a free software developer.
If this eventually leads to being able to compile Python software for Windows under Wine (using for example, py2exe) it would make my life a lot easier. Schiavo Simon
On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross <hodgestar+pythondev@gmail.com> wrote:
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
secondly, i want a python25.lib which i can use to cross-compile modules for poor windows users _despite_ sticking to my principles and keeping my integrity as a free software developer.
If this eventually leads to being able to compile Python software for Windows under Wine (using for example, py2exe) it would make my life a lot easier.
You can already do that: just install windows python under wine. It works quite well, actually. You need mingw, though, of course - Visual Studio is far from being usable on wine. cheers, David
On Thu, Jan 8, 2009 at 12:42 PM, Simon Cross <hodgestar+pythondev@gmail.com> wrote:
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
secondly, i want a python25.lib which i can use to cross-compile modules for poor windows users _despite_ sticking to my principles and keeping my integrity as a free software developer.
If this eventually leads to being able to compile Python software for Windows under Wine (using for example, py2exe) it would make my life a lot easier.
that looks like being an accidental side-effect, yes. where i'm up to so far: * i'm using -I $(src_dir)/PC at the beginning of the includes, so that PC/pyconfig.h gets pulled in as a priority over-and-above the auto-generated pyconfig.h (yukkk - i know); this makes the job of building almost-exactly-like-the-visual-studio-build much easier. * i'm manually compiling-linking the Modules/*.c and PC/*modules.c as i also pulled in PC/config.c and left out Modules/config.c - that got me even further * as a result i've actually got a python.exe.so that.... damnit, it works! the winreg test actually passes for example! the fly in the ointment i'm presently trying to track down: len([1,2]) returns 1L which of course screws up sre_parse.py at line 515 with "TypeError: __nonzero__ should return an int" because duh "if subpattern" is returning a Long not an Int. tracking this down further, it would appear that there's some lovely logic in PyInt_FromSsize_t() which i believe is what's getting called from PyInt_AsSsize_t() which is what's getting called from slot_sq_length() (i think) - and, although in this case this build is _definitely_ returning a Long type when it shouldn't, if the value is ever over LONG_MAX then the result will be "if subpattern" will definitely fail. but... i mean... if ever anyone passes in over 2^^31 items into sre_parse then they _deserve_ to have their code fail, but that's not the point. anyway, i'm floundering around a bit and making a bit of a mess of the code, looking for where LONG_MAX is messing up. l. which of course means that there's a bug in
On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau <cournape@gmail.com> wrote:
On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross <hodgestar+pythondev@gmail.com> wrote:
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
secondly, i want a python25.lib which i can use to cross-compile modules for poor windows users _despite_ sticking to my principles and keeping my integrity as a free software developer.
If this eventually leads to being able to compile Python software for Windows under Wine (using for example, py2exe) it would make my life a lot easier.
You can already do that: just install windows python under wine.
i tried that a few months ago - the builder requires the MS installer, which segfaulted on my installation of wine (i installed it using winetricks) which left me flummoxed because other people report successful use of MSI. i also don't want "just" the python.exe, i want the libpython25.a, i want the libpython25.lib, so as to be able to build libraries such as pywekbit-gtk for win32 (cross-compiled using winegcc of course) unpacking the python installer .exe (which was, again, created with a proprietary program) i found that all of the contents were name-mangled and so were useless: i wasn't about to work my way through nearly a hundred files, manually, when i can just as well get python compiling under wine once and then stand a good chance of being able to repeat the exercise in the future, also for python 2.6. so, basically, i really don't want to use visual studio, i really don't want to install a proprietary MSI installer, i really don't want a proprietarily-built python25.exe, and i really don't want a proprietarily-packed installation. i'd just ... much rather be completely independent of proprietary software when it comes to building free software. .... onwards.... :)
On Thu, Jan 8, 2009 at 11:02 PM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau <cournape@gmail.com> wrote:
On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross <hodgestar+pythondev@gmail.com> wrote:
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton <lkcl@lkcl.net> wrote:
secondly, i want a python25.lib which i can use to cross-compile modules for poor windows users _despite_ sticking to my principles and keeping my integrity as a free software developer.
If this eventually leads to being able to compile Python software for Windows under Wine (using for example, py2exe) it would make my life a lot easier.
You can already do that: just install windows python under wine.
i tried that a few months ago - the builder requires the MS installer, which segfaulted on my installation of wine (i installed it using winetricks) which left me flummoxed because other people report successful use of MSI.
Hm, I could definitely install python - I have python in wine ATM. wine python -c 'import sys; print sys.version' -> 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] IIRC, I could build numpy on it, which is far from a trivial package from a build POV :) I think it crashes on wine, though - which I why I did not pursued it so far. But I believe python itself at least is usable in wine, depending on what you are trying to do. David
anyway, i'm floundering around a bit and making a bit of a mess of the code, looking for where LONG_MAX is messing up.
fixed with this: PyObject * PyInt_FromSsize_t(Py_ssize_t ival) { if ((long)ival >= (long)LONG_MIN && (long)ival <= (long)LONG_MAX) { return PyInt_FromLong((long)ival); } return _PyLong_FromSsize_t(ival); } raised as http://bugs.python.org/issue4880 next bug: distutils.sysconfig.get_config_var('srcdir') is returning None (!!)
next bug: distutils.sysconfig.get_config_var('srcdir') is returning None (!!)
ok ... actually, that's correct. oops. sysconfig.get_config_vars() only returns these, on win32: {'EXE': '.exe', 'exec_prefix': 'Z:\\mnt\\src\\python2.5-2.5.2', 'LIBDEST': 'Z:\\mnt\\src\\python2.5-2.5.2\\Lib', 'prefix': 'Z:\\mnt\\src\\python2.5-2.5.2', 'SO': '.pyd', 'BINLIBDEST': 'Z:\\mnt\\src\\python2.5-2.5.2\\Lib', 'INCLUDEPY': 'Z:\\mnt\\src\\python2.5-2.5.2\\include'} ... aaaand, that means disabling setup.py or hacking it significantly to support a win32 build, e.g. to build pyexpat, detect which modules are left, etc. by examining the remaining vcproj files in PCbuild. .... ok - i'm done for now. the project's not complete, but can be regarded as successful so far. i think the best thing is being able to do "import _winreg" on a linux system. that absolutely tickles me silly :) been running a few tests - test_mmap.py is a hoot, esp. the Try opening a bad file descriptor... that causes a wine segfault. if anyone wants to play with this further, source is here: http://github.com/lkcl/pythonwine/tree/python_2.5.2_wine at some point - if i feel like taking this further, and if people offer some advice and hints on where to go (with e.g. setup.py) i'll continue. then once that's done i'll do python 2.6 as well. l.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Martin v. Löwis wrote:
i'd just ... much rather be completely independent of proprietary software when it comes to building free software.
I guess my question is then: why do you want to use Windows in the first place?
My guess is that Luke wants to cross-compile bdist-win distributions for the benefit of tool-deprived Windows users. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD4DBQFJZogZ+gerLs4ltQ4RAoJoAJjw/vCaCo5yTtErbvhx1pndac/kAJ9ttT+d qtLscKp1Imf2pRFtKE+Wsg== =JqqK -----END PGP SIGNATURE-----
On Thu, Jan 8, 2009 at 9:07 PM, "Martin v. Löwis" <martin@v.loewis.de> wrote:
i'd just ... much rather be completely independent of proprietary software when it comes to building free software.
I guess my question is then: why do you want to use Windows in the first place?
ha ha :) the same question was asked when i started the nt domains reverse-engineering for samba, in 1996. the answer is: i don't. but there are a lot of users and developers who feel that they don't have a choice. or haven't been given one. so if it's possible for me, as one of the "under 1% of computer users i.e. linux" to compile stuff that will work on the "over 95% of computers used by everyone else i.e. windows" _and_ i get to stick to free software principles, that's gotta be good. take pywebkit-gtk as an example. the first-level (and some of the second-level) dependencies for pywebkit-gtk are roughly as follows: * libstdc++ * cairo, pango, gdk, fontconfig, gtk * libxml2 (which is dodgy) * libxslt1 (which is so dodgy and dependent on incompatible versions of libxml2 it can't be compiled on win32) * libicu38 * libcurl * libssl * webkit * python2.5 * python-gobect * python-gtk that's a *big* xxxxing list that comes in at a whopping 40mb of _binaries_. webkit itself comes in at 10mb alone. libicu38 fails _miserably_ to cross-compile with mingw32. i was damn lucky to have beaten it into submission: it took two days and i couldn't run any of the tests, but actually managed to get at least some .libs, .dlls and .a's out of the mess. libxslt1 and libxml2 have compile errors in mutually incompatible versions on win32, plus, unfortunately, the versions that _do_ compile correctly (really old versions like libxslt-1.12 + libxml2-18 or something) are not the ones that can be used on webkit! i had to get the source code for gcc (4.4) because when linking webkit against the MSVC-compiled libicu38 gcc actually segfaulted (!). and that was tracked down to exception handling across process / thread boundaries in libstdc++-6 which had only literally been fixed/patched a few days before i started the monster-compile-process. i tried hunting down python-gobject and python-gtk for win32, but there is a dependency needed before you get to that: python25.lib. as i mentioned previously i tried hunting down a .lib for python25 but of course that would be useless unless i also have a libtool-compiled .a so there wasn't any point. so, all the hard work that i did cross-compiling up webkit for win32 was completely wasted because python itself could not be compiled on linux for a win32 platform. hence my interest in making sure that it can be. _then_ i can go back and revisit the monster compile process and finally come up with the goods, on win32, on the gobject-based DOM-model manipulation stuff i've added to pywebkit-gtk. i've got linux covered, i've got macosx covered. win32 is the last one. l.
aren't you better off just cross compiling under mingw? You don't even really need to do that... you can just dynamically load the brebuilt windows python libraries in your wine apps... wine is for running windows apps on linux, not for cross compiling... wine itself uses the mingw cross compiler when necessary from my understanding. winelib is for creating elf binaries, not windows binaries... -- View this message in context: http://www.nabble.com/compiling-python2.5-on-linux-under-wine-tp21270106p253... Sent from the Python - python-dev mailing list archive at Nabble.com.
participants (6)
-
"Martin v. Löwis"
-
David Cournapeau
-
Luke Kenneth Casson Leighton
-
Simon Cross
-
tinku99
-
Tres Seaver