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/pytho...
'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* (*)())
which appears to match the following function in
python/converter/registry.hpp:
// Insert an rvalue from_python converter
BOOST_PYTHON_DECL void insert(
convertible_function
, constructor_function
, type_info
, PyTypeObject const* (*expected_pytype)() = 0
);
Beyond that I'm pretty much stuck. Thanks in advance to anyone who can help
me out!
antony
/*------------------- hello.cpp -------------------*/
#include <string>
struct World
{
void set(std::string msg) { this->msg = msg; }
std::string greet() { return msg; }
std::string msg;
};
#include
antonyc
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
on Tue Aug 19 2008, antonyc
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/pytho... '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, -- Dave Abrahams BoostPro Computing http://www.boostpro.com
participants (4)
-
Antony Carysforth
-
antonyc
-
David Abrahams
-
Markus Werle