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

ROS2 Missing ament_export_target in diagnostic_aggregation CMake #236

Closed
AzaelCicero opened this issue Sep 17, 2022 · 2 comments
Closed
Labels
ros2 PR tackling a ROS2 branch

Comments

@AzaelCicero
Copy link

I am writing my own plugin for the diagnostic and I needed to call StatusItem::toStatusMsg https://github.com/ros/diagnostics/blob/galactic/diagnostic_aggregator/include/diagnostic_aggregator/status_item.hpp#L222-L224

I was getting a linking error:

/usr/bin/ld: libas_monitor_analyzers_lib.so: undefined reference to `diagnostic_aggregator::StatusItem::toStatusMsg(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool) const'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/as_monitor_analyzers_test.dir/build.make:210: as_monitor_analyzers_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/as_monitor_analyzers_test.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

The issue is that CMake does not export the diagnostic_aggregator library: https://github.com/ros/diagnostics/blob/galactic/diagnostic_aggregator/CMakeLists.txt#L158-L164

It should look like this:

ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_libraries(${PROJECT_NAME})

Is it by design?

@g-gemignani g-gemignani added the ros2 PR tackling a ROS2 branch label Sep 19, 2022
@RFRIEDM-Trimble
Copy link
Contributor

RFRIEDM-Trimble commented Nov 16, 2022

This PR added that line for ament_export_targets. ament_export_libraries is not needed if you use ament_export_targets according to this.

I think this issue can be closed.

@ct2034
Copy link
Collaborator

ct2034 commented Nov 21, 2022

I agree. I think we can close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ros2 PR tackling a ROS2 branch
Projects
None yet
Development

No branches or pull requests

5 participants