473,320 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

With pyMinGW

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

Feb 21 '06 #1
3 2610
be************@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

Feb 22 '06 #2
Thank you for your answers, Khalid.
It seems you may be using an old version of pyMinGW,
I have downloaded it yesterday from your site.

the relevant part dealing with include directories in zlib.mak
should read now as follows:
I have checked, and that relevant part is the same in my zlib.mak.

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.
You can probably remove the dead link from your page.
(Maybe I can build a complete package (with Tkinter, minGW and Swig
too), and put it in some official Python site.)

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.


I don't want to use/waste too much of your time, I have succed with the
C++ example, but the C example has given me some problems:

C:\...\PyminGW\Python-2.4.2\MinGW\Extensions\pyExt_C_exmaple>python24
setupMingW.py build --compile
r=mingw32
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
C:\......\bin\gcc.exe -mno-cygwin -mdll -O2 -Wall -s
-IC:\...\PyminGW\Python-2.4
..2\include -IC:\...\PyminGW\Python-2.4.2\PC -c example_wrap.c -o
build\temp.win32-2.4\Release\examp
le_wrap.o
example_wrap.c: In function `PySwigClientData_New':
example_wrap.c:1205: warning: dereferencing type-punned pointer will
break strict-aliasing rules
example_wrap.c: In function `PySwigObject_own':
example_wrap.c:1456: warning: dereferencing type-punned pointer will
break strict-aliasing rules
example_wrap.c:1456: warning: dereferencing type-punned pointer will
break strict-aliasing rules
example_wrap.c: In function `My_variable_set':
example_wrap.c:2515: error: `My_variable' undeclared (first use in this
function)

Bye,
bearophile

Feb 22 '06 #3
be************@lycos.com wrote:
Thank you for your answers, Khalid.
It seems you may be using an old version of pyMinGW,


I have downloaded it yesterday from your site.

the relevant part dealing with include directories in zlib.mak
should read now as follows:


I have checked, and that relevant part is the same in my zlib.mak.

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.


You can probably remove the dead link from your page.
(Maybe I can build a complete package (with Tkinter, minGW and Swig
too), and put it in some official Python site.)

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.


I don't want to use/waste too much of your time, I have succed with the
C++ example, but the C example has given me some problems:

C:\...\PyminGW\Python-2.4.2\MinGW\Extensions\pyExt_C_exmaple>python24
setupMingW.py build --compile
r=mingw32
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
C:\......\bin\gcc.exe -mno-cygwin -mdll -O2 -Wall -s
-IC:\...\PyminGW\Python-2.4
.2\include -IC:\...\PyminGW\Python-2.4.2\PC -c example_wrap.c -o
build\temp.win32-2.4\Release\examp
le_wrap.o
example_wrap.c: In function `PySwigClientData_New':
example_wrap.c:1205: warning: dereferencing type-punned pointer will
break strict-aliasing rules
example_wrap.c: In function `PySwigObject_own':
example_wrap.c:1456: warning: dereferencing type-punned pointer will
break strict-aliasing rules
example_wrap.c:1456: warning: dereferencing type-punned pointer will
break strict-aliasing rules
example_wrap.c: In function `My_variable_set':
example_wrap.c:2515: error: `My_variable' undeclared (first use in this
function)

Bye,
bearophile

You are using the C example extension found in pyMinGW, right? It
builds fine here, of course using the "python setup.py build" command.

$ python setupMinGW.py build
running build
running build_ext
building '_example' extension
swigging example.i to example_wrap.c
d:\MISC\PROGRAMS\SWIG-1.3.21\swig.exe -python -o example_wrap.c
example.i
creating build
creating build\temp.win32-2.4
creating build\temp.win32-2.4\Release
e:\UTILIT~1\PROGRA~1\MINGW\BIN\gcc.exe -mno-cygwin -mdll -O2 -Wall -s
-IG:\PROJS\PY24\PYTHON\DIST\SRC\include
-IG:\PROJS\PY24\PYTHON\DIST\SRC\PC -c example_wrap.c -o
build\temp.win32-2.4\Release\example_wrap.o
example_wrap.c:187: warning: 'SWIG_Python_TypeDynamicCast' defined but
not used
example_wrap.c:199: warning: 'SWIG_Python_TypeName' defined but not
used
example_wrap.c:205: warning: 'SWIG_Python_TypeQuery' defined but not
used
example_wrap.c:551: warning: 'SWIG_Python_MustGetPtr' defined but not
used
example_wrap.c:559: warning: 'SWIG_Python_ConvertPacked' defined but
not used
e:\UTILIT~1\PROGRA~1\MINGW\BIN\gcc.exe -mno-cygwin -mdll -O2 -Wall -s
-IG:\PROJS\PY24\PYTHON\DIST\SRC\include
-IG:\PROJS\PY24\PYTHON\DIST\SRC\PC -c example.c -o
build\temp.win32-2.4\Release\example.o
writing build\temp.win32-2.4\Release\_example.def
creating build\lib.win32-2.4
e:\UTILIT~1\PROGRA~1\MINGW\BIN\gcc.exe -mno-cygwin -shared -s
build\temp.win32-2.4\Release\example_wrap.o
build\temp.win32-2.4\Release\example.o
build\temp.win32-2.4\Release\_example.def
-LG:\PROJS\PY24\PYTHON\DIST\SRC\libs
-LG:\PROJS\PY24\PYTHON\DIST\SRC\PCBuild -lpython24 -o
build\lib.win32-2.4\_example.pyd

And copying that _example.pyd from the build directory just created to
our current directory so that python can see it, we can load that
extension fine as well:

$ python -i
Python 2.4.2 (#67, Nov 8 2005, 10:12:11)
[GCC 3.4.2 (mingw-special)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import example as ex
dir(ex) ['__builtins__', '__doc__', '__file__', '__name__', '_example',
'_newclass', '_object', '_swig_getattr', '_swig_setattr', 'cvar',
'fact', 'fib', 'get_time', 'hello', 'my_mod'] ex.hello() 'Hi there!' ex.fact(4) 24

Regards,
Khalid

Feb 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
0
by: FreeStyle | last post by:
Hi everybody, I'm using phpMyAdmin 2.2.6 with EasyPHP v.1.6.0.0 I wrote a php script which uses a username (added in the mysql base with phpMyAdmin). This user has no privileges. But in the...
3
by: Marcus | last post by:
I'm really confused with something I never had any problems with before... I have a form with a textbox called password. On the second page that $password is posted to, if I test isset($password)...
2
by: fartsniff | last post by:
hello all, here is a preg_match routine that i am using. basically, $image is set in some code above, and it can be either st-1.gif or sb-1.gif (actually it randomly picks them from about 100...
2
by: Fredrik Jonson | last post by:
Hello, I'm writing a newsletter poster for a website. I have some html news items which I want to turn into plain text and prettify before emailing it. Now, i have found wordwrap and...
0
by: Aldo Polli | last post by:
Hi, I have this error when I start apache2 with php4 Syntax error on line 233 of /mypath/apache2/conf/httpd.conf: Cannot load /mypath/apache2/modules/libphp4.so into server: dynamic linker:...
4
by: A. B., Khalid | last post by:
Hello all. This is to inform those interested in getting Python to compile in MinGW that the pyMinGW patch is now able to help compile both Python 2.3.4 Final and Python 2.4a3 and the resulting...
1
by: vincent delft | last post by:
I've a module written in C and the associated setup.py. Work fine (and compile fine with mvc) with Python 2.3.x Now I've installed Python 2.4 (all the rest unchanged) When I try to compile it,...
2
by: mrstephengross | last post by:
Ok, I know there are already a million posts on this group about getting Python to build with MinGW. I've been through many of them, and have still not found a good comprehensive way to accomplish...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.