ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Is it possible to use Boost 1.71 on Ros Melodic?

asked 2019-09-08 03:10:22 -0500

Adam gravatar image

Platform: ROS Melodic on Debian Stretch.

Hello,

I am trying to create a package which uses a library that requires Boost 1.71 is it possible for me to install newer version of Boost and use it in a package side by side with roscpp?

Regards,

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2019-09-08 10:34:13 -0500

gvdhoorn gravatar image

This is not necessarily ROS-specific: mixing different versions of the same library (in this case Boost, but that is almost irrelevant) is almost never a good idea.

It can work though, so you could always just try, but typical problems include hard to diagnose SEGFAULTs and other crashes, which often are caused by ABI incompatibilities between functions in the different versions of the library.

I am trying to create a package which uses a library that requires Boost 1.71 is it possible for me to install newer version of Boost and use it in a package side by side with roscpp?

To answer this question specifically: yes, it would be possible to install the newer version of Boost.

But linking your node to roscpp and the library that requires the newer Boost version is going to be hit-or-miss.

Having written that: if you really have no other option, you could see whether you can build what parts of Melodic you need from source, with the regular Boost (used on Debian Stretch) replaced by Boost 1.71: building a subset of pkgs from sources is not that hard, and should not take that long either.

Melodic is supposed to be built with Boost 1.62 on Stretch though (see REP-3), so you may run into some issues building certain packages (as they may be trying to use no-longer available APIs or try to link against no longer available, or renamed, libraries).

edit flag offensive delete link more

Comments

Thank you sir for your detailed explanation.

Adam gravatar image Adam  ( 2019-09-08 10:38:17 -0500 )edit
0

answered 2020-10-06 12:09:13 -0500

votecoffee gravatar image

updated 2020-10-06 12:09:27 -0500

This worked for me. The biggest issue I've had is with breaking changes in boost regex. You'll have to modify every CMakeList.txt in your workspace where boost is used (notably in the ImagePipeline package if you're using ROS Perception).

I don't know if the find_package 1.74.0 is required. I suspect only the Boost_INCLUDE_DIRS and Boost_LIBRARIES are needed.

In the CMakeLists.txt:

...

find_package(Boost 1.74.0 REQUIRED COMPONENTS system regex)

...

include_directories(
 #your other dirs
  ${Boost_INCLUDE_DIRS}
)

...

target_link_libraries(your_executable
  #your other libs
  ${Boost_LIBRARIES}
)

...
edit flag offensive delete link more

Comments

Hi, I believe that some components in Boost will work fine, but not all of them. I wonder have you experienced some code with Boost.Thread?

DangTran gravatar image DangTran  ( 2021-03-20 16:24:57 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-09-08 03:10:22 -0500

Seen: 2,168 times

Last updated: Oct 06 '20