Error linking static library: libboost_thread.so: error adding symbols

asked 2018-05-17 03:45:00 -0500

mherrmann gravatar image

Hello I have a problem with a static library I want to use. The library is called libSensor.a and is built by a cmake project using cmake 3.11 and linking to boost 1.67, I can't change these dependencies. I placed the following files to catkin_ws/src/mec_transmission/include/Sensor.h catkin_ws/src/mec_transmission/lib/libSensor.a and included and linked it by these cmake commands

 include_directories( include )
 target_link_libraries( sensor_node  
   ${catkin_LIBRARIES}  
   ${CMAKE_SOURCE_DIR}/mec_transmission/lib/libSensor.a )

If I build the project I get the following error:

/usr/bin/ld: /opt/ros/kinetic/lib/libroscpp.so: undefined reference to symbol '_ZTVN5boost6detail16thread_data_baseE' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_thread.so: error adding symbols: DSO missing from command line

and I think the problem is within different boost installations under Ubuntu 16 and ROS kinetic. Can anybody help? Thank you very much in advance. Would a minimal example help?

edit retag flag offensive close merge delete

Comments

ROS Kinetic packages are linked against Boost 1.55 (see REP-3). This cannot be mixed with other Boost versions unfortunately.

Typical approach here would be to either recompile library or compile ROS from source with new Boost.

gvdhoorn gravatar imagegvdhoorn ( 2018-05-17 07:58:21 -0500 )edit

But if I recompile ROS against a new boost version, I will have problems with pother packages using the older versions, right? Is there any chance to compile my library such that there are no dependencies to boost, e.g. using static boost libs and include them within the library?

mherrmann gravatar imagemherrmann ( 2018-05-17 13:08:38 -0500 )edit

You can try, but no guarantees.

re: ros against new boost version: yes, you will not be able to use any binary packages from your ROS distribution in that case.

gvdhoorn gravatar imagegvdhoorn ( 2018-05-17 13:10:20 -0500 )edit