Re: [Python-Dev] compiling python2.5 on linux under wine
On Thu, Jan 8, 2009 at 9:07 PM, Martin v. Löwis mar...@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* ing 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. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] compiling python2.5 on linux under wine
On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton l...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] compiling python2.5 on linux under wine
On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross hodgestar+python...@gmail.com wrote: On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton l...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] compiling python2.5 on linux under wine
On Thu, Jan 8, 2009 at 12:42 PM, Simon Cross hodgestar+python...@gmail.com wrote: On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton l...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] compiling python2.5 on linux under wine
On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau courn...@gmail.com wrote: On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross hodgestar+python...@gmail.com wrote: On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton l...@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 :) -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] compiling python2.5 on linux under wine
On Thu, Jan 8, 2009 at 11:02 PM, Luke Kenneth Casson Leighton l...@lkcl.net wrote: On Thu, Jan 8, 2009 at 1:11 PM, David Cournapeau courn...@gmail.com wrote: On Thu, Jan 8, 2009 at 9:42 PM, Simon Cross hodgestar+python...@gmail.com wrote: On Sat, Jan 3, 2009 at 11:22 PM, Luke Kenneth Casson Leighton l...@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 -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] compiling python2.5 on linux under wine
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 (!!) -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] compiling python2.5 on linux under wine
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'} ... nd, 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. -- http://mail.python.org/mailman/listinfo/python-list
Re: compiling python2.5 on linux under wine
... nd, 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. if anyone wants to play with this further, source is here: http://github.com/lkcl/pythonwine/tree/python_2.5.2_wine patch is also here: http://bugs.python.org/issue4880 -- http://mail.python.org/mailman/listinfo/python-list
Re: compiling python2.5 on linux under wine
... nd, 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 started the hacking. the first bit of hacking is this, in distutils/sysconfig.py, added to _init_nt() try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = invalid Python installation: unable to open %s % filename if hasattr(msg, strerror): my_msg = my_msg + (%s) % msg.strerror raise DistutilsPlatformError(my_msg) # load the installed pyconfig.h: try: prefix = EXEC_PREFIX prefix = os.path.join(prefix, PC) filename = os.path.join(prefix, pyconfig.h) parse_config_h(file(filename), g) except IOError, msg: my_msg = invalid Python installation: unable to open %s % filename if hasattr(msg, strerror): my_msg = my_msg + (%s) % msg.strerror raise DistutilsPlatformError(my_msg) global _config_vars _config_vars = g that gets me part-way - at least i get... oh dear : self.build_extensions() File ../setup.py, line 183, in build_extensions self.compiler.set_executables(**args) File Z:\mnt\src\python2.5-2.5.2\lib\distutils\ccompiler.py, line 165, in set_executables (key, self.__class__.__name__) ValueError: unknown executable 'compiler_so' for class MSVCCompiler whoops :) so, next, we hack in a compiler, in to ... ooo, let's saaay... distutils/cygwinccompiler.py, just for fun. now we get this! winegcc -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall - Wstrict-prototypes -I. -IZ:\mnt\src\python2.5-2.5.2\./Include -I. - IInclude -I../Include -I/usr/local/include -IZ:\mnt\src \python2.5-2.5.2\include -IZ:\mnt\src\python2.5-2.5.2\PC -c Z:\mnt\src \python2.5-2.5.2\Modules\_ctypes/_ctypes_test.c -o z:\mnt\src \python2.5-2.5.2\modules\_ctypes\_ctypes_test.o wha-hey! but... oh dear. oh dear number 1) firstly, err this is cross-compiling - those path names are bullshit because actually we're compiling on LINUX damnit, not windows. hmm there's something to work around that one, perhaps, by installing the mingw32 compiler under wine (o god i've done that before, it's dreadfully slow) oh dear number 2) File Z:\mnt\src\python2.5-2.5.2\lib\os.py, line 562, in spawnv return _spawnvef(mode, file, args, None, execv) File Z:\mnt\src\python2.5-2.5.2\lib\os.py, line 545, in _spawnvef wpid, sts = waitpid(pid, 0) NameError: global name 'waitpid' is not defined err oh - ok, found another missing function: spawnv. so, added that, in PC/pcbuild.h: #ifdef __WINE__ #define HAVE_SPAWNV #endif and after some futzing around with yet more #ifdefs in posixmodule.c we have another build - this time using wine's spawnv so it doesn't try to find a non-existent waitpid aaannnd SPLAT yesss, we get the crash-output from winegcc: Failed to configure _ctypes module building '_ctypes_test' extension winegcc -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall - Wstrict-prototypes -I. -IZ:\mnt\src\python2.5-2.5.2\./Include -I. - IInclude -I../Include -I/usr/local/include -IZ:\mnt\src \python2.5-2.5.2\include -IZ:\mnt\src\python2.5-2.5.2\PC -c Z:\mnt\src \python2.5-2.5.2\Modules\_ctypes/_ctypes_test.c -o z:\mnt\src \python2.5-2.5.2\modules\_ctypes\_ctypes_test.o wine: Unhandled page fault on read access to 0x7265704f at address 0x601ec25b (thread 001c), starting debugger... Unhandled exception: page fault on read access to 0x7265704f in 32-bit code (0x601ec25b). Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b EIP:601ec25b ESP:0032c70c EBP:0032c718 EFLAGS:00010206( - 00 - RIP1) EAX:7265704f EBX:7bc8a7a4 ECX:0003 EDX:604ab3d7 ESI:0032c848 EDI:7265704f Stack dump: 0x0032c70c: 7bc6859d 7265704f 6056a0b8 0032c788 0x0032c71c: 603fd0eb 7265704f 006e9544 001bc84c 0x0032c72c: 006c574c 6056b82c 605721a0 0002 0x0032c73c: 0032c7d8 718e21fe 0016329c 7265704f 0x0032c74c: 00730065 002e0074 006f 00159320 0x0032c75c: 603aa590 001b3f0c 005086e0 0004 Backtrace: =1 0x601ec25b strlen+0xb() in libc.so.6 (0x0032c718) fixme:dbghelp_dwarf:dwarf2_parse_variable Unsupported form for const value degToRad (a) 2 0x603fd0eb do_mkvalue+0x3db(p_format=register ESI not in topmost frame, p_va=is not available, flags=0x0) [/mnt/src/python2.5-2.5.2/ build/../Python/modsupport.c:419] in python (0x0032c788) 3 0x603fcc6d do_mktuple+0x7d(p_format=0x32c848, p_va=0x32c844, endchar=0x29, n=0x2, flags=0x0) [/mnt/src/python2.5-2.5.2/build/../ Python/modsupport.c:268] in python (0x0032c7b8) . . hey, this is fun! let's try a crazed compile of python and see what falls over, whe :) ... much as this seems to be consuming much of my time, for some bizarre reason i just can't seem to stop. anyway - yes, this is effectively cross-compiling, and so
Re: [Python-Dev] compiling python2.5 on linux under wine
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? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: compiling python2.5 on linux under wine
On Sat, Jan 3, 2009 at 9:22 PM, Luke Kenneth Casson Leighton l...@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... :) l...@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 -- http://mail.python.org/mailman/listinfo/python-list
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. -- http://mail.python.org/mailman/listinfo/python-list