With pyMinGW

A.B., Khalid abkhd at earth.co.jp
Wed Feb 22 07:00:45 EST 2006


bearophileHUGS at lycos.com wrote:
> To use Pyrex, SWIG and the like on a Win2K I have followed this way:
>
> http://jove.prohosting.com/iwave/ipython/pyMinGW.html
>
> I already had MinGW 3.4.2, so I have decompressed the Python 2.4.2
> sources, I have merged in the pyMinGW patch, and I have run the global
> compilation with:
>
> make -f python24.mak all
>
> It has compiled most things, but not zlibmodule.c
> It has stopped the compilation with:
>
> c:\......\bin\dllwrap.exe: no export definition file provided.
> Creating one, but that may not be what you want
> make[1]: Leaving directory `/.../PyminGW/Python-2.4.2/MinGW'
> make -f zlib.mak
> make[1]: Entering directory `/.../PyminGW/Python-2.4.2/MinGW'
> gcc.exe -c ../Modules/zlibmodule.c -o ../Modules/zlibmodule.o
> -I"../Include" -I"../Pc" -I"../../../d
> ist/zlib-1.2.3"  -Wall -s -DNDEBUG -D_USRDLL -O2
> ../Modules/zlibmodule.c:8:18: zlib.h: No such file or directory
> ../Modules/zlibmodule.c:66: error: syntax error before "z_stream"
>
> ... etc etc.
>
> Anyway, probably 98% was compiled and this Python works, I have tried
> the standard tests and most of them pass.
> Then I have downloaded the pyMinGW Extensions V. 0.0.6.6, so zip and
> other things now work.
>
> The link to the Tcl-Tkinter extension doesn't work (the free site
> hosting the file doesn't accept this file format anymore), so I cannot
> use Tkinter.
>
> I have decompressed SWIG and put it in a temporary Path.
>
> I have then tried a basic SWIG example, (called example) coming from
> this obsolete but probably still interesting page:
> http://sebsauvage.net/python/mingw.html
>
> But I have had problems durign the module creation:
>
> C:\...\PyminGW\Python-2.4.2\MinGW>python setup.py build -cmingw32
> running build
> running build_ext
> building 'example' extension
> swigging example.i to example_wrap.c
> C:\...\PyminGW\swigwin-1.3.28\swig.exe -python -o example_wrap.c
> example.i
> creating build
> creating build\temp.win32-2.4
> creating build\temp.win32-2.4\Release
> C:\......\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\python24\include
> -Ic:\pytho
> n24\PC -c example_wrap.c -o build\temp.win32-2.4\Release\example_wrap.o
> example_wrap.c: In function `My_variable_set':
> example_wrap.c:2550: error: `My_variable' undeclared (first use in this
> function)
>
> ... ecc.
>
>
> So I have had 3 problems, maybe some of you can suggest me how to solve
> some of them.
>
> (Can the standard Python site accept to distribuite an installer with
> MinGW-compiled Python + minGW + SWIG for people using Windows that want
> such system prebuilt? Maybe me or another person can assemble it).
>
> Thank you,
> bearophile


It seems you may be using an old version of pyMinGW, because in the one
I have the directory issue of zlib was fixed and the relevant part
dealing with include directories in zlib.mak should read now as
follows:

LIBS =  -L. -lpython24 -L"../../../dist/zlib-1.2.3" -lz
--image-base,0x1e1B0000
INCS =  -I"../Include" -I"../Pc" -I"../../../dist/zlib-1.2.3"
CXXINCS =  -I"../Include"  -I"../Pc" -I"../../../dist/zlib-1.2.3"

The idea is to make INCS point at the location of your zlib sources.

As to the Tkinter-Tcl point, then please remember that this was a
binary build extension distribution that had nothing to do with the
core Python that pyMinGW is supposed to address. And if you download
the extension sources then you can certainly build the libraries
yourself, and then the python extensions, especially since you have
make files ready to use for the later in the pyMinGW sources. The
binary distribution was meant to make things a bit easier for people,
but since the site stopped the hosting of zip files and since many
people do not download that particular file anyway when it was hosted
elsewhere, letting the file expire (inactive files are removed after
one week from last download), then I hope you'd agree it would be much
work for me to keep track of expired and unexpired files and so keep on
uploading the files.

As to your SWIG problem, then I suggest you look into the pyMinGW's
extensions' directory. There you will find two examples of building C
and CPP extensions using SWIG and MinGW.

Regards,
Khalid



pyMinGW:
http://jove.prohosting.com/iwave/ipython/pyMinGW.html




More information about the Python-list mailing list