-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix include order: correctly consider _all_ dependencies recursively #402
base: galactic
Are you sure you want to change the base?
Conversation
I suggest skipping ordering of include dirs in ament_include_directories_order() as we need to reorder here anyway - including the non-interface include directories. However, this will change behavior. |
728dab2
to
3fc0b66
Compare
Note that |
This was worked on in ros2/ros2#1150, and this comment has some options considered. We decided to have all packages install their headers to a unique include directory instead of catkin-like include directory sorting.
This was one of the reasons we decided not to rely on include directory sorting. Separately, now that packages are using modern CMake targets I'd recommend using |
I see. Unfortunately, I ran into this issue on Ubuntu Focal, running ROS Galactic 😢 |
|
Signed-off-by: Robert Haschke <[email protected]>
3fc0b66
to
f93c946
Compare
I rebased and re-targeted this PR against galactic now. |
Closing and reopening to retrigger CI. |
Signed-off-by: Robert Haschke <[email protected]>
f93c946
to
9db6983
Compare
I ran into a similar issue as described by @jacobperron in https://github.com/jacobperron/overlay_bug_reproduction.
However, in my case, transitive dependencies were involved - which, surprisingly, are not resolved at all.
I modified the example slightly. I can be found in this repo.
There are four packages with the following dependencies:
package_c
->package_a
,package_b
package_d
->package_c
package_a
exists in both the underlay and overlay workspace, with a modified version in the overlay.package_c
depends on the modified version ofpackage_a
(in the overlay) andpackage_b
in the underlay.package_d
depends onpackage_c
and transitively onpackage_a
andpackage_b
.When building
package_c
, its interface dependencies are explicitly sorted.However, when building
package_d
, it doesn't reportINTERFACE_INCLUDE_DIRECTORIES
of transitive dependencies. Thus, the include directories ofa
andb
are not considered for sorting in above-mentioned code, but are used according to the order given in ament_target_dependencies(package_c
...). Indeed, changing the order there would fix the issue.Solution Proposal
Obviously, sorting of include directories should consider all dependencies.
Actually, #259 already implemented a function to recursively retrieve all include dirs. However, #260, which introduced the code above, didn't consider that?!
I was really surprised to hit such a fundamental issue. Are transitive dependencies not used/allowed in ROS2?