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

Problems using an overlayed ROS package

asked 2019-08-20 09:40:24 -0500

balduros gravatar image

Hi

I'm having some problems with using an overlayed ROS package.

I have the following packages, let's call them A, B and C:

  • A: System package that I would like to overlay (dynamic_reconfigure to be specific).
  • B: An overlay of package A. The source code of A has been cloned to my catkin_ws and I have made some minor modifications.
  • C: Package that make use of the overlayed package B.

Building the overlayed package B (dynamic_reconfigure) with catkin_make goes without problems.

After compiling, I can verify:

  • rospack list dynamic_reconfigure /my_catkin_ws/src/dynamic_reconfigure (OK - as expected)

  • roscd A && pwd /my_catkin_ws/src/dynamic_reconfigure (OK - as expected)

Now, I would like package C to use the overlayed package. This seems to fail due to wrong include (-I) order made by CMake(?).

If I run catkin_make VERBOSE=1 I can see the following include order:

-I/my_catkin_ws/devel/include -I/my_catkin_ws/src/C/include -I/opt/ros/melodic/include -I/my_catkin_ws/src/dynamic_reconfigure/include

The problem is that /opt/ros/melodic/include is included BEFORE /my_catkin_ws/src/dynamic_reconfigure/include, so it will simply pick the system header files.

If I maunally swap the last two include statements and run the make command:

-I/my_catkin_ws/devel/include -I/my_catkin_ws/src/C/include -I/my_catkin_ws/src/dynamic_reconfigure/include -I/opt/ros/melodic/include

Then everything works as expected.

Please help me understand what happens :)

The problem seems very similar to the one described in the following issue: https://github.com/catkin/catkin_tool...

My ROS distro is melodic.

Thx /abaldur

edit retag flag offensive close merge delete

Comments

Can you reproduce this in a completely new workspace?

mgruhler gravatar image mgruhler  ( 2019-08-21 01:11:44 -0500 )edit

Thx for the comment. I noticed something weird. Usually, I use symbolic links to the ROS packages that I want to build in my catkin_ws. If I do that, the problem shows up (also if I use a completely different workspace). If however, I copy in the files, the problem does not show up. I.e. the include (-I) order of the g++ command is correct? Can you make sense of that?

balduros gravatar image balduros  ( 2019-08-21 02:12:32 -0500 )edit

@balduros this really sounds like the issue you link to. However, I cannot reproduce that. But maybe I've set my workspace up differently? Could you create a sample project and exact instructions how to reproduce? (i.e. what to symlink where and where to put which sources?)

mgruhler gravatar image mgruhler  ( 2019-08-22 01:17:37 -0500 )edit

@mgruhler please find a minimal project to reproduce the issue here: https://github.com/abaldur/reproduce_...

balduros gravatar image balduros  ( 2019-08-24 05:05:29 -0500 )edit

@balduros This is now reall a sscce! Many thanks! With that, I've been easily able to reproduce this. I also tested some variations and in the end, the problem is that the dependency (i.e. dynamic_reconfigure/package B) is symlinked. The other isn't an issue.

Sadly, I've not been able to come up with a solution. There seem to be quite some issues with cmake and symlinks, though. It might not be an only catkin-related problem. But I cannot help more. Sorry.

mgruhler gravatar image mgruhler  ( 2019-08-26 04:34:18 -0500 )edit

@mgruhler thx for confirming the issue! I was in doubt if there was something wrong with the way I have set things up, but now I feel more confident that it is in fact an issue :)

balduros gravatar image balduros  ( 2019-08-26 04:54:38 -0500 )edit

Might make more sense to track this at the specific repo as a bug, than have it here. With your example repo it is easy to reproduce!

mgruhler gravatar image mgruhler  ( 2019-08-26 05:42:43 -0500 )edit

Hi, I know this is an old issue, but I'm experiencing the same problem. I also usually work with symlinks to my packages in the workspaces, as I have multiple projects that share same packages. Concretely, I have a modified version of costmap_2d package, and I'm using the cloned version of spatio_temporal_voxel_layer. This package seems to not linking properly the libcostmap_2d.so generated in my workspace and crushes on execution time. If I copy my own costmap_2d package instead symlinking it works. I checked the generated build files and in the first case, /opt/ros/noetic/include comes before the includes of my workspace.

@balduros, did you find a way to solve it using symlinks?

mtlazaro gravatar image mtlazaro  ( 2022-06-08 07:00:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-24 03:54:03 -0500

hk402 gravatar image

I also encountered a similar problem. I solved the problem by modifying the order of the parameters in include_directories in the CMakelist.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-08-20 09:40:24 -0500

Seen: 263 times

Last updated: Aug 20 '19