catkin_tools
catkin_tools copied to clipboard
Specific catkin build workspace overlay fail: with relocated src folder has wrong gcc `-I` order for dependencies.
System Info
-
Operating System:
uname -a
Linux flplv-laptop-docker 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
-
Python Version:
python --version
Python 2.7.12
-
Version of catkin_tools:
catkin --version
OR Git revision
catkin_tools 0.4.5 (C) 2014-2019 Open Source Robotics Foundation
catkin_tools is released under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
---
Using Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
- ROS Distro:
echo $ROS_DISTRO
kinetic
Build / Run Issue
-
[x] Works with
catkin_make
-
[x] Works with
catkin build
-
[x] Works with
catkin build -p1
-
[NO] Works with
catkin config --source X && catkin build
-
[not tested] Works with
catkin_make_isolated --merge
Expected Behavior
Assume a Workspace with packages A
and B
.
Assume that /opt/ros/kinetic
contains package A
installed.
Assume package B
includes A
headers.
We will be looking at the gcc command line -I
inclusion directive order.
When building with catkin build
on a workspace containing a src
folder with symlinks point to the packages A
and B
, it works as expected, the inclusion order of a .cpp
file in package B
is this:
-I/my_ws/devel/.private/B/include
-I/my_ws/src/A/include
-I/opt/ros/kinetic/include
-I/opt/ros/kinetic/share/xmlrpcpp/cmake/../../../include/xmlrpcpp
-I/usr/include/eigen3
Actual Behavior
Now, if I set up my workspace differently, using a relocated src folder, such as calling catkin config --source /another_source_path
where another_source_path
contains package A
and B
, I expect to have the same inclusion order, but the actual order is different:
-I/ws/devel/.private/B/include
-I/opt/ros/kinetic/include
-I/opt/ros/kinetic/share/xmlrpcpp/cmake/../../../include/xmlrpcpp
-I/another_source_path/A/include
-I/usr/include/eigen3
The problem:
The real problem is that on the relocated source folder catkin build
the gcc will pick /opt/ros/kinetic
headers if they are found, instead of selecting the workspace headers for the dependencies.
The problem only happens if you are overlaying packages installed in the system with the local workspaces, and you have configured the catkin build to use an alternate src folder.
Steps to Reproduce the Issue
Steps are described above, let me know if you need an automated bash to try to generate the issue.
Seems very similar to the issue that I have: https://answers.ros.org/question/331158/problems-using-an-overlayed-ros-package/
Have created a minimal project that reproduces the error: https://github.com/abaldur/reproduce_overlay_issue
/abaldur
Ditto for me - also with my demo repo and several levels of transitive includes referencing the install base instead of the local workspace https://github.com/ALTinners/ros-transitive-include-bugs
I suggest checking the order of the parameters of include_directories in the CMakelist, because I solved the problem in this way.