[Distutils] setup.py demo.C build (gcc vs. g++) (distutils)

Mowry, Peter peter.mowry at amd.com
Wed May 16 01:11:36 CEST 2007

Ever seen this error?  


Build Error Description:

python2.5 setup.py demo.C build


That creates a demo.so, and when I try to import it, it gives me the

ImportError: ./demo.so: undefined symbol: __gxx_personality_v0



Hack to fix it:

I found one single helpful post about this on google:

l suggests:

Do the link step of gdalwarp manually by copying the commandline printed
by setup.py and replacing the gcc with g++


So I tried this, and I saw that setup.py prints the following 2

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wstrict-prototypes
-fpermissive -fPIC
-I/tool/pandora64/.package/python-2.5/include/python2.5 -c demo.C -o

gcc -pthread -shared build/temp.linux-x86_64-2.5/demo.o -o


Then I simply manually rerun just the second command with g++:

g++ -pthread -shared build/temp.linux-x86_64-2.5/demo.o -o


And now the import works and so does the python spam_system() function.



Non-Hack to fix it?:

Is there a non-hack way to fix this?


I've seen this question on the internet but no answers so far.  I did
check --help-compiler, and it only lists --compiler=unix, not
--compiler=g++ for ex.






Peter Mowry ("Pem")
SimNow Team, Software Engineer
AMD Organization



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/distutils-sig/attachments/20070515/63254319/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 73 bytes
Desc: image001.gif
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20070515/63254319/attachment.gif 

More information about the Distutils-SIG mailing list