[C++-sig] [Py++] wrapping boost python types fails

Werner Joergensen wjoergensen at yahoo.com
Sat May 30 22:53:07 CEST 2009

I narrowed down a failure with pyplusplus to this short example:

---------8<---- test.hpp -----
#include "boost/python.hpp"

---------8<---- generator.py -----
import os
from pyplusplus import module_builder
mb = module_builder.module_builder_t(

mb.build_code_creator( module_name='testmodule' )
mb.code_creator.user_defined_directories.append( os.path.abspath('.') )
mb.write_module( os.path.join( os.path.abspath('.'), 'generated.cpp' ) )

Running "python generator.py" gives these errors:
---------8<---- output -----
pygccxml.parser.source_reader.gccxml_runtime_error_t: Error occured while running GCC-XML: In file included from /usr/local/include/boost-1_39/boost/python.hpp:60,
                 from test.hpp:1:
/usr/local/include/boost-1_39/boost/type.hpp:14: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

I need to use the python objects like list, str, tuple in my python extension modules. So can you help me to get the example running? I tried it on two different systems, one with gcc 4.2.4 and one with gcc 4.3.3. Other relevant packages are: gccxml 0.9 (cvs from 2008-05-30), boost 1.39.0, pygccxml 1.0, pyplusplus 1.0. Can you tell me which combination of these packages can compile the short example?



More information about the Cplusplus-sig mailing list