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.
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
Can you reproduce this in a completely new workspace?
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 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 please find a minimal project to reproduce the issue here: https://github.com/abaldur/reproduce_...
@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 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 :)
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!
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?