# Problems using an overlayed ROS package

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.

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

Can you reproduce this in a completely new workspace?

( 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?

( 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?)

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

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

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

( 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 :)

( 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!

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