[Distutils] Compiling Python C++ extensions with MingW

Norman Vine Norman Vine" <nhv@cape.com
Wed Dec 11 14:02:02 2002


M.-A. Lemburg wrote
>

> 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:\MinGW\bin\dllwrap.exe -mno-cygwin -mdll -static --entry _DllMain@12
> > --output-lib build\temp.win32-2.2\Release\lib_pysimple.a 
>> --def build\temp.win32-2.2\Release\_pysimple.def -s
> > build\temp.win32-2.2\Release\pysimple_wrap.o 
>> -LC:\Python22\libs -lpython22 -o build\lib.win32-2.2\_pysimple.pyd
> > build\temp.win32-2.2\Release\pysimple_wrap.o(.eh_frame+0x11):
>> pysimple_wrap.cxx: undefined reference to `__gxx_personality_v0'
 
> Looks like some lib is missing. Hard to tell which without
> a working MinGW installed :-)

try adding -lsupc++ to the linked with libs

if that doesn't work try -lstdc++

HTH

Norman