Skip to content

[scarthgap]{jazzy}{humble} Fixes for ros2-control and ros2-canopen .bbappends#1635

Open
graceagrace wants to merge 8 commits intoros:scarthgap-nextfrom
graceagrace:asg/scarthgap-jazzy-ros2-control-and-ros2-canopen-fixes
Open

[scarthgap]{jazzy}{humble} Fixes for ros2-control and ros2-canopen .bbappends#1635
graceagrace wants to merge 8 commits intoros:scarthgap-nextfrom
graceagrace:asg/scarthgap-jazzy-ros2-control-and-ros2-canopen-fixes

Conversation

@graceagrace
Copy link
Contributor

Many patches to build ros2-control recipes against Scarthgap + Jazzy are out-of-date, causing build failures. Additionally, lely-core-libraries needs some adjustments to compile successfully and enable the rest of the ros2-canopen recipes to build. This is a simple cleanup PR to get the patches in a state where the affected recipes build nicely again.

@robwoolley
Copy link
Collaborator

Thanks @graceagrace! I just updated scarthgap to the latest Jazzy sync. It passed a desktop-full test build (which doesn't include ros2-control). I will rebase and merge your fixes to get better coverage.

@chkohn
Copy link
Contributor

chkohn commented Feb 2, 2026

thank you @graceagrace ! I pulled your branch and rebased it on top of @robwoolley's latest scarthgap update from this weekend.

I'm building ros2-control (jazzy+scarthgap) for aarch64 and I was seeing build failures on my end which I resolved with the below patch.

commit 29a7bc7d1b90c1092338f17d53873a0d43de2b42 (HEAD -> 2026.1)
Author: Christian Kohn <chris.kohn@amd.com>
Date:   Sat Dec 13 12:33:39 2025 -0700

    Revert "{jazzy} hardware-interface: Remove buildpath"

    This is causing compilation issues due to missing includes from
    pal-statistics.

    This reverts commit 0756a37ac0bc2e6f05e4d8fce2e7d87942838915.

    Instead, fix the build path issue by updating the sed command that
    processes the cmake export file.

    Signed-off-by: Christian Kohn <chris.kohn@amd.com>

diff --git a/meta-ros2-jazzy/recipes-bbappends/ros2-control/hardware-interface/remove-buildpath.patch b/meta-ros2-jazzy/recipes-bbappends/ros2-control/hardware-interface/remove-buildpath.patch
deleted file mode 100644
index 706629f3b..000000000
--- a/meta-ros2-jazzy/recipes-bbappends/ros2-control/hardware-interface/remove-buildpath.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From c5e950e3cef89a79cafd08cc58df978e08b4dae6 Mon Sep 17 00:00:00 2001
-From: Rob Woolley <rob.woolley@windriver.com>
-Date: Thu, 28 Aug 2025 07:53:47 -0700
-Subject: [PATCH] Remove buildpath
-
-Adding pal_statistics_INCLUDE_DIRS causes the absolute path to be
-included in export_hardware_interfaceExport.cmake.
-
-Including the CMake target in target_link_lirbaries() instead
-automatically adds the include directory at compile time. This
-also results in the target being used in the exported cmake file.
-
-Upstream-Status: Pending
-
-Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
----
- CMakeLists.txt | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b250e3ecb..c78408ede 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -40,7 +40,6 @@ target_compile_features(hardware_interface PUBLIC cxx_std_17)
- target_include_directories(hardware_interface PUBLIC
-   $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
-   $<INSTALL_INTERFACE:include/hardware_interface>
--  ${pal_statistics_INCLUDE_DIRS}
- )
- target_link_libraries(hardware_interface PUBLIC
-                       rclcpp::rclcpp
-@@ -52,7 +51,8 @@ target_link_libraries(hardware_interface PUBLIC
-                       rcpputils::rcpputils
-                       tinyxml2
-                       ${joint_limits_TARGETS}
--                      ${pal_statistics_LIBRARIES}
-+                      ${pal_statistics_TARGETS}
-+                      ${pal_statistics_msgs_TARGETS}
-                       ${control_msgs_TARGETS}
-                       ${lifecycle_msgs_TARGETS}
-                       fmt::fmt)
diff --git a/meta-ros2-jazzy/recipes-bbappends/ros2-control/hardware-interface_4.42.2-1.bbappend b/meta-ros2-jazzy/recipes-bbappends/ros2-control/hardware-interface_4.42.2-1.bbappend
index 87fda8342..594301289 100644
--- a/meta-ros2-jazzy/recipes-bbappends/ros2-control/hardware-interface_4.42.2-1.bbappend
+++ b/meta-ros2-jazzy/recipes-bbappends/ros2-control/hardware-interface_4.42.2-1.bbappend
@@ -1,8 +1,7 @@
 # Copyright (c) 2022 Wind River Systems, Inc.

 FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
-SRC_URI += "file://use-tinyxml-by-name.patch \
-            file://remove-buildpath.patch"
+SRC_URI += "file://use-tinyxml-by-name.patch"

 inherit pkgconfig

@@ -18,5 +17,5 @@ ROS_BUILDTOOL_DEPENDS += " \

 # QA Issue: File /opt/ros/rolling/share/hardware_interface/cmake/export_hardware_interfaceExport.cmake in package hardware-interface-dev contains reference to TMPDIR [buildpaths]
 do_install:append() {
-    sed -i -e "s#${RECIPE_SYSROOT}##g" ${D}${ros_prefix}/share/hardware_interface/cmake/export_hardware_interfaceExport.cmake
+    sed -i -e "s#${RECIPE_SYSROOT}#\${_IMPORT_PREFIX}/../../..#g" ${D}${ros_prefix}/share/hardware_interface/cmake/export_hardware_interfaceExport.cmake
 }

with that patch on top of this series, I'm able to build ros2-control successfully.

@chkohn
Copy link
Contributor

chkohn commented Feb 2, 2026

I'm also seeing a build error with canopen on my end (same build target) but I haven't had time to troubleshoot it. Abbreviated log snippet of the failure I'm seeing below:

| FAILED: libcanopen_interfaces__rosidl_generator_c.so
| /scratch/ckohn/yocto-edf-26.1-new/build/tmp/work/cortexa72-cortexa53-amd-linux/canopen-interfaces/0.3.2-1/recipe-sysroot-native/opt/ros/jazzy/lib/libservice_msgs__rosidl_generator_c.so: error adding symbols: file in wrong format
| collect2: error: ld returned 1 exit status
| ninja: build stopped: subcommand failed.
|
| WARNING: exit code 1 from a shell command.
ERROR: Task (/scratch/ckohn/yocto-edf-26.1-new/sources/poky/../meta-ros/meta-ros2-jazzy/generated-recipes/ros2-canopen/canopen-interfaces_0.3.2-1.bb:do_compile) failed with exit code '1'

@graceagrace
Copy link
Contributor Author

graceagrace commented Feb 2, 2026

I'm also seeing a build error with canopen on my end (same build target) but I haven't had time to troubleshoot it. Abbreviated log snippet of the failure I'm seeing below:

| FAILED: libcanopen_interfaces__rosidl_generator_c.so
| /scratch/ckohn/yocto-edf-26.1-new/build/tmp/work/cortexa72-cortexa53-amd-linux/canopen-interfaces/0.3.2-1/recipe-sysroot-native/opt/ros/jazzy/lib/libservice_msgs__rosidl_generator_c.so: error adding symbols: file in wrong format
| collect2: error: ld returned 1 exit status
| ninja: build stopped: subcommand failed.
|
| WARNING: exit code 1 from a shell command.
ERROR: Task (/scratch/ckohn/yocto-edf-26.1-new/sources/poky/../meta-ros/meta-ros2-jazzy/generated-recipes/ros2-canopen/canopen-interfaces_0.3.2-1.bb:do_compile) failed with exit code '1'

Add this to a .bbappend:

ROS_BUILD_DEPENDS += "\
    service-msgs \
"

I can push a commit with this addition to this branch.

@graceagrace
Copy link
Contributor Author

I added the .bbappend for canopen-interfaces as well as some other .bbappends from my local workspace that enabled a successful build of the ros2-control recipes.

@graceagrace graceagrace force-pushed the asg/scarthgap-jazzy-ros2-control-and-ros2-canopen-fixes branch from 7b5b7cf to c15fa30 Compare February 2, 2026 18:28
@graceagrace graceagrace changed the title [scarthgap]{jazzy} Fixes for ros2-control and ros2-canopen .bbappends [scarthgap]{jazzy}{humble} Fixes for ros2-control and ros2-canopen .bbappends Feb 2, 2026
@chkohn
Copy link
Contributor

chkohn commented Feb 2, 2026

thanks @graceagrace for the quick reply. I cherry-picked your latest 2 commits and with a couple more tweaks, i'm able to build canopen on my end as well:

  1. adjust recipe version of bbappend files (presumably this is needed due to @robwoolley 's merge over the weekend)
R  meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-base-driver_0.3.1-1.bbappend -> meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-base-driver_0.3.2-1.bbappend
R  meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-core_0.3.1-1.bbappend -> meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-core_0.3.2-1.bbappend
R  meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-master-driver_0.3.1-1.bbappend -> meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-master-driver_0.3.2-1.bbappend
R  meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-proxy-driver_0.3.1-1.bbappend -> meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-proxy-driver_0.3.2-1.bbappend
  1. fixup license and build warnings in canopen-402-driver. You probably have a similar patch in your tree I would guess
commit b687bfe278569381a8d1b06714e6d6529bb0ffe7 (HEAD -> 2026.1)
Author: Christian Kohn <chris.kohn@amd.com>
Date:   Mon Feb 2 13:03:58 2026 -0700

    canopen-402-driver: Fix license and ignore warning

    Fix license by setting it to LGPL-3.0-only. Ignore build warnings
    by appending CXXFLAGS.

    Signed-off-by: Christian Kohn <chris.kohn@amd.com>

diff --git a/meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-402-driver_0.3.2-1.bbappend b/meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-402-driver_0.3.2-1.bbappend
new file mode 100644
index 000000000..ca98ed52d
--- /dev/null
+++ b/meta-ros2-jazzy/recipes-bbappends/ros2-canopen/canopen-402-driver_0.3.2-1.bbappend
@@ -0,0 +1,3 @@
+LICENSE = "LGPL-3.0-only"
+
+CXXFLAGS += "-Wno-error=format-security"

@graceagrace
Copy link
Contributor Author

Great, thank you for testing @chkohn! Would you like me to apply these changes to a commit of my own? Otherwise, you're welcome to push these to my branch. Afterwards, I will rebase onto the tip of scarthgap-next.

@chkohn
Copy link
Contributor

chkohn commented Feb 2, 2026

@graceagrace feel free to absorb my changes into your commits, that will be cleaner.

@chkohn
Copy link
Contributor

chkohn commented Feb 4, 2026

I think this PR addresses #1559

@graceagrace
Copy link
Contributor Author

I think this PR addresses #1559

It did not before, but it should now! I had a patch for that issue in my local tree.

I'll add your changes to a commit later today, apologies for the delay on this.

@chkohn
Copy link
Contributor

chkohn commented Feb 4, 2026

@graceagrace no rush from my side. and thanks for including a fix for controller-manager as well. my bad, i must have had a local commit then that I missed.

Refresh patch files and .bbappends for various ros2-control recipes

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
Update python3-cogen file paths to the appropriate ROS directories
Fix repackage-lely-core.patch

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
Update patch to CMakeLists.txt to remove warning-to-error promotions that cause build failures for OpenEmbedded.

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
…DEPENDS

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
Add .bbappend files for version 0.3.1-1 of canopen-base-driver, canopen-core, canopen-master-driver, and canopen-proxy-driver.

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
Add the pal-statistics targets to CMakeLists.txt and add appropriate DEPENDS to .bbappend

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
@graceagrace graceagrace force-pushed the asg/scarthgap-jazzy-ros2-control-and-ros2-canopen-fixes branch from 4624da6 to b2e32e9 Compare February 6, 2026 15:18
@graceagrace
Copy link
Contributor Author

Alright, it seems to me that the rebase made everything happy - I was able to build ros2-control and the affected ros2-canopen recipes.

I did notice that rebasing made a bit of a mess of the commit history and created duplicates of my initial commits - a bit of a newbie question, but is there any way for me to resolve this?

@robwoolley
Copy link
Collaborator

Using "git rebase -i" changed my world. You can move commits around as well as edit them in place, merge, and squash them. It might take a little getting used to at first. I recommend making a backup of your work somewhere (perhaps on a duplicate branch or repo).

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
@graceagrace graceagrace force-pushed the asg/scarthgap-jazzy-ros2-control-and-ros2-canopen-fixes branch from b2e32e9 to f125f5f Compare February 6, 2026 16:12
@graceagrace
Copy link
Contributor Author

@robwoolley thank you for the tip, this changed my world as well! I was able to clean up the commits.

@chkohn, I applied the changes you needed to build, but let me know if something is newly broken/still not working.

@chkohn
Copy link
Contributor

chkohn commented Feb 7, 2026

@graceagrace thanks for updating the PR.

I was able to build canopen without any issues.

I then tried ros2-control and I ran into a patch fuzz issue with this patch from commit 1973d1a
meta-ros2-jazzy/recipes-bbappends/ros2-control/controller-manager/0001-add-pal-statistics-library-targets.patch

I updated the patch as follows which worked for me

+From 44385e58d4d02a752432a7992be24980e639982e Mon Sep 17 00:00:00 2001
+From: Amelia Grace <agrace@bastiansolutions.com>
+Date: Fri, 23 Jan 2026 00:32:56 -0700
+Subject: [PATCH] add-pal-statistics-library-targets
+
+Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
+---
+ CMakeLists.txt | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9c3e21865..cceeed1a7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,6 +14,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS
+   hardware_interface
+   libstatistics_collector
+   lifecycle_msgs
++  pal_statistics
+   pluginlib
+   rclcpp
+   realtime_tools
+@@ -53,7 +54,9 @@ target_link_libraries(controller_manager PUBLIC
+                       libstatistics_collector::libstatistics_collector
+                       fmt::fmt
+                       ${std_msgs_TARGETS}
+-                      ${controller_manager_msgs_TARGETS})
++                      ${controller_manager_msgs_TARGETS}
++                      ${pal_statistics_LIBRARIES}
++                      )
+ 
+ add_executable(ros2_control_node src/ros2_control_node.cpp)
+ target_link_libraries(ros2_control_node PRIVATE

however, i do still see a compilation issue with hardware-interface on my end as reported in #1635 (comment) . after applying the patch that I posted, i can build hardware-interface and thus ros2-control.

@graceagrace
Copy link
Contributor Author

Thanks @chkohn! Once again, I'm guilty of having a patch in my local tree that fixed the issue with hardware-interface. In my case, I went after pal-statistics and changed how it was exporting its include paths to solve the build error with hardware-interface, but I think the solution you proposed above is cleaner, so that's what I committed.

De-fuzz patch to add pal-statistics library target for controller-manager and implement alternative fix for hardware-interface build path contamination

Signed-off-by: Amelia Grace <agrace@bastiansolutions.com>
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.

3 participants