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 imagemgruhler ( 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 imagebalduros ( 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 imagemgruhler ( 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 imagebalduros ( 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 imagemgruhler ( 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 imagebalduros ( 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 imagemgruhler ( 2019-08-26 05:42:43 -0500 )edit