[Distutils] Compiling Python C++ extensions with MingW

Andrew Gregory Andrew.Gregory@npl.co.uk
Wed Dec 11 08:57:13 2002


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


-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW.
-------------------------------------------------------------------