ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to find dependencies on shared objects in ROS2?

asked 2022-03-31 07:54:30 -0500

ahans gravatar image

I'm trying to build ROS2 nodes using Bazel, similar to what https://github.com/nicolov/ros-bazel has done for ROS1. The core idea there is to use a binary installation (already present in /opt/ros/galactic or fat archive downloaded by Bazel automatically) and crawl that to extract information necessary to create Bazel targets for individual packages.

My basic approach is this:

  • Go over each directory in share.
  • Check its cmake/ament_cmake_export_dependencies-extras.cmake and cmake/ament_cmake_export_libraries-extras.cmake for _exported_dependencies and _exported_libraries, respectively. This way I can find the .so this target exports and other targets it depends on.

This seems to mostly work. However, some dependencies I don't know how to trace. For example, how do I pull in libspdlog.so.1? It looks like this belongs to the package spdlog_vendor, but I don't see that expressed in CMake files or package.xml. Another example is rmw_cyclonedds_cpp. This needs a couple of iceoryx*.so files, but they don't seem to be mentioned anywhere.

For now I work around this by manually providing the missing information, but I would really like to automate the process as much as possible. One thing I considered was running ldd on the libraries and extracting the required info from its output. I'm pretty sure this would work, but I wonder if there's a better way. Any hints? Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-12 08:55:25 -0500

liyou zhou gravatar image

You can try https://github.com/mvukov/rules_ros2. it is based on foxy and has fully pure bazel build files for ROS2. Even msg files are compiled and generated correctly using bazel rules.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-03-31 07:54:30 -0500

Seen: 345 times

Last updated: May 12 '22