From 6669cba31033819d1694fa6ccd503339c1de502a Mon Sep 17 00:00:00 2001 From: "Tomoya.Fujita" Date: Sat, 13 Dec 2025 12:01:22 +0900 Subject: [PATCH] remove ament_export_link_flags() for atomic operations. Signed-off-by: Tomoya.Fujita --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5c76b39..4de6f7ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,8 +99,10 @@ target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS}) check_library_exists(atomic __atomic_load_8 "" HAVE_LIBATOMICS) if(HAVE_LIBATOMICS AND NOT WIN32) - # Exporting link flag since it won't pass ament_export_libraries() existence check - ament_export_link_flags("-latomic") + # Link libatomic into rcutils for fault injection atomic operations. + # Don't export it - downstream packages get atomic symbols transitively + # through librcutils.so, avoiding library resolution issues in containerized + # environments. See https://github.com/ros2/rcutils/issues/525 target_link_libraries(${PROJECT_NAME} atomic) endif()