[Distutils] Compiling Python C++ extensions with MingW

M.-A. Lemburg mal@lemburg.com
Wed Dec 11 13:27:09 2002


Andrew Gregory wrote:
> I posted details of a problems on the google Python user group - someone
> emailed to say that I should send this to the distutils-sig. mailing
> list.
> 
> It concerns compiling a very simple C++ extension (as a test) on Mingw
> 2.0.0 for use with MSVC-compiled Python. Using linker option
> --enable-cxx did not help.
> 
> http://groups.google.co.uk/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=2830c89
> c.0212101559.6ea63560%40posting.google.com&prev=/groups%3Fhl%3Den%26lr%3
> D%26ie%3DUTF-8%26group%3Dcomp.lang.python
> 
> The output is shown below. The SWIG warnings seem to be normal - but it
> failed at the dllwrap stage.
> 
> Andrew Gregory.
> 
> 
> C:\PyFiles\exMingw\MyCPP>python setup.py build --compiler=mingw32
> running build
> running build_ext
> building '_pysimple' extension
> creating build
> creating build\temp.win32-2.2
> creating build\temp.win32-2.2\Release
> C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python22\include -c
> pysimple_wrap.cxx -o build\temp.win32-2.2\Relea
> se\pysimple_wrap.o
> pysimple_wrap.cxx:180: warning: `swig_type_info*
>    SWIG_TypeDynamicCast(swig_type_info*, void**)' defined but not used
> pysimple_wrap.cxx:192: warning: `swig_type_info* SWIG_TypeQuery(const
> char*)'
>    defined but not used
> pysimple_wrap.cxx:374: warning: `void SWIG_addvarlink(PyObject*, char*,
>    PyObject*(*)(), int (*)(PyObject*))' defined but not used
> pysimple_wrap.cxx:427: warning: `int SWIG_ConvertPtr(PyObject*, void**,
>    swig_type_info*, int)' defined but not used
> pysimple_wrap.cxx:519: warning: `int SWIG_ConvertPacked(PyObject*,
> void*, int,
>    swig_type_info*, int)' defined but not used
> writing build\temp.win32-2.2\Release\_pysimple.def
> creating build\lib.win32-2.2
> C:\MinGW\bin\dllwrap.exe -mno-cygwin -mdll -static --entry _DllMain@12
> --output-lib build\temp.win32-2.2\Release\lib_pys
> imple.a --def build\temp.win32-2.2\Release\_pysimple.def -s
> build\temp.win32-2.2\Release\pysimple_wrap.o -LC:\Python22\l
> ibs -lpython22 -o build\lib.win32-2.2\_pysimple.pyd
> build\temp.win32-2.2\Release\pysimple_wrap.o(.eh_frame+0x11):pysimple_wr
> ap.cxx: undefined reference to `__gxx_personalit
> y_v0'
> dllwrap: gcc exited with status 1
> error: command 'dllwrap' failed with exit status 1

Looks like some lib is missing. Hard to tell which without
a working MinGW installed :-)

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/