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

Use catkin to build a project with a different libboost version

asked 2022-07-23 01:26:02 -0500

Marcus Barnet gravatar image

I need to compile an old project written in C++ and based on libboost-1.65.1 with catkin under Ubuntu and ROS Melodic (and also ROS Noetic).

The problem is that ROS relies on newer libboost version, it should be 1.71.1, and so I get errors related to the use of deprecated functions (I cannot replace them since it is too complex).

Is there a way to tell catkin and cmake to use an older version of libboost for this specific project only? I have both the versions installed on my machine and I'm able to compile and build the project as a standard C++ program outside catkin.

edit retag flag offensive close merge delete

Comments

Is this "old project" a ros package or not? The fact you could build it outside of catkin_ws strongly suggests it is not a ros package.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-07-23 10:36:58 -0500 )edit

It is not a ros package, I'm trying to add ros libraries and move it under catkin. I'm getting errors related to the boost libraries when I run catkin_make

Marcus Barnet gravatar image Marcus Barnet  ( 2022-07-23 10:59:47 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-07-23 13:41:48 -0500

Mike Scheutzow gravatar image

updated 2022-07-23 13:49:59 -0500

You can not use multiple versions of libboost within a single catkin_ws. If you want to make use of some older code, you will have to update that code to use the exact version of libboost that your ros-release requires.

edit flag offensive delete link more

Comments

1

It would be possible to "use multiple versions of Boost within a single catkin_ws", but what you cannot do is:

I'm trying to add ros libraries

where "add ros libraries" means "I'm going to wrap my old_boost project with ROS", as "ROS" uses a newer version of Boost.

Linking two different versions of Boost to the same binary (executable, library, doesn't matter), typically doesn't work.

@Marcus Barnet: ultimately, if the intention is to be able to wrap old_boost project with ROS Noetic roscpp, it doesn't matter whether you're building it in a Catkin workspace or not. roscpp will bring its own (required) version of Boost with it, which you cannot avoid.

gvdhoorn gravatar image gvdhoorn  ( 2022-07-24 08:56:28 -0500 )edit

@gvdhoorn, thank you for the support. I should be able to compile it in Melodic since I see that it uses the same boost version 1.65.1 of my old code. Do you agree with it?

Marcus Barnet gravatar image Marcus Barnet  ( 2022-07-24 09:39:46 -0500 )edit
1

Without seeing the code I cannot really say anything definitive.

If you have the option to use a ROS version which uses the same version of Boost, that could work.

(note: it's not impossible to use different Boost versions in a single binary, it's just complex, and can lead to subtle bugs. It can be and has been done though)

gvdhoorn gravatar image gvdhoorn  ( 2022-07-24 10:07:52 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-07-23 01:26:02 -0500

Seen: 221 times

Last updated: Jul 23 '22