[Distutils] trouble building C extensions with mingw

mike cantor mcantor at stanford.edu
Tue Dec 6 00:49:44 CET 2005


I am having difficulty getting disutils to build C extensions using the 
mingw compiler.



After installing mingw (file: MinGW-4.1.0.exe) I followed the instructions 
described in http://sebsauvage.net/python/mingw.html, using pexports and 
dlltool as instructed and placing libpython23.a the python installation 
directory.  As was noted in this page, disutils did not have to be tweaked.

I then copied example.c and example.i and setup.py to the same folder and 
from within that directory in a dos prompt ran "python setup.py build 
-cmingw32 "

The result was the following compiler errors:

E:\RESEARCH\Modeling\PythonFiles\SWIG test>python setup.py build -c mingw32
running build
running build_ext
building 'example' extension
swigging example.i to example_wrap.c
E:\swigwin-1.3.27\swig.exe -python -o example_wrap.c example.i
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IE:\Python23\include 
-IE:\Pytho
n23\PC -c example_wrap.c -o build\temp.win32-2.3\Release\example_wrap.o
example_wrap.c: In function `_wrap_My_variable_set':
example_wrap.c:1621: error: `My_variable' undeclared (first use in this 
function
)
example_wrap.c:1621: error: (Each undeclared identifier is reported only once
example_wrap.c:1621: error: for each function it appears in.)
example_wrap.c: In function `_wrap_My_variable_get':
example_wrap.c:1631: error: `My_variable' undeclared (first use in this 
function
)
example_wrap.c: In function `_wrap_fact':
example_wrap.c:1648: warning: implicit declaration of function `fact'
example_wrap.c: In function `_wrap_my_mod':
example_wrap.c:1676: warning: implicit declaration of function `my_mod'
example_wrap.c: In function `_wrap_get_time':
example_wrap.c:1692: warning: implicit declaration of function `get_time'
error: command 'gcc' failed with exit status 1

Can anyone tell me where to go from here?  I have been trying to get this 
to work for three days now...

Thanks,
-mike




More information about the Distutils-SIG mailing list