notes on compilation Python with MinGW gcc
Ames Andreas (MPA/DF)
Andreas.Ames at tenovis.com
Mon Dec 1 21:33:47 CET 2003
usenet at xmlhack.ru (Oleg A. Paraschenko) writes:
> recently I compiled Python with MinGW gcc under Windows.
> If there are some interest, you can look at log of process at
> In short, about compiling with MinGW gcc:
> * it is possible;
> * result works;
> * you must not do it unless you know for sure that you must do it;
> * you must have a good knowledge of C and of debugging;
> * in most cases all you need is to compile an extension module.
I've recently taken a slitely different way to accomplish a native
mingw32 build. You can get a patch from
As I haven't used msys yet and my real goal was to build a
mingw32-python on linux (without the adventures of installing VC6
under wine, which reportedly works either). Thus it had to be a
crosscompile, but you should be able to use cygwin (but you must edit
xbuild-py.sh to do so and you must --build and --host on cygwin too,
I've started the crossbuild on cygwin).
The build still has quite a few 'rough edges' ;-):
1) The resource files (*.rc) are not yet compiled/linked in. Given
that they are rather simple I wouldn't expect significant
difficulties using windres. There would need to happen some
changes to Makefile.pre.in though.
2) pythonw.exe is not yet built. Similar changes as above needed.
3) I couldn't yet convince scons that it would be a good idea to have
a build directory seperate from the source tree. I have tried both
the BuildDir function and the build_dir parameter to the
SConscrript function but to no avail. It could either be a bug in
scons or my own inability. As this was my first scons-script, I
guess it's the latter. Some scons knowledgeable person might be
able to fix this within seconds.
Before you get a useful environment you must copy the Lib/
subdirectory from source- to the buildtree as well as all the *.pyd
files from <source>/Modules and <source>/PC to <build>/DLLs or
something. Note that running the testcases from a samba-share isn't
good because the tests use filenames with an '@' sign which samba
doesn't seem to like. You might be better off copying the complete
buildtree to a native windows partition (if you build from linux
The patch applies to 2.3.2 because I have no easy way to access the
cvs repository. If there was interest in a native mingw32-python I
would like to help to solve the above issues (and others I haven't
found yet). But it doesn't appear that there is much interest in
this, so I'd guess you can take the above as a toy project.
More information about the Python-list