Discussion:
[C++-sig] undefined symbol: _ZTIN5boost6python15instance_holderE
David Aldrich
2015-05-19 08:44:08 UTC
Permalink
Hi

I have an application that uses Boost Python. It links and runs fine on Centos 5 systems but fails on an Ubuntu 14.04 LTS system.

The code that uses Boost Python is compiled using:

g++ -c -Wall -m64 -DPYTHON_ENABLE -I../Kernel -I/usr/include/python2.7 -I/usr/include/ -O3 main.cpp -o _gnuRelease/main.o

and linked into a static library using:


g++ -o _gnuRelease/mylib -Wl,-whole-archive,-export-dynamic ../Kernel/_gnuRelease/libKernel.a -L/usr/lib/x86_64-linux-gnu -lboost_python-py27 -lpython2.7 -Wl,--no-whole-archive -ldl

When the library is linked to my main program and run I see error:


undefined symbol: _ZTIN5boost6python15instance_holderE ( typeinfo for boost::python::instance_holder )

Please can someone suggest how to fix this?

Best regards

David
Mario Lang
2015-05-19 12:54:15 UTC
Permalink
Post by David Aldrich
I have an application that uses Boost Python. It links and runs fine on Centos 5 systems but fails on an Ubuntu 14.04 LTS system.
g++ -c -Wall -m64 -DPYTHON_ENABLE -I../Kernel -I/usr/include/python2.7 -I/usr/include/ -O3 main.cpp -o _gnuRelease/main.o
g++ -o _gnuRelease/mylib -Wl,-whole-archive,-export-dynamic ../Kernel/_gnuRelease/libKernel.a -L/usr/lib/x86_64-linux-gnu -lboost_python-py27 -lpython2.7 -Wl,--no-whole-archive -ldl
undefined symbol: _ZTIN5boost6python15instance_holderE ( typeinfo for boost::python::instance_holder )
Please can someone suggest how to fix this?
Does your main program link with boost_python?
You didn't paste the link command of main, which would have been helpful
here.

Also, if you link with boost_python, does it match the Python version in
use (2 vs 3)?
--
CYa,
⡍⠁⠗⠊⠕
David Aldrich
2015-05-20 08:09:03 UTC
Permalink
Hi

Thanks for your reply.
Post by Mario Lang
Does your main program link with boost_python?
You didn't paste the link command of main, which would have been helpful
here.
I'm sorry, while sanitizing the command for posting here, I obscured some meaning. The way the link process works is that the library includes a main(), we build the library with ar and then link it to form the executable:

ar: creating _gnuRelease/libKernel.a
g++ -o _gnuRelease/MyExecutable -Wl,-whole-archive,-export-dynamic ../Kernel/_gnuRelease/libKernel.a -L/usr/lib/x86_64-linux-gnu -lboost_python-py27 -lpython2.7 -Wl,--no-whole-archive -ldl
Post by Mario Lang
Also, if you link with boost_python, does it match the Python version in use
(2 vs 3)?
How would I check this please?

Best regards

David

Loading...