Use catkin to build a project with a different libboost version
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.
Asked by Marcus Barnet on 2022-07-23 01:26:02 UTC
Answers
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.
Asked by Mike Scheutzow on 2022-07-23 13:41:48 UTC
Comments
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.
Asked by gvdhoorn on 2022-07-24 08:56:28 UTC
@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?
Asked by Marcus Barnet on 2022-07-24 09:39:46 UTC
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)
Asked by gvdhoorn on 2022-07-24 10:07:52 UTC
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.Asked by Mike Scheutzow on 2022-07-23 10:36:58 UTC
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
Asked by Marcus Barnet on 2022-07-23 10:59:47 UTC