Re: compiling python2.5 on linux under wine

2009-01-08 Thread lkcl
  ... 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

2009-01-08 Thread lkcl
  ... 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: compiling python2.5 on linux under wine

2009-01-07 Thread Luke Kenneth Casson Leighton
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