antonyc | 19 Aug 19:25

boost.python - undefined symbol error


I've just started this morning with boost::python and have been struggling
all day to get the basic 
http://www.boost.org/doc/libs/1_35_0/libs/python/doc/tutorial/doc/html/python/exposing.html
'exposing classes' doc/tutorial:  to link correctly under gcc  4.1.2.  I
would greatly appreciate any help as I'm sure it's probably something simple
and I'm pretty much at a loss at the moment.

So the source file  compiles and the shared object appears to link ok
however when I try and import the module, python reports the following
missing symbol:

ImportError: /test/BoostPython/hello.so: undefined symbol:
_ZN5boost6python9converter8registry6insertEPFPvP7_objectEPFvS5_PNS1_30rvalue_from_python_stage1_dataEENS0_9type_infoE

de-mangled courtesy of c++filt:

boost::python::converter::registry::insert(void* (*)(_object*), void
(*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*),
boost::python::type_info)

Indeed a search through the boost.python headers yields no such function
prototype. Nor does searching the symbols defined in
libboost_python-gcc41-mt.so.
The closest match I can find in libboost_python-gcc41-mt.so is:

boost::python::converter::registry::insert(void* (*)(_object*), void
(*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*),
boost::python::type_info, _typeobject const* (*)())

(Continue reading)

Markus Werle | 20 Aug 09:26

Re: boost.python - undefined symbol error

antonyc <ac <at> redvision.co.uk> writes:

> g++ -c -g -Wall -fPIC -pipe -DBOOST_PYTHON_MAX_ARITY=20 -I. 
> -I/usr/local/include -I/usr/local/include/python2.5 hello.cpp
> g++ -shared -o hello.so hello.o -L/usr/local/lib -lpython2.5
> -lboost_python-gcc41-mt

What happens if you remove the "-g" option?

Markus
Antony Carysforth | 20 Aug 10:04

Re: boost.python - undefined symbol error


Removing the -g option doesn't make any difference - still get the 
missing symbol. Thanks for the suggestion though.

antony

Markus Werle wrote:
>
> What happens if you remove the "-g" option?
>
> Markus
>
>   
David Abrahams | 22 Aug 03:03
Favicon
Gravatar

Re: boost.python - undefined symbol error


on Tue Aug 19 2008, antonyc <ac-AT-redvision.co.uk> wrote:

> I've just started this morning with boost::python and have been struggling
> all day to get the basic 
> http://www.boost.org/doc/libs/1_35_0/libs/python/doc/tutorial/doc/html/python/exposing.html
> 'exposing classes' doc/tutorial:  to link correctly under gcc  4.1.2.  I
> would greatly appreciate any help as I'm sure it's probably something simple
> and I'm pretty much at a loss at the moment.
>
> So the source file  compiles and the shared object appears to link ok
> however when I try and import the module, python reports the following
> missing symbol:
>
> ImportError: /test/BoostPython/hello.so: undefined symbol:
> _ZN5boost6python9converter8registry6insertEPFPvP7_objectEPFvS5_PNS1_30rvalue_from_python_stage1_dataEENS0_9type_infoE
>
> de-mangled courtesy of c++filt:
>
> boost::python::converter::registry::insert(void* (*)(_object*), void
> (*)(_object*, boost::python::converter::rvalue_from_python_stage1_data*),
> boost::python::type_info)

It looks like the Boost.Python headers you are compiling against are
from an older version of the library than the binary you are linking
against.

HTH,

--

-- 
(Continue reading)


Gmane