Repository navigation
cmake: add ROS 2 Lyrical to supported distros - #3525
Conversation
|
@remibettan please update readme tag and supported platforms on install step |
0a6eadd to
1cf762d
Compare
| jobs: | ||
| build: | ||
| name: Build on ROS2 ${{ matrix.ros_distro }} and ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} |
There was a problem hiding this comment.
Can we do the same and split rolling to a different file?
There was a problem hiding this comment.
Done in ee44e62 + 7996a48. Rolling moved to its own workflow .github/workflows/main-rolling.yml (single rolling-only job with the lyrical-container override, ros2-testing apt source, AMENT overlay, and integration tests intentionally not run — same set as before, just isolated). This main.yml is back to the pre-PR shape: matrix is [humble, jazzy, kilted] (also synced with #3528 dropping Iron), no container_image expression, no ros_distro_runtime, no overlay blocks, and the integration-tests step has no rolling if: guard. Header in main-rolling.yml lists every workaround it carries and the fold-back condition.
| <!-- Pulls in libfastdds.so. Required at build time so CMake links it into | ||
| the executables (fastcdr load-order workaround, see CMakeLists.txt), | ||
| and at runtime so the NEEDED entry resolves. --> | ||
| <depend>rmw_fastrtps_cpp</depend> |
There was a problem hiding this comment.
About this and the upper change in the CMakeList file.
How can we not enforce the user to link to fastdds/fastrtps if he use a different RMW in his distro?
There was a problem hiding this comment.
Gated the link on bundled-DDS detection in 5334010. The CMake block now runs find_library(FASTDDS_LIBRARY) + the per-target -Wl,--no-as-needed only when fastcdr_FOUND is set.
Detection: when librealsense is built with BUILD_WITH_DDS=ON, its installed realsense2Config.cmake transitively calls find_dependency(fastcdr CONFIG REQUIRED) (templated in via @REALSENSE2_DDS_DEPENDENCIES@ — see librealsense/CMake/external_fastdds.cmake). That makes fastcdr_FOUND=TRUE immediately after our find_package(realsense2) at line 155. A plain (non-DDS) librealsense leaves the template substitution empty, fastcdr_FOUND stays unset, and we skip the link entirely. So a user on Cyclone DDS / RMW Zenoh with a non-bundled-DDS librealsense doesn't get a FastDDS NEEDED entry on the wrapper executable.
The <depend>rmw_fastrtps_cpp</depend> here in package.xml stays unconditionally because it's still needed for the bundled-DDS binary case (Tier 1 deb builds from build.ros2.org, where librealsense ships with bundled DDS and the ABI clash is real). Non-bundled-DDS users have FastDDS installed on disk by rosdep but never loaded into the wrapper process — harmless. Making the depend itself conditional would require a build-time env var that rosdep can read, which doesn't exist for "librealsense was built with BUILD_WITH_DDS=ON".
… clash When librealsense is built with bundled DDS, librealsense2.so exports its own eprosima::fastcdr::* symbols. At runtime these can win resolution over ROS 2's libfastcdr (e.g. lyrical's fastdds 3.6 vs. librealsense's bundled fastcdr 1.0.28), and the first log publish segfaults inside the wrong-ABI implementation. rclcpp_components dlopens the plugin .so with RTLD_LOCAL, so NEEDED entries on the plugin land in a private namespace and don't help ROS code resolve fastcdr symbols. Link libfastdds directly into the registered executables so it loads into the global namespace at process start, before librealsense. Declare rmw_fastrtps_cpp in package.xml to guarantee libfastdds.so is present both at deb-build time (so find_library succeeds and the NEEDED entry is baked in) and at runtime on the user's machine (so the resulting binary can actually load). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7996a48 to
6ef10aa
Compare
Nir-Az
left a comment
There was a problem hiding this comment.
Focused review on keeping non-DDS and non-FastDDS (Cyclone DDS / RMW Zenoh) users unharmed by the FastDDS load-order workaround.
| <!-- Pulls in libfastdds.so. Required at build time so CMake links it into | ||
| the executables (fastcdr load-order workaround, see CMakeLists.txt), | ||
| and at runtime so the NEEDED entry resolves. --> | ||
| <depend>rmw_fastrtps_cpp</depend> |
There was a problem hiding this comment.
This <depend> is unconditional, so it pulls rmw_fastrtps_cpp (and FastDDS) into every install — including users running Cyclone DDS or RMW Zenoh, and users on plain non-DDS librealsense. That works against the fastcdr_FOUND gating in CMakeLists.txt, which deliberately avoids forcing FastDDS on exactly those users.
Can we scope this so non-FastDDS / non-DDS users aren't forced to install FastDDS — e.g. gate it the same way the CMake link is gated, or drop to a narrower dependency? Also, the comment says "Required at build time so CMake links it into the executables", but the link only fires when fastcdr_FOUND (DDS-built librealsense); for the default non-DDS build CMake skips the link, so the comment is misleading for that case.
There was a problem hiding this comment.
Dropped the unconditional <depend>rmw_fastrtps_cpp</depend> in 2b00ddd. Cyclone/Zenoh users and plain (non-DDS) librealsense users no longer get FastDDS pulled in by rosdep.
For bundled-DDS librealsense users: librealsense's own package is expected to make libfastdds/libfastrtps available transitively (it bundles FastDDS at build time). If for any reason the lib isn't on the system at configure time, our find_library returns NOTFOUND and the workaround silently no-ops — the bundled-DDS segfault would resurface, but only in the narrow case of bundled-DDS librealsense installed without its transitive FastDDS being reachable.
Replaced the (misleading) package.xml comment with a longer note in CMakeLists.txt explaining the trade-off — the package.xml gate would have been ideal, but rosdep can't conditionalise on a CMake-time variable, so the cleanest answer is to not declare it at all and rely on librealsense's own deps.
| function(_rs_link_fastdds_workaround target) | ||
| if(FASTDDS_LIBRARY) | ||
| target_link_libraries(${target} | ||
| "-Wl,--no-as-needed" ${FASTDDS_LIBRARY} "-Wl,--as-needed") |
There was a problem hiding this comment.
--no-as-needed forces a hard libfastdds NEEDED entry on the wrapper executable. When librealsense is DDS-built (fastcdr_FOUND), every realsense2_camera_node then loads FastDDS at startup regardless of the user's selected RMW — so Cyclone DDS / Zenoh users get FastDDS force-loaded into their process. Can we confirm a force-loaded-but-unused libfastdds stays dormant (no participant created, no threads spun) for those users? If it's purely a load-order fix, a one-line note here saying so would settle the "other-MW users unharmed" question.
There was a problem hiding this comment.
Added a comment in 2b00ddd inside _rs_link_fastdds_workaround saying so. Short version: the loaded-but-unused libfastdds/libfastrtps is inert. The shared object just exposes symbols — no constructors create a DomainParticipant or spin threads. FastDDS only does work once user code (here: the RMW layer) actually instantiates a participant. Cyclone/Zenoh users have ROS load rmw_cyclonedds_cpp / rmw_zenoh_cpp instead, so the FastDDS code paths are never entered. We just pay the cost of the .so being mapped into the address space.
| # on Cyclone DDS / RMW Zenoh don't end up with a FastDDS NEEDED entry on | ||
| # the wrapper executable. | ||
| if(fastcdr_FOUND AND UNIX AND NOT APPLE) | ||
| find_library(FASTDDS_LIBRARY NAMES fastdds) |
There was a problem hiding this comment.
NAMES fastdds only matches the library on Kilted/Lyrical/Rolling. On Humble and Jazzy the library is still libfastrtps.so (the package/lib was renamed fastrtps->fastdds in Kilted). Since this block is gated on fastcdr_FOUND (not on distro), a DDS-built librealsense on Humble/Jazzy hits find_library -> NOTFOUND and silently skips the workaround, leaving the fastcdr clash unfixed. Suggest NAMES fastdds fastrtps, or use the fastdds/fastrtps imported CONFIG target.
There was a problem hiding this comment.
Good catch — fixed in 2b00ddd. find_library now does NAMES fastdds fastrtps, so Kilted/Lyrical/Rolling match libfastdds.so (first hit) and Humble/Jazzy fall through to libfastrtps.so. Comment in the block names the rename.
…ional package.xml dep
|
@Nir-Az @remibettan I noticed that the official Lyrical package distribution list still has May I know if there is any plan to update the distro list to a version that has the fix here (which currently only lives in the |
Hi @nvcyc , firstly great to hear users care and waits for it :) |
|
@Nir-Az Thanks! Really appreciate your update! |
Tracked by: RSDSO-21542
Overview: Unblock the realsense2_camera build on ROS 2 Lyrical (Ubuntu 26.04 Resolute). Rolling-on-Resolute workarounds live in a separate workflow so they don't touch the main CI matrix.
Why
The official ROS build farm started building realsense2_camera on Lyrical (Ubuntu 26.04 Resolute) and failed with
Unsupported ROS Distribution: lyricalfromrealsense2_camera/CMakeLists.txt. The CMake distro switch hard-rejects anything outside its allow-list (foxy/humble/iron/rolling/jazzy/kilted), so Lyrical needs an explicit branch.Failing Lyrical build: https://build.ros2.org/job/Lbin_uR64__realsense2_camera__ubuntu_resolute_amd64__binary/27/
ROS Rolling has migrated off Noble too, and several upstream gaps need transitional workarounds:
ros:rolling-ros-coreis still pinned to a Noble Dockerfile indocker-library/official-images,ros-rolling-*debs forresoluteare only inpackages.ros.org/ros2-testinguntil the next stable sync, andimage_transportmade a non-backwards-compatible API change on Rolling/Lyrical. To keep the main workflow clean, the rolling matrix entry is split into its own file with all the workarounds isolated.Summary
realsense2_camera/CMakeLists.txt— addelseif("$ENV{ROS_DISTRO}" STREQUAL "lyrical")branch defining-DLYRICALand pulling insrc/ros_param_backend.cpp, mirroring the other distro entries. This is the change RSDSO-21542 originally asked for.realsense2_camera/CMakeLists.txt— gate the libfastdds load-order workaround onfastcdr_FOUNDso it only fires when librealsense was built with bundled DDS (BUILD_WITH_DDS=ON). Plain (non-DDS) librealsense leavesfastcdr_FOUNDunset, so users on Cyclone DDS / RMW Zenoh don't end up with a FastDDS NEEDED entry on the wrapper executable.realsense2_camera/src/image_publisher.cpp— Rolling/Lyrical'simage_transport::create_publisherdeducesNodeTfrom a Node reference (it callsnode.get_node_base_interface()) and takesrclcpp::QoSinstead ofrmw_qos_profile_t. Guarded by#if defined(LYRICAL) || defined(ROLLING); legacy distros keep the old&node + rmw_qos_profile_tform..github/workflows/main.yml— reverted to the pre-PR shape. Matrix is[humble, jazzy, kilted](also picks up Iron-drop from ci: drop ROS 2 Iron from main workflow matrix #3528). Nocontainer_image/ros_distro_runtime/ AMENT overlay / ros2-testing apt-source step / rolling-skip guard..github/workflows/main-rolling.yml(new) — standalone rolling job with all the chimera:ros:lyrical-ros-core-resolutecontainer,ROS_DISTRO=lyrical, ros2-testing parallel apt source step,/opt/ros/lyrical/+/opt/ros/rolling/overlay in build/test steps. Integration tests intentionally not run here (they time out under the chimera — see header). Header lists every workaround and the upstream condition that lets each be reverted; fold the whole file back intomain.ymlonce the gates close.Follow-up ticket tracking each workaround's revert condition: RSDSO-21626.
Test plan
CImatrix (humble, jazzy, kilted) passes — same set as today'sros2-development.CI - Rollingjob (rolling, ubuntu-26.04, lyrical-ros-core-resolute) passes build + unit tests.build.ros2.orgLbin_uR64__realsense2_camera__ubuntu_resolute_amd64__binaryrun succeeds.