Skip to content
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

Support and prefer exported targets from rmw implementations #201

Merged
merged 4 commits into from
Dec 23, 2021

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Dec 15, 2021

@Blast545 FYI this is an attempt to fix the CI issue from ros2/rmw_cyclonedds#357
Requires ros2/rmw_cyclonedds#360 ✔️
Requires ros2/realtime_support#112 ✔️

The package rmw_implementation appears to be the CMake interface between downstream libraries like rcl and the actual rmw implementations. It looks like when there are multiple rmw_implementations it will export a shared library that can load and switch between them, but when there is only one implementation it sets old-style standard CMake variables to the underlying implementation. Unfortunately, the latter expects the rmw implementation to set old-style CMake variables instead of modern CMake targets.

This PR creates an IMPORTED target rmw_implementation::rmw_implementation and variable rmw_implementation_TARGETS that lets downstream packages like rcl depend on targets instead of old-style CMake variables. It also updates the logic to support, and prefer, modern CMake from the rmw implementations when available.

I also replaced an out-of-place CMAKE_THREAD_LIBS_INIT with a dependency on Threads::Threads on the shared library.

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz sloretz self-assigned this Dec 15, 2021
@sloretz
Copy link
Contributor Author

sloretz commented Dec 15, 2021

The single rmw implementation case and multi rmw implementation cases both need to be tested, so I'll do CI in stages as long as it looks positive.

First: Does it work with the single RMW implementation rmw_cyclonedds? I would expect a build failure if not, so not running many tests to get quicker CI turnaround

CI (build: --packages-ignore fastcdr foonathan_memory_vendor rosbag2_converter_default_plugins --packages-ignore-regex .*connext.* .*fastrtps.* test: --packages-select rmw_implementation rcl rclcpp_components)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz
Copy link
Contributor Author

sloretz commented Dec 16, 2021

Retrying CI with a repos file with the two linked PRs: https://gist.githubusercontent.com/sloretz/26349bc77eb0931f8dbff9d3b4539d2d/raw/353b596d04cee3d2511ce7734c77a39fb87ddee2/ros2.repos

CI (build: --packages-ignore fastcdr foonathan_memory_vendor rosbag2_converter_default_plugins --packages-ignore-regex .*connext.* .*fastrtps.* test: --packages-select rmw_implementation rcl rclcpp_components)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

EDIT: Failing due to test arguments not ignoring unbuilt packages, still, building all the way is promising

@sloretz
Copy link
Contributor Author

sloretz commented Dec 16, 2021

CI again Single RMW implementation case witn rmw_cyclonedds

Jobs

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

Hm, Windows CI is cranky, failing to load certain DLLs. I'm not sure if that is related to the change, or maybe to the set of build/test flags? Either way it probably needs to be looked into.

@sloretz
Copy link
Contributor Author

sloretz commented Dec 16, 2021

Hm, Windows CI is cranky, failing to load certain DLLs. I'm not sure if that is related to the change, or maybe to the set of build/test flags? Either way it probably needs to be looked into.

It's very interesting that launch_xml, a package that doesn't depend directly or indirectly on rclpy, is failing to import it via launch_ros :-/ . This reminds me of the bug where pytest hooks in a merged workspace were loading rclpy ros2/launch_ros#278 .

Possibly related to ros2/launch_ros#288 ?

@sloretz
Copy link
Contributor Author

sloretz commented Dec 20, 2021

Hm, Windows CI is cranky, failing to load certain DLLs. I'm not sure if that is related to the change, or maybe to the set of build/test flags? Either way it probably needs to be looked into.

I setup a windows VM and ran the same arguments, and I can't reproduce it. I'll try another CI run to see if it's a flaky issue.

@sloretz
Copy link
Contributor Author

sloretz commented Dec 20, 2021

CI Windows this branch instead of repos file since required PRs in other repos are in

  • build: --packages-ignore fastcdr foonathan_memory_vendor rosbag2_converter_default_plugins --packages-ignore-regex .*connext.* .*fastrtps.*
  • test: --packages-ignore fastcdr foonathan_memory_vendor rosbag2_converter_default_plugins --packages-ignore-regex .*connext.* .*fastrtps.* --packages-select launch_xml
  • Build Status`

Copy link
Member

@ivanpauno ivanpauno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I only have a minor comment.

ament_index_cpp::ament_index_cpp
rcpputils::rcpputils
rcutils::rcutils
Threads::Threads)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is Threads needed?
This library doesn't use threads.

If some dependency does need it, they should be exporting the link library correctly.
In my local testing I haven't found any issue with not adding Threads here, but I might have tested something incorrectly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was added because fastrtps wasn't exporting the dependency correctly at some point, but AFAIS it's not needed anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary dependency on Threads:Threads in 8f00520

@sloretz
Copy link
Contributor Author

sloretz commented Dec 21, 2021

Try as I might, I can't reproduce the Windows CI test failure locally on a windows VM. I'm going to apply Ivan's feedback and open up a mitigation in launch.

@sloretz
Copy link
Contributor Author

sloretz commented Dec 22, 2021

Another Windows run with ros2/launch#572 included Build Status

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz
Copy link
Contributor Author

sloretz commented Dec 22, 2021

Yet another run after fixing ros2/launch#572 Build Status

@ivanpauno
Copy link
Member

Yet another run after fixing ros2/launch#572 Build Status

It's really strange that now there's no even a warning 😮

@sloretz
Copy link
Contributor Author

sloretz commented Dec 23, 2021

CI (build: --packages-up-to rcl test: --packages-select rcl)

Cyclone DDS only

  • Linux Build Status - Checked parameters ok ✔️
  • Linux-aarch64 Build Status - Checked parameters ok ✔️
  • macOS Build Status
  • Windows Build Status

Fast-DDS static only

  • Linux Build Status - Checked parameters ok ✔️
  • Linux-aarch64 Build Status - Checked parameters ok ✔️
  • macOS Build Status
  • Windows Build Status

DDS Connext only

  • Linux Build Status - Checked parameters ok ✔️
  • Linux-aarch64 Build Status - Failure expected ✔️ - did not get connextdds flag set because CI job for Connext doesn't support arm64
  • macOS Build Status
  • Windows Build Status

Connext/Cyclone/FastDDS

  • Linux Build Status - Checked parameters ok ✔️
  • Linux-aarch64 Build Status - Checked parameters ok ✔️
  • macOS Build Status
  • Windows Build Status

@sloretz
Copy link
Contributor Author

sloretz commented Dec 23, 2021

Something odd going on with the above CI jobs - lots of them don't have the parameters I set on the launcher. https://ci.ros2.org/job/ci_linux-aarch64/10524/parameters/

There might be a ros2/ci bug here. Investigating.

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz
Copy link
Contributor Author

sloretz commented Dec 23, 2021

No CI bugs! Failing combined CI is due to tests having dependencies that they weren't target-linked against. Fixed in c03b44f

@sloretz
Copy link
Contributor Author

sloretz commented Dec 23, 2021

Since c03b44f modifies code that's only enabled in the multi-RMW case, I think the green CI for the single RMW cases is still valid. I'll rerun the CI for the connext/cyclone/fastdds combinded jobs only:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz sloretz merged commit afecc5d into master Dec 23, 2021
@delete-merged-branch delete-merged-branch bot deleted the prefer_rmw_implementation_exported_targets branch December 23, 2021 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants