[ROS 2] Correclty export class_loader library #129
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a bug that prevents building composable nodes using the ROS 2 dashing debian packages.
Before this PR
ament_export_libraries(class_loader)
is called before the libraryclass_loader
is created. This causes a check in ament_export_libraries to determine that the name is not a target, and so it callsament_export_library_names(class_loader)
. That causes the nameclass_loader
to be stored in_exported_library_names
instead of_exported_libraries
. Plain library names are searched usingfind_library()
without any PATHS. This fails.Packages that
find_package(rclcpp_components)
emit a cmake warning like:and fail to build composable nodes with linker errors
This PR fixes it by moving the call to
ament_export_libraries()
to after where the target is created. That changes the logic downstream packages use tofind_library(class_loader)
to be one that specifies paths toclass_loader
's lib directory.I have no idea why the build farm didn't catch this. I think I would have expected this job to be failing but it's not. Something is causing
find_library(class_loader)
to succeed in the build farm, but not when I as a user dofind_package(rclcpp_components)
. The library path is/opt/ros/dashing/lib/libclass_loader.so
, so maye a different package is adding/opt/ros/dashing/lib
toCMAKE_LIBRARY_PATH
in it's<project>Config.cmake
?Also, the logic in
ament_export_libraries()
should probably be moved to the package hook. I'll make a separate PR for that.I think it might also be the cause of https://answers.ros.org/question/327691/building-components-from-clion-doesnt-work/