Ask Your Question
0

Build package with Boost 1.53 on ROS noetic in Ubuntu 20.04(Default Boost 1.71)

asked 2020-11-08 11:09:25 -0600

lancezzz gravatar image

Hi,

We are using ROS noetic on Ubuntu 20.04, and we have a ROS package(Slamtec's mapper) that was developed and tested on previous ROS distribution and required a boost library version of 1.53 to function properly. The package includes precompiled static linked libraries(boost, eigen, json, and rpos). The program will give 'Segfault' it is linked to Boost 1.71 in the system of Ubuntu20.04. But whenever I build the package, the executable is always linked to the system library(1.71) instead of the libraries provided in the package.

I am wondering why this is the case, how could I solve it? I have attached my CMakeLists for the package. Thanks in advance!

add_library(${PROJECT_NAME} STATIC
  src/client/slamware_ros_sdk_client.cpp
)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_generate_messages_cpp)

add_executable(slamware_ros_sdk_server_node
  src/server/msg_convert.cpp
  src/server/server_params.cpp
  src/server/server_map_holder.cpp
  src/server/server_work_data.cpp
  src/server/server_worker_base.cpp
  src/server/server_workers.cpp
  src/server/slamware_ros_sdk_server_node.cpp
  src/server/slamware_ros_sdk_server.cpp
)
add_dependencies(slamware_ros_sdk_server_node ${PROJECT_NAME}_generate_messages_cpp)
target_include_directories(slamware_ros_sdk_server_node
  PRIVATE ${SLTC_SDK_INC_DIR}
)
target_compile_options(slamware_ros_sdk_server_node
  PRIVATE -Wno-deprecated-declarations
)
target_link_libraries(slamware_ros_sdk_server_node
  ${catkin_LIBRARIES}
  ${SLTC_SDK_LIB_DIR}/librpos_robotplatforms_rpslamware.a
  ${SLTC_SDK_LIB_DIR}/librpos_framework.a
  ${SLTC_SDK_LIB_DIR}/libbase64.a
  ${SLTC_SDK_LIB_DIR}/librlelib.a
  ${SLTC_SDK_LIB_DIR}/libjsoncpp.a
  ${SLTC_SDK_LIB_DIR}/libcurl.a
  ${SLTC_SDK_LIB_DIR}/libssl.a
  ${SLTC_SDK_LIB_DIR}/libcrypto.a
  ${SLTC_SDK_LIB_DIR}/libboost_atomic.a
  ${SLTC_SDK_LIB_DIR}/libboost_chrono.a
  ${SLTC_SDK_LIB_DIR}/libboost_date_time.a
  ${SLTC_SDK_LIB_DIR}/libboost_regex.a
  ${SLTC_SDK_LIB_DIR}/libboost_filesystem.a
  ${SLTC_SDK_LIB_DIR}/libboost_system.a
  ${SLTC_SDK_LIB_DIR}/libboost_thread.a
  ${SLTC_SDK_LIB_DIR}/libboost_random.a
  pthread
  dl
  rt
)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-11-09 07:16:33 -0600

gvdhoorn gravatar image

updated 2020-11-09 08:21:26 -0600

What is in catkin_LIBRARIES? If it includes any package which you've installed from the buildfarm provided binaries for Noetic, that's going to bring in the platform's default Boost.

Seeing as you're using ROS, and this is a C++ program, I would assume at least roscpp is there.

I am wondering why this is the case, how could I solve it?

SEGFAULTs are typically a result of mixing different Boost versions, and you seem to have observed those (it's not limited to Boost of course: (transitively) linking different versions of the same library often doesn't work).

I believe the only robust way to avoid this is to build Noetic from source against the same Boost version you're bringing in from the SLTC_SDK_LIB_DIR. But seeing there are quite some differences between 1.53 and the Noetic native 1.71, that will most likely be problematic, if not impossible.

If you don't actually absolutely need to run this all natively under Noetic, I would suggest to use some sort of container technology to run just this one node in an isolated environment (fi: a Docker container). That environment would pack just this node and its dependencies (which probably includes ROS Indigo (?), which I assume is where the Boost 1.53 comes from).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-11-08 11:06:50 -0600

Seen: 69 times

Last updated: Nov 09 '20