# Is it possible to use Boost 1.71 on Ros Melodic?

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 close merge delete

Sort by » oldest newest most voted

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).

more

Thank you sir for your detailed explanation.

( 2019-09-08 10:38:17 -0600 )edit

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(
${Boost_INCLUDE_DIRS} ) ... target_link_libraries(your_executable #your other libs${Boost_LIBRARIES}
)

...

more