From 6009441b57cc4f5e2deaf855dfa56dc45f201f1d Mon Sep 17 00:00:00 2001 From: Tamaki Nishino Date: Sat, 21 Mar 2026 18:33:49 +0900 Subject: [PATCH] Fix rolling CI failures - Replace ament_target_dependencies with target_link_libraries (removed in rolling ament_cmake) - Use std::shared_ptr for subscription callbacks (rolling deprecated the non-const overload) - Only pass -fcoroutines for GCC (Clang warns on unused flag) --- rclcpp_async/CMakeLists.txt | 5 ++++- rclcpp_async/include/rclcpp_async/co_context.hpp | 2 +- rclcpp_async/include/rclcpp_async/topic_stream.hpp | 4 ++-- rclcpp_async_example/CMakeLists.txt | 7 +++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/rclcpp_async/CMakeLists.txt b/rclcpp_async/CMakeLists.txt index f9cdfa7..3800a7a 100644 --- a/rclcpp_async/CMakeLists.txt +++ b/rclcpp_async/CMakeLists.txt @@ -8,7 +8,10 @@ if(NOT CMAKE_CXX_STANDARD) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations -fcoroutines) + add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations) +endif() +if(CMAKE_COMPILER_IS_GNUCXX) + add_compile_options(-fcoroutines) endif() find_package(ament_cmake REQUIRED) diff --git a/rclcpp_async/include/rclcpp_async/co_context.hpp b/rclcpp_async/include/rclcpp_async/co_context.hpp index 8886054..228c791 100644 --- a/rclcpp_async/include/rclcpp_async/co_context.hpp +++ b/rclcpp_async/include/rclcpp_async/co_context.hpp @@ -186,7 +186,7 @@ class CoContext { auto stream = std::make_shared>(*this); stream->sub_ = node_.template create_subscription( - topic, qos, [s = stream](typename MsgT::SharedPtr msg) { + topic, qos, [s = stream](std::shared_ptr msg) { if (s->closed_) { return; } diff --git a/rclcpp_async/include/rclcpp_async/topic_stream.hpp b/rclcpp_async/include/rclcpp_async/topic_stream.hpp index 160cff2..ba7b2fa 100644 --- a/rclcpp_async/include/rclcpp_async/topic_stream.hpp +++ b/rclcpp_async/include/rclcpp_async/topic_stream.hpp @@ -37,7 +37,7 @@ template class TopicStream { CoContext & ctx_; - std::queue queue_; + std::queue> queue_; std::coroutine_handle<> waiter_; typename rclcpp::Subscription::SharedPtr sub_; bool closed_ = false; @@ -49,7 +49,7 @@ class TopicStream struct NextAwaiter { - using SharedPtr = typename MsgT::SharedPtr; + using SharedPtr = std::shared_ptr; TopicStream & stream; std::stop_token token; diff --git a/rclcpp_async_example/CMakeLists.txt b/rclcpp_async_example/CMakeLists.txt index dce0065..77af2ab 100644 --- a/rclcpp_async_example/CMakeLists.txt +++ b/rclcpp_async_example/CMakeLists.txt @@ -8,7 +8,10 @@ if(NOT CMAKE_CXX_STANDARD) endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations -fcoroutines) + add_compile_options(-Wall -Wextra -Wpedantic -Werror=deprecated-declarations) +endif() +if(CMAKE_COMPILER_IS_GNUCXX) + add_compile_options(-fcoroutines) endif() find_package(ament_cmake REQUIRED) @@ -40,7 +43,7 @@ target_link_libraries(nested_demo rclcpp_async::rclcpp_async add_library(component_demo SHARED src/component_demo.cpp) target_link_libraries(component_demo rclcpp_async::rclcpp_async ${std_msgs_TARGETS} ${std_srvs_TARGETS}) -ament_target_dependencies(component_demo rclcpp_components) +target_link_libraries(component_demo rclcpp_components::component) rclcpp_components_register_node(component_demo PLUGIN "rclcpp_async_example::ComponentDemo" EXECUTABLE component_demo_node)