Compiling Python with MinGW

Jason Harper JasonHarper at pobox.com
Thu Mar 20 13:38:23 EST 2003


Has anybody had any luck compiling Python 2.3 (NOT just Python
extensions) for Windows 2000 using MinGW or other free compilers?  I
want to try something that involves modifications to the core, and don't
particularly want to pay Microsoft for the privilege...

Just using MinGW and MSYS, and following the Unix build instructions,
gets further than I expected.  Everything compiles successfully with
only two exceptions, one of them minor: graminit.h and graminit.c were
saved as read-only files by WinCVS, so the parser generator couldn't
overwrite them.

The other problem is a biggie: compiling posixmodule.c produces warnings
or errors for apparently EVERY system function call, it's obviously
taking all the Unix-specific branches in the code rather than
Windows-specific.  Recompiling with -DMS_WINDOWS and various other
defines doesn't seem to help, it just changes the error messages to
various Windows types and functions that aren't found (things that I
though MinGW was supposed to define).  I really have no idea how to
proceed from here.

Just for fun, I tried disabling the posix module and continuing with the
make.  I was able to get a python.exe that is runnable, but not usable -
it is unable to find any libraries, and suggests setting $PYTHONHOME to
fix this (but setting that variable has no effect that I can see). 
sys.prefix and sys.path contain bizarre values with a mixture of forward
and backward slashes: the values that look at all like valid pathnames
point into the MSYS installation, not anywhere near the Python source
tree I was working from.  I was able to do successful imports after
manually setting sys.path, but of course couldn't do much with no os
module available.
	Jason Harper




More information about the Python-list mailing list