GithubHelp home page GithubHelp logo

mvukov / rules_ros2 Goto Github PK

View Code? Open in Web Editor NEW
80.0 6.0 45.0 794 KB

Build ROS 2 with Bazel

License: Apache License 2.0

Starlark 69.22% Python 16.60% Smarty 2.98% C++ 10.50% Shell 0.09% Rust 0.60%
robotics bazel ros2 robot-operating-system ros-2

rules_ros2's People

Contributors

ahans avatar ankit-agarwal1999 avatar dbruggner avatar ericcousineau-tri avatar evanliuav avatar getim avatar henriksod avatar kgreenek avatar kylestach avatar lalten avatar matzipan avatar mvukov avatar renovate[bot] avatar samehmohamed88 avatar sanjaer avatar thomasegriffith avatar woutervdstoel avatar ziye-dm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rules_ros2's Issues

[feature request] README file

This looks like an awesome project! If I find some time I'd love to help get more of ros2 running within bazel!

Wondering if you'd consider adding a brief README. Some things that may be helpful:

  • A list of which things are supported or not supported currently
  • Any expectations you have for contributions, like style or format of PRs
  • Maybe a quick demo of the project, or a reference to the example already present in the repo and how one could reproduce it (like a command)

Foxglove bridge Build error

 Linking third_party/foxglove_bridge/foxglove_bridge_node failed: (Exit 1): gcc failed: error executing command (from target //third_party/foxglove_bridge:foxglove_bridge_node) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/third_party/foxglove_bridge/foxglove_bridge_node-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_set_blocking'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_handshake'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_hostkey_hash'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_hostkey_hash'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_knownhost_free'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_agent_disconnect'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_agent_free'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_free'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_channel_free'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_disconnect_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_channel_free'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_channel_wait_closed'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_channel_wait_eof'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_channel_send_eof'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_scp_recv2'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_scp_send64'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_symlink_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_readdir_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_mkdir_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_open_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_seek64'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_close_handle'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_close_handle'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_shutdown'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_open_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_close_handle'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_stat_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_init'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_userauth_keyboard_interactive_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_agent_list_identities'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_agent_connect'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_agent_get_identity'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_userauth_password_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_userauth_publickey_fromfile_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_userauth_list'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_symlink_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_stat_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_unlink_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_rmdir_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_rename_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_mkdir_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_statvfs'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_stat_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_stat_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_symlink_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_seek64'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_hostkey'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_agent_userauth'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_open_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_errno'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_errno'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_error'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_userauth_authenticated'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_knownhost_get'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_method_pref'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_errno'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_last_errno'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_session_hostkey'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_knownhost_checkp'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_knownhost_add'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_knownhost_writefile'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_agent_init'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_sftp_seek64'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_knownhost_del'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_statemach_act: error: undefined reference to 'libssh2_version'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_attach: error: undefined reference to 'libssh2_session_abstract'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_block_statemach.constprop.0: error: undefined reference to 'libssh2_session_block_directions'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function scp_send: error: undefined reference to 'libssh2_channel_write_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function scp_send: error: undefined reference to 'libssh2_session_block_directions'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_done: error: undefined reference to 'libssh2_session_block_directions'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function scp_recv: error: undefined reference to 'libssh2_channel_read_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function scp_recv: error: undefined reference to 'libssh2_session_block_directions'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function sftp_recv: error: undefined reference to 'libssh2_sftp_read'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function sftp_send: error: undefined reference to 'libssh2_sftp_write'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_connect: error: undefined reference to 'libssh2_session_init_ex'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_connect: error: undefined reference to 'libssh2_knownhost_init'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_connect: error: undefined reference to 'libssh2_knownhost_readfile'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_connect: error: undefined reference to 'libssh2_session_flag'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_connect: error: undefined reference to 'libssh2_session_callback_set'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_connect: error: undefined reference to 'libssh2_session_callback_set'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function ssh_connect: error: undefined reference to 'libssh2_session_free'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function Curl_ssh_init: error: undefined reference to 'libssh2_init'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function Curl_ssh_version: error: undefined reference to 'libssh2_version'
bazel-out/k8-fastbuild/bin/external/curl/curl/lib/libcurl.a(libssh2.c.o):libssh2.c:function Curl_ssh_cleanup: error: undefined reference to 'libssh2_exit'
collect2: error: ld returned 1 exit status
INFO: Elapsed time: 283.168s, Critical Path: 260.66s
INFO: 2710 processes: 1393 internal, 1317 linux-sandbox.
FAILED: Build did NOT complete successfully

how do i solve this?

Runtime exception when using node->create_generic_subscription

I am trying to use the rclcpp::Node::create_generic_subscription method to create a subscription that does not need to be aware of the type of the message at compile time.

My use-case is a simple data recorder node that takes a list of topics as input via config. It subscribes to all of those topics and dumps them into bag files in a pre-determined directory hierarchy.

Here is a stripped down example repo that reproduces the exception:
https://github.com/kgreenek/rules_ros2_typesupport_bug/blob/main/example/main.cpp#L4

I am getting the following runtime error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Typesupport library for sensor_msgs does not exist in 'example/example_launch_ament_setup'.
/home/kgk/.cache/bazel/_bazel_kgk/25cdd435d42a5ead8f097b62940dbe88/execroot/kgkslam/bazel-out/k8-fastbuild/bin/example/example: line 21: 1052752 Aborted                 (core dumped) AMENT_PREFIX_PATH="${ament_prefix_path}" example/example_impl "$@"

In that repo, you can run bazel run example to see the crash.

Honestly I think it's pretty likely I'm doing something wrong here, but it also seems like it might be an unsupported feature. I'd really appreciate your help!

Possibly use fmt bundled with spdlog

exclude = ["include/spdlog/fmt/*.h"],

This line removes all headers under include/spdlog/fmt/. This means not only fmt.h is removed, but also the following headers:

bin_to_hex.h
chrono.h
compile.h
ostr.h
ranges.h
std.h
xchar.h

Some projects depend on some of these headers. E.g. Micro-XRCE-DDS-Agent:

#include <spdlog/fmt/ostr.h>
#include <spdlog/fmt/bin_to_hex.h>

Suggested fix:

Change L15 in repositories/spdlog.BUILD.bazel to:

exclude = ["include/spdlog/fmt/fmt.h"],

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update dependency pybind11 to v2.13.3
  • chore(deps): update dependency rules_rust to v0.49.3
  • chore(deps): update dependency bazel to v7.3.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

bazel
repositories/repositories.bzl
  • rules_python 0.34.0
  • bazel_skylib 1.7.1
  • spdlog v1.14.1
  • pybind11 v2.13.1
  • rules_foreign_cc 0.11.1
  • googletest v1.15.2
  • tinyxml2 10.0.0
  • nlohmann_json v3.11.3
  • websocketpp 0.8.2
  • boringssl e056e3e52e1dd0e5909fe43d4a684a0c9e96f1f9
  • zstd v1.5.6
  • eigen 3.4.0
  • foxglove_bridge 0.7.9
repositories/rust_setup_stage_1.bzl
  • rules_rust 0.49.2
  • ros2_rust 2e746d6e0d2cbeed811132310c3a8dc2da4f9975
bazelisk
.bazelversion
  • bazel 7.2.1
github-actions
.github/workflows/main.yml
  • actions/checkout v4
  • actions/setup-python v5
  • pre-commit/action v3.0.1
  • actions/checkout v4
  • actions/cache v4.0.2
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
pre-commit
.pre-commit-config.yaml
  • keith/pre-commit-buildifier 6.4.0
  • pre-commit/pre-commit-hooks v4.6.0
  • google/yapf v0.40.2
  • asottile/reorder_python_imports v3.13.0
  • astral-sh/ruff-pre-commit v0.5.7
  • pre-commit/mirrors-clang-format v18.1.8
  • cpplint/cpplint 1.6.1
  • pre-commit/mirrors-prettier v3.1.0

  • Check this box to trigger a request for Renovate to run again on this repository

macOS compilation fails

I understand that this has only been tested on Ubuntu 22.04, and macOS isn't even a particularly well supported target for ROS2, this is more for presenting my findings trying to make this work on a Mac than anything else.

First, the pic_static_library property on Mac isn't set for many static libraries, but this is easily resolved with

if library.pic_static_library == None:

if library.pic_static_library == None and library.static_library == None:

to restore the previous behavior.

After this, we get python linking errors

ERROR: /private/var/tmp/_bazel_xxx/0c6fe4d261a727bb6fbfa1fdc418e921/external/ros2_rcl_interfaces/BUILD.bazel:25:23: Linking external/ros2_rcl_interfaces/builtin_interfaces/libbuiltin_interfaces_s__rosidl_typesupport_c.dylib failed: (Exit 1): sandbox-exec failed: error executing CppLink command 
  (cd /private/var/tmp/_bazel_xxx/0c6fe4d261a727bb6fbfa1fdc418e921/sandbox/darwin-sandbox/97/execroot/com_github_mvukov_rules_ros2 && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
    TMPDIR=/var/folders/r6/xyz_wzyd5tv_0snr3fmtc3lr0000gn/T/ \
    ZERO_AR_DATE=1 \
  /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_xxx/0c6fe4d261a727bb6fbfa1fdc418e921/sandbox/darwin-sandbox/97/sandbox.sb /var/tmp/_bazel_xxx/install/c235141d88c168b049a191acefbb1f54/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_xxx/0c6fe4d261a727bb6fbfa1fdc418e921/sandbox/darwin-sandbox/97/stats.out' external/local_config_cc/cc_wrapper.sh @bazel-out/darwin_arm64-fastbuild/bin/external/ros2_rcl_interfaces/builtin_interfaces/libbuiltin_interfaces_s__rosidl_typesupport_c.dylib-2.params)
Undefined symbols for architecture arm64:
  "_PyCapsule_New", referenced from:
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      ...
  "_PyImport_ImportModule", referenced from:
      _builtin_interfaces__msg__duration__convert_to_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_to_py in _time_s.o
  "_PyLong_AsLong", referenced from:
      _builtin_interfaces__msg__duration__convert_from_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_from_py in _time_s.o
  "_PyLong_AsUnsignedLong", referenced from:
      _builtin_interfaces__msg__duration__convert_from_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_from_py in _time_s.o
  "_PyLong_FromLong", referenced from:
      _builtin_interfaces__msg__duration__convert_to_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_to_py in _time_s.o
  "_PyLong_FromUnsignedLong", referenced from:
      _builtin_interfaces__msg__duration__convert_to_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_to_py in _time_s.o
  "_PyModule_AddObject", referenced from:
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__duration in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      __register_msg_type__msg__time in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
      ...
  "_PyModule_Create2", referenced from:
      _PyInit_builtin_interfaces_s__rosidl_typesupport_c in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
  "_PyObject_CallObject", referenced from:
      _builtin_interfaces__msg__duration__convert_to_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_to_py in _time_s.o
  "_PyObject_GetAttrString", referenced from:
      _builtin_interfaces__msg__duration__convert_from_py in _duration_s.o
      _builtin_interfaces__msg__duration__convert_from_py in _duration_s.o
      _builtin_interfaces__msg__duration__convert_from_py in _duration_s.o
      _builtin_interfaces__msg__duration__convert_from_py in _duration_s.o
      _builtin_interfaces__msg__duration__convert_from_py in _duration_s.o
      _builtin_interfaces__msg__duration__convert_to_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_from_py in _time_s.o
      _builtin_interfaces__msg__time__convert_from_py in _time_s.o
      _builtin_interfaces__msg__time__convert_from_py in _time_s.o
      _builtin_interfaces__msg__time__convert_from_py in _time_s.o
      _builtin_interfaces__msg__time__convert_from_py in _time_s.o
      ...
  "_PyObject_SetAttrString", referenced from:
      _builtin_interfaces__msg__duration__convert_to_py in _duration_s.o
      _builtin_interfaces__msg__duration__convert_to_py in _duration_s.o
      _builtin_interfaces__msg__time__convert_to_py in _time_s.o
      _builtin_interfaces__msg__time__convert_to_py in _time_s.o
  "__Py_Dealloc", referenced from:
      __Py_DECREF in _duration_s.o
      __Py_DECREF in _time_s.o
      __Py_DECREF in _builtin_interfaces_s.ep.rosidl_typesupport_c.o
ld: symbol(s) not found for architecture arm64

So clearly somewhere CPython is not being linked properly, unfortunately I'm not good enough at bazel to really figure out where it went wrong.

Feature request: Support tf2

Title is self-explanatory. I believe this is where the code lies (along with some other geometry-related ros2 libraries):
https://github.com/ros2/geometry2

Is this already on your radar? If not, is this something you would be interested in supporting in this repo, or would it be more appropriate as a separate repo?

Error importing messages different than std_msg

Hi, inside std_msgs there is another folder called detail, that contains the header_struct msg among several others.

For my project I'm using nav_msgs, so I've added rules to build nav_msgs and geometry_msgs (as it depended on them) but now I'm facing this error:


In file included from bazel-out/k8-fastbuild/bin/external/ros2_common_interfaces/cpp_geometry_msgs_cpp/geometry_msgs/msg/accel_with_covariance_stamped__type_support.cpp:7:
bazel-out/k8-fastbuild/bin/external/ros2_common_interfaces/cpp_geometry_msgs_cpp/geometry_msgs/msg/detail/accel_with_covariance_stamped__struct.hpp:19:10: fatal error: std_msgs/msg/detail/header__struct.hpp: No such file or directory
   19 | #include "std_msgs/msg/detail/header__struct.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I think maybe this block inside common_interfaces.BUILD.bazel isn't accounting for subfolders inside std_msgs?

ros2_interface_library(
    name = "std_msgs",
    srcs = glob(["std_msgs/msg/*.msg"]),
    deps = ["@ros2_rcl_interfaces//:builtin_interfaces"],
    visibility = ["//visibility:public"],
)

thanks in advance!

Running ros2_bag target gives: ModuleNotFoundError: No module named 'ros2cli.cli'

Full error:

INFO: Running command line: bazel-bin/romalcpp/rosbag --help
Traceback (most recent call last):
  File "/home/kgk/.cache/bazel/_bazel_kgk/005c1a8f9988f2707370ff28b6b79f1c/execroot/__main__/bazel-out/k8-fastbuild/bin/romalcpp/rosbag.runfiles/__main__/romalcpp/rosbag_launch.py", line 4, in <module>
    import ros2.ros2_cmd
  File "/home/kgk/.cache/bazel/_bazel_kgk/005c1a8f9988f2707370ff28b6b79f1c/execroot/__main__/bazel-out/k8-fastbuild/bin/romalcpp/rosbag.runfiles/com_github_mvukov_rules_ros2/ros2/ros2_cmd.py", line 17, in <module>
    import ros2cli.cli
ModuleNotFoundError: No module named 'ros2cli.cli'

When I inspect the runfiles for the rosbag target, I noticed that the ros2cli is nested several times for some reason. Here is a snippet of the directory structure:

$ tree bazel-bin/romalcpp/rosbag.runfiles/ros2cli/
$ ๏„• ros2cli
โ”œโ”€โ”€ ๎˜† __init__.py
โ””โ”€โ”€ ๏„• ros2cli
    โ”œโ”€โ”€ ๎˜† __init__.py
    โ””โ”€โ”€ ๏„• ros2cli
        โ”œโ”€โ”€ ๏’ __init__.py โ‡’ /home/kgk/.cache/bazel/_bazel_kgk/005c1a8f9988f2707370ff28b6b79f1c/external/ros2cli/ros2cli/ros2cli/__init__.py
        โ”œโ”€โ”€ ๏’ cli.py โ‡’ /home/kgk/.cache/bazel/_bazel_kgk/005c1a8f9988f2707370ff28b6b79f1c/external/ros2cli/ros2cli/ros2cli/cli.py

Notice that the cli module that we're trying to import is nested under 3 directories called ros2cli:

bazel-bin/romalcpp/rosbag.runfiles/ros2cli/ros2cli/ros2cli/cli.py

Support running ros2_bag binary from any directory

I ran into another potential snag. I created a bag target like so:

load("@com_github_mvukov_rules_ros2//ros2:bag.bzl", "ros2_bag")

ros2_bag(
    name = "bag",
    idl_deps = [
        "@ros2_common_interfaces//:nav_msgs",
        "@ros2_common_interfaces//:sensor_msgs",
        "@ros2_common_interfaces//:std_msgs",
        "@ros2_rcl_interfaces//:rcl_interfaces",
        "@ros2_rosbag2//:rosbag2_interfaces",
    ],
)

When I run it using bazel, it works as expected. However, when I run it directly from bazel-bin, I get the following error:

$ ./bazel-bin/romalcpp/examples/ros2/bag info [path-to-bagfile]
Traceback (most recent call last):
  File "/home/kgk/src/romalorg/romalcpp/./bazel-bin/romalcpp/examples/ros2/bag.runfiles/__main__/romalcpp/examples/ros2/bag_launch.py", line 25, in <module>
    sys.exit(ros2cli.cli.main(extension=extension))
  File "/home/kgk/src/romalorg/romalcpp/bazel-bin/romalcpp/examples/ros2/bag.runfiles/ros2cli/ros2cli/ros2cli/cli.py", line 46, in main
    extension.add_arguments(parser, script_name)
  File "/home/kgk/src/romalorg/romalcpp/bazel-bin/romalcpp/examples/ros2/bag.runfiles/com_github_mvukov_rules_ros2/ros2/ros2_cmd.py", line 104, in add_arguments
    add_subparsers(parser,
  File "/home/kgk/src/romalorg/romalcpp/bazel-bin/romalcpp/examples/ros2/bag.runfiles/com_github_mvukov_rules_ros2/ros2/ros2_cmd.py", line 86, in add_subparsers
    extension.add_arguments(command_parser, f'{cli_name} {name}')
  File "/home/kgk/src/romalorg/romalcpp/bazel-bin/romalcpp/examples/ros2/bag.runfiles/ros2_rosbag2/ros2bag/ros2bag/verb/info.py", line 24, in add_arguments
    add_standard_reader_args(parser)
  File "/home/kgk/src/romalorg/romalcpp/bazel-bin/romalcpp/examples/ros2/bag.runfiles/ros2_rosbag2/ros2bag/ros2bag/api/__init__.py", line 125, in add_standard_reader_args
    reader_choices = rosbag2_py.get_registered_readers()
RuntimeError: package 'rosbag2_storage' not found, searching: []

Here is the example repository I have been using if that it helpful:
https://github.com/romalorg/romalcpp

Integrating GPSFix msgs

I've been trying to include GPSFix msgs (from this repository) in the rules but I've come to an error I cannot solve.
These are my changes to the code:

repositories/repositories.bzl

    maybe(
        new_git_repository,
        name = "ros2_gps_msgs",
        build_file = "@com_github_mvukov_rules_ros2//repositories:gpsfix_msgs.BUILD.bazel",
        remote = "https://github.com/swri-robotics/gps_umd.git",
        commit = "5cdab23fbdf2e9339e6fc1a282e8507c27d05042",
    )

repositories/gpsfix_msgs.BUILD.bazel (new file)


""" Creates filegroup for GPS msgs
"""

load(
    "@com_github_mvukov_rules_ros2//ros2:interfaces.bzl",
    "cpp_ros2_interface_library",
    "ros2_interface_library",
)

filegroup (
    name = "gps_msgs_fg",
    srcs = glob(["gps_common/msgs/*.msg"]),
    visibility = ["//visibility:public"],
)

ros2_interface_library(
    name = "gps_fix_msgs",
    srcs = glob(["gps_common/msg/*.msg"]),
    deps = ["@ros2_common_interfaces//:std_msgs"],
    visibility = ["//visibility:public"],
)

cpp_ros2_interface_library(
    name = "cpp_gps_fix_msgs",
    deps = [":gps_fix_msgs",],
    visibility = ["//visibility:public"],
)

And only to test that it works:
examples/chatter/BUILD.bazel

cc_binary(
    name = "talker",
    srcs = ["talker.cc"],
    copts = ["-std=c++14"],
    deps = [
        "@ros2_common_interfaces//:cpp_std_msgs",
        "@ros2_gps_msgs//:cpp_gps_fix_msgs",
        "@ros2_rclcpp//:rclcpp",
    ],
    # data = ["@com_github_mvukov_rules_ros2//repositories:gps_msgs_fg"],
)

examples/chatter/talker.cc
#include "gps_fix_msgs/msg/gps_fix.hpp"

But I get the following error:

ERROR: /home/mobuser/.cache/bazel/_bazel_mobuser/97765987578b0036f08a138ab6cbc295/external/ros2_gps_msgs/BUILD.bazel:23:27: Compiling external/ros2_gps_msgs/cpp_gps_fix_msgs_cpp/gps_fix_msgs/msg/gps_fix__type_support.cpp failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 73 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from bazel-out/k8-fastbuild/bin/external/ros2_gps_msgs/cpp_gps_fix_msgs_cpp/gps_fix_msgs/msg/gps_fix__type_support.cpp:7:
bazel-out/k8-fastbuild/bin/external/ros2_gps_msgs/cpp_gps_fix_msgs_cpp/gps_fix_msgs/msg/detail/gps_fix__struct.hpp:19:10: fatal error: gps_fix_msgs/msg/detail/header__struct.hpp: No such file or directory
   19 | #include "gps_fix_msgs/msg/detail/header__struct.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Target //examples/chatter:talker failed to build

That file appears to exist in a close path:

./k8-fastbuild/bin/external/ros2_gps_msgs/cpp_gps_fix_msgs_cpp/std_msgs/msg/detail/header__struct.hpp
./k8-fastbuild/bin/external/ros2_common_interfaces/cpp_std_msgs_cpp/std_msgs/msg/detail/header__struct.hpp
./k8-fastbuild/bin/external/ros2_common_interfaces/std_msgs/msg/detail/header__struct.hpp

Any idea on how can this be solved? thanks in advance!

bag play command segfaults

Steps to reproduce:

cd [path to rules_ros2 repo]/examples
bazel build chatter/...

# It is necessary to run the bag command from the runfiles directory.
# See: [#96](https://github.com/mvukov/rules_ros2/issues/96)
cd ./bazel-out/k8-fastbuild/bin/chatter/bag.runfiles/com_github_mvukov_rules_ros2_examples

./chatter/bag play [path to bag file]

Running the above command results in a segfault. The segfault occurs at the very end of playback just before the bag playback is finished.

Some more context:
Following #96, I created a wrapper script that replaces all relative paths passed to the bag command with absolute paths. The wrapper script then finds the runfiles directory and cd's into it before invoking the underlying bag command.

This is working ok as a work-around except for the bag play command. For some reason the bag play command segfaults.

If I run the same command using bazel run chatter:bag -- play [path to bag file], then it does not segfault. So there seems to be something different about the build environment compared to the environment when running the output binary.

undefined reference to 'idn2_check_version', 'idn2_lookup_ul', 'idn2_XXXXXX'...

Ubuntu 22.04
gcc 11.4.0
I have libidn2-0 and libidn2-0-dev installed

My colleague has the same setup and it builds fine on their machine. My system was installed fresh about a week ago so I doubt anything too weird is going on in my environment.

ERROR: ...external/com_github_mvukov_rules_ros2/third_party/foxglove_bridge/BUILD.bazel:11:16: Linking external/com_github_mvukov_rules_ros2/third_party/foxglove_bridge/foxglove_bridge_node failed: (Exit 1): gcc failed: error executing command (from target @com_github_mvukov_rules_ros2//third_party/foxglove_bridge:foxglove_bridge_node) /usr/bin/gcc @bazel-out/k8-opt/bin/external/com_github_mvukov_rules_ros2/third_party/foxglove_bridge/foxglove_bridge_node-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
...external/curl/lib/idn.c:123: error: undefined reference to 'idn2_check_version'
...external/curl/lib/idn.c:132: error: undefined reference to 'idn2_lookup_ul'
...external/curl/lib/idn.c:153: error: undefined reference to 'idn2_free'
...external/curl/lib/idn.c:136: error: undefined reference to 'idn2_lookup_ul'
...external/curl/lib/idn.c:167: error: undefined reference to 'idn2_free'
...external/curl/lib/idn.c:123: error: undefined reference to 'idn2_check_version'
...external/curl/lib/idn.c:132: error: undefined reference to 'idn2_lookup_ul'
...external/curl/lib/idn.c:136: error: undefined reference to 'idn2_lookup_ul'
...external/curl/lib/idn.c:189: error: undefined reference to 'idn2_free'
collect2: error: ld returned 1 exit status

WORKSPACE.bazel

http_archive(
    name = "com_github_mvukov_rules_ros2",
    sha256 = "2436c86f7830eb6965829db020eb33c41e369401b567aca1a8e0cd1eaf7cb772",
    strip_prefix = "rules_ros2-32d18c6b45897e0e818d1386eb578b21b8a29d7e",
    urls = ["https://github.com/mvukov/rules_ros2/archive/32d18c6b45897e0e818d1386eb578b21b8a29d7e.tar.gz"],
)

load("@com_github_mvukov_rules_ros2//repositories:repositories.bzl", "ros2_repositories")

ros2_repositories()

load("@com_github_mvukov_rules_ros2//repositories:deps.bzl", "ros2_deps")

ros2_deps()

load(
    "@com_github_mvukov_rules_ros2//repositories:pip_annotations.bzl",
    ROS2_PIP_ANNOTATIONS = "PIP_ANNOTATIONS",
)

pip_parse(
    name = "rules_ros2_pip_deps",
    annotations = ROS2_PIP_ANNOTATIONS,
    python_interpreter_target = python_interpreter_target,
    requirements_lock = "@com_github_mvukov_rules_ros2//:requirements_lock.txt",
)

load(
    "@rules_ros2_pip_deps//:requirements.bzl",
    install_rules_ros2_pip_deps = "install_deps",
)

install_rules_ros2_pip_deps()

`//ros2/test/rosbag/...` tests are flaky

โฏ bazel test --runs_per_test 100 //ros2/test/rosbag/...

//ros2/test/rosbag:mcap_tests        FAILED in 10 out of 100 in 2.9s
//ros2/test/rosbag:sqlite3_tests     FAILED in 4 out of 100 in 5.1s

Example log:

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //ros2/test/rosbag:mcap_tests
-----------------------------------------------------------------------------
Running with ROS_DOMAIN_ID 1
[INFO] [launch]: All log files can be found below /home/laurenz/.cache/bazel/_bazel_laurenz/560f8735b75dc5afa81db7c5a8d429bc/sandbox/linux-sandbox/1040/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/testlogs/ros2/test/rosbag/mcap_tests/run_99_of_100/test.outputs/2023-03-08-21-08-18-698721-tpxy-12
[INFO] [launch]: Default logging verbosity is set to INFO
test_recorder (tests.TestRecorder) ... [INFO] [publisher-1]: process started with pid [17]
[INFO] [recorder-2]: process started with pid [19]
[publisher-1] 1678309698.750218 [1]  publisher: selected interface "lo" is not multicast-capable: disabling multicast
[recorder-2] 1678309698.765050 [1]   recorder: selected interface "lo" is not multicast-capable: disabling multicast
[recorder-2] stdin is not a terminal device. Keyboard handling disabled.[INFO] [1678309698.782350883] [rosbag2_recorder]: Press SPACE for pausing/resuming
[recorder-2] [INFO] [1678309698.788707353] [rosbag2_recorder]: Listening for topics...
[recorder-2] [INFO] [1678309698.788757080] [rosbag2_recorder]: Event publisher thread: Starting
[recorder-2] [INFO] [1678309698.891732503] [rosbag2_recorder]: Subscribed to topic '/topic'
[recorder-2] [INFO] [1678309698.891949565] [rosbag2_recorder]: All requested topics are subscribed. Stopping discovery...
[recorder-2] [INFO] [1678309698.989649000] [rosbag2_recorder]: Event publisher thread: Exiting
[INFO] [recorder-2]: process has finished cleanly [pid 19]
[INFO] [publisher-1]: sending signal 'SIGINT' to process[publisher-1]
[publisher-1] [INFO] [1678309699.237376828] [rclcpp]: signal_handler(signum=2)
[INFO] [publisher-1]: process has finished cleanly [pid 17]
FAIL

======================================================================
FAIL: test_recorder (tests.TestRecorder)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/laurenz/.cache/bazel/_bazel_laurenz/560f8735b75dc5afa81db7c5a8d429bc/sandbox/linux-sandbox/1040/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/ros2/test/rosbag/mcap_tests.runfiles/com_github_mvukov_rules_ros2/ros2/test/rosbag/tests.py", line 77, in test_recorder
    self.assertGreaterEqual(bag_metadata['message_count'],
AssertionError: 4 not greater than or equal to 9

----------------------------------------------------------------------
Ran 1 test in 0.486s

FAILED (failures=1)

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

openssl build file incompatible with openssl from rules_boost

rules_boost updated their version of openssl recently, as of this commit:
nelhage/rules_boost@4ab574f

That implementation of the bazel BUILD file for @openssl differs from the BUILD file for openssl that is distributed with rules_ros2. Instead of defining a single target called @openssl//:openssl, they now have @openssl//:ssl (and a couple other targets).

See: https://github.com/hedronvision/boringssl/blob/master/BUILD#L146

I started seeing failures when I had @boost above @rules_ros2 in my WORKSPACE.bazel file.

Runtime error when using rosbag2_cpp

Hi! I am loving this project so far, but I have run into a bit of a snag.

I created a small C++ binary with the goal of reading from a ros2 bag file and writing to a CSV file. However, when I try to run my binary I get the following error:

[ERROR] [1681401142.875500463] [rosbag2_storage]: Unable to create class load instance: Environment variable 'AMENT_PREFIX_PATH' is not set or empty

Here is my BUILD.bazel file:

load("@com_github_mvukov_rules_ros2//ros2:cc_defs.bzl", "ros2_cpp_binary")

ros2_cpp_binary(
    name = "ros2_nav_sat_fix_to_csv",
    srcs = ["main.cpp"],
    deps = [
        "@ros2_rclcpp//:rclcpp",
        "@ros2_rosbag2//:rosbag2_cpp",
        "@ros2_common_interfaces//:cpp_sensor_msgs",
    ],
)

And here is my main.cpp:

#include <fstream>
#include <iostream>

#include "rosbag2_cpp/reader.hpp"
#include "sensor_msgs/msg/nav_sat_fix.hpp"

namespace {

void WriteCsvHeader(std::ofstream& csv_fstream) {
  csv_fstream << "lat,lon" << std::endl;
}

void WriteCsvPosition(std::ofstream& csv_fstream,
                      const sensor_msgs::msg::NavSatFix& nav_sat_fix_msg) {
  csv_fstream << nav_sat_fix_msg.latitude << nav_sat_fix_msg.longitude << std::endl;
}

}  // namespace

int main(int argc, char** argv) {
  if (argc != 3) {
    std::cerr << "Usage: " << argv[0] << " [input bag path] [output csv path]" << std::endl;
    return 1;
  }
  const std::string in_bag_path{argv[1]};
  const std::string out_csv_path{argv[2]};
  rosbag2_cpp::Reader in_bag_reader;
  in_bag_reader.open(in_bag_path);
  std::ofstream csv_fstream{out_csv_path, std::ofstream::out | std::ofstream::trunc};
  if (!csv_fstream) {
    std::cerr << "Could not open output CSV" << std::endl;
    return 1;
  }

  WriteCsvHeader(csv_fstream);
  while (in_bag_reader.has_next()) {
    const auto nav_sat_fix_msg = in_bag_reader.read_next<sensor_msgs::msg::NavSatFix>();
    WriteCsvPosition(csv_fstream, nav_sat_fix_msg);
  }

  return 0;
}

Build fails in bazel 7.x.x

Hi! Thank you for the fantastic project. I am attempting to load it as an external dependency in my bazel 7 environment. I am having some issues with the foreign cc rules:

ERROR: /home/dyershov/.cache/bazel/_bazel_dyershov/dd610be539cf5c8dc491d9d968e644d0/external/cyclonedds/BUILD.bazel:122:6: Error while validating output TreeArtifact File:[[<execution_root>]bazel-out/k8-fastbuild/bin]external/cyclonedds/cyclonedds/include : Failed to resolve relative path ddsc/dds.h inside TreeArtifact /home/dyershov/.cache/bazel/_bazel_dyershov/dd610be539cf5c8dc491d9d968e644d0/execroot/_main/bazel-out/k8-fastbuild/bin/external/cyclonedds/cyclonedds/include. The associated file is either missing or is an invalid symlink.
ERROR: /home/dyershov/.cache/bazel/_bazel_dyershov/dd610be539cf5c8dc491d9d968e644d0/external/cyclonedds/BUILD.bazel:122:6: Foreign Cc - CMake: Building cyclonedds failed: not all outputs were created or valid
Target //ros2/test/launch_pytest:ros2_py_test_rclpy_init_test failed to build

Steps to reporoduce: change bazel version in .bazelversion

Is there a simple fix that I can apply, or is it going to be difficult to use ros2 rules with bazel 7?

Thanks again!

Using `--nolegacy_external_runfiles` will break loading `librmw_cyclonedds.so`

If I add --nolegacy_external_runfiles to my .bazelrc as recommended in https://docs.aspect.build/guides/bazelrc/#performance-options (see below)

# Do not build runfiles symlink forests for external repositories under
# `.runfiles/wsname/external/repo` (in addition to `.runfiles/repo`). This reduces runfiles &
# sandbox creation times & prevents accidentally depending on this feature which may flip to off by
# default in the future. Note, some rules may fail under this flag, please file issues with the rule
# author.
# Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles
build --nolegacy_external_runfiles
run --nolegacy_external_runfiles
test --nolegacy_external_runfiles

Then code depending on rclcpp will fail with

C++ exception with description "failed to initialize rcl init options: failed to load shared library 'external/ros2_rmw_cyclonedds/librmw_cyclonedds.so' due to dlopen error: external/ros2_rmw_cyclonedds/librmw_cyclonedds.so: cannot open shared object file: No such file or directory, at external/ros2_rcutils/src/shared_library.c:99, at external/ros2_rmw_implementation/rmw_implementation/src/functions.cpp:90, at external/ros2_rcl/rcl/src/rcl/init_options.c:75" thrown in the test body.

This seems very related to #57

Unable to communicate talker and listener each other in the chatter example

Hi, I'm struggling with some weird behaviors of rclcpp publisher / subscriber.

In my environment, talker and listener in the chatter example built with rules_ros can't communicate each other.
A message published by the talker is not reached to the chatter.
Regarding the trace log of CycloneDDS, it seems that the chatter can't discovery the talker correctly.
But they work as expected if I transplant them to a new ament/cmake package and build withcolcon.
I also confirmed that ros2 topic command can only communicate with the colcon-built version.

In addition to the behavior above, I'm also experiencing a behavior that subscriber can't subscribe topics published by external ROS packages with non-ROS-common message types.
Let's say that an external package publishes a topic with the message type Foo.
I copied the IDL and buid it with ros2_interface_librarary and friends with rules_ros.
In this case the talker with rules_ros2 can't communicate with listener with colcon.

I investigated this problem by collecting Debug logs of rclcpp and traces of CycloneDDS but couldn't find a clear solution.
Any hints or pointers would be welcome. Thanks.

My environment is as follows:

  • rules_ros2: 53ab709d300e8245edd76da3ec4f4bcdfc8d2123.
  • OS: Ubuntu 22.04
  • System ROS2: humble (rclcpp 16.0.5-2jammy.20230807.154626)

How to build a new plugin using this bazel setup?

Hi,

I wanted to know which bazel rule I have to use if I want to build a nav2_behaviors plugin developed by myself (not the one provided from upstream). I'm using ros2_plugin() bu I'm getting errors. The wait, backup builds fine with the same rule but somehow if I build something different, it fails.

I want to know if my setup is wrong or I'm not using the right rule or missing something.

Thanks.

How to launch a robot_state_publisher node

Many thanks for this excellent work. It's a great contribution.

After building the robot_state_publisher package as below, I am unable to launch its node in a way that's similar to the chatter.py example.

In the chatter.py example I see that you've set

# Provide the rootpath for the node.
executable='chatter/talker',

However since the robot_state_publisher node is a component, it does not have a binary, unlike the static_transform_publisher which provides both and is built in the geometry2.BUILD.bazel.

Please note the bazel for building the robot_state_publisher is a bit messy still.

ros2_cpp_library(
    name = "ros2_robot_localization",
    srcs = glob([
        "src/*.cpp",
    ]),
    hdrs = glob(["include/**/*.hpp",]),
    includes = ["include"],
    visibility = ["//visibility:public"],
    deps = [
        ":cpp_localization_msgs",

        "@ros2_rclcpp//:rclcpp",
        "@ros2_rcutils//:rcutils",

        "@ros2_common_interfaces//:cpp_nav_msgs",
        "@ros2_common_interfaces//:cpp_sensor_msgs",
        "@ros2_common_interfaces//:cpp_std_msgs",
        "@ros2_common_interfaces//:cpp_std_srvs",
        "@ros2_common_interfaces//:cpp_diagnostic_msgs",

        "@ros2_geographic_msgs//:cpp_geographic_msgs",
        "@ros2_common_interfaces//:cpp_geometry_msgs",

        "@ros2_geometry2//:tf2",
        "@ros2_geometry2//:tf2_ros",
        "@ros2_geometry2//:tf2_eigen",
        "@ros2_geometry2//:tf2_geometry_msgs",
        "@ros2_geometry2//:cpp_tf2_msgs",

        "@yaml_cpp",
        "@eigen",
        "@boost",
        "@GeographicLib",
        "@ros2_diagnostics",
        "@ros2_angles",
    ],
)

I then attempted to launch a node from that package using the standard launch file technique

# hard coding the AMENT_PREFIX_PATH for now
os.environ["AMENT_PREFIX_PATH"] = "/home/ubuntu/.cache/bazel/_bazel_ubuntu/e9106c449e78ffee07178e6c7277bb20/external/"
# standard launch file similar to chatter ...
robot_state_publisher_node = launch_ros.actions.Node(
          package='robot_state_publisher',
          executable='robot_state_publisher',
          parameters=[{'robot_description': Command(['xacro ', LaunchConfiguration('model')])}]
      )

and a BUILD file as:

ros2_launch(
    name = "nav2_bot",
    launch_file = "nav2_bot.py",
    nodes = [], # I had to make a change to ros2_launch.bzl to allow empty nodes
    data = [
        "my_world.sdf",
        "nav2_bot_description.urdf",
        "urdf_config.rviz",
    ],
    deps = [
        #"@ros2_robot_state_publisher",
    ]
)

However bazel run //nav2_bot still says the robot_state_publisher package is not found. I called bazel build @ros2_robot_state_publisher it to verify I have that setup correctly and it worked. I can also find it in the bazel output directory as well as it's .so files.

My guess I am missing something simple?

No msg shown in listener logging.

Talker log:
[INFO] [1623070813.542118087] [minimal_publisher]: Publishing: 'Hello, world! 0'
[INFO] [1623070814.042105862] [minimal_publisher]: Publishing: 'Hello, world! 1'
[INFO] [1623070814.542064991] [minimal_publisher]: Publishing: 'Hello, world! 2'
[INFO] [1623070815.042087247] [minimal_publisher]: Publishing: 'Hello, world! 3'
[INFO] [1623070815.542077403] [minimal_publisher]: Publishing: 'Hello, world! 4'
[INFO] [1623070816.042034178] [minimal_publisher]: Publishing: 'Hello, world! 5'
[INFO] [1623070816.542057880] [minimal_publisher]: Publishing: 'Hello, world! 6'
[INFO] [1623070817.042046168] [minimal_publisher]: Publishing: 'Hello, world! 7'
[INFO] [1623070817.542036208] [minimal_publisher]: Publishing: 'Hello, world! 8'
[INFO] [1623070818.042026548] [minimal_publisher]: Publishing: 'Hello, world! 9'
Listener log:
[INFO] [1623070819.042303829] [minimal_subscriber]: I heard: ''
[INFO] [1623070819.542297902] [minimal_subscriber]: I heard: ''
[INFO] [1623070820.042197016] [minimal_subscriber]: I heard: ''
[INFO] [1623070820.542269727] [minimal_subscriber]: I heard: ''

Got msg when talker is publish , but the msgs is empty.

Issue with cross compiling rnw_cyclonedds towards aarch64

Hi, I am using gcc_toolchain to cross compile ros2 nodes towards aarch64 using this repo. I am having an issue with @ros2_rmw_cyclonedds//:rmw_cyclonedds.

How to reproduce:

BAZEL_VERSION=6.2.1

rules_ros2: 89dd5fa0add476e85a438c8575f353ecf6162c57

WORKSPACE
# WORKSPACE

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Toolchain: aarch64-linux-gnueabihf
http_archive(
    name = "aspect_gcc_toolchain",
    sha256 = "8850373f24d3f8bb6e8f36e3e8e7edc93d948964f8f201e920af2c8ffba2002c",
    strip_prefix = "gcc-toolchain-4bd1f94536ee92b7c49673931773038d923ee86e",
    url = "https://github.com/aspect-build/gcc-toolchain/archive/4bd1f94536ee92b7c49673931773038d923ee86e.tar.gz",
)

load("@aspect_gcc_toolchain//toolchain:repositories.bzl", "gcc_toolchain_dependencies")

gcc_toolchain_dependencies()

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")

aspect_bazel_lib_dependencies()

load("@aspect_gcc_toolchain//toolchain:defs.bzl", "ARCHS", "gcc_register_toolchain")

# Register aarch64 toolchain
gcc_register_toolchain(
    name = "gcc_toolchain_aarch64",
    target_arch = ARCHS.aarch64,
)

http_archive(
    name = "com_github_mvukov_rules_ros2",
    sha256 = "c1ff135dd1a6a5c518357285611b1c4de4af6eb9249bf007a21479e35b1a6006",
    strip_prefix = "rules_ros2-89dd5fa0add476e85a438c8575f353ecf6162c57",
    url = "https://github.com/mvukov/rules_ros2/archive/89dd5fa0add476e85a438c8575f353ecf6162c57.tar.gz",
)

load("@com_github_mvukov_rules_ros2//repositories:repositories.bzl", "ros2_repositories")

ros2_repositories()

load("@com_github_mvukov_rules_ros2//repositories:deps.bzl", "PIP_ANNOTATIONS", "ros2_deps")

ros2_deps()

load("@rules_python//python:repositories.bzl", "python_register_toolchains")

python_register_toolchains(
    name = "rules_ros2_python",
    python_version = "3.8.15",
)

load("@rules_python//python:pip.bzl", "pip_parse")
load("@rules_ros2_python//:defs.bzl", python_interpreter_target = "interpreter")

pip_parse(
    name = "rules_ros2_pip_deps",
    annotations = PIP_ANNOTATIONS,
    python_interpreter_target = python_interpreter_target,
    requirements_lock = "@com_github_mvukov_rules_ros2//:requirements_lock.txt",
)

load(
    "@rules_ros2_pip_deps//:requirements.bzl",
    install_rules_ros2_pip_deps = "install_deps",
)

install_rules_ros2_pip_deps()
.bazelrc
# .bazelrc

build --incompatible_default_to_explicit_init_py
build --cxxopt=-std=c++17
build --sandbox_default_allow_network=false
build --incompatible_strict_action_env
build --heap_dump_on_oom
build --noexperimental_check_output_files

build:aarch64 --incompatible_enable_cc_toolchain_resolution
build:aarch64 --platforms=@aspect_gcc_toolchain//platforms:aarch64_linux

Build command:

bazel build --config=aarch64 @ros2_rmw_cyclonedds//:rmw_cyclonedds

Actual result:

ERROR: /home/henrik/.cache/bazel/_bazel_henrik/30c47f5a3d285140f3fa83b1f6b1c678/external/ros2_rmw_cyclonedds/BUILD.bazel:6:16: Linking external/ros2_rmw_cyclonedds/librmw_cyclonedds.so failed: (Exit 1): gcc failed: error executing command (from target @ros2_rmw_cyclonedds//:rmw_cyclonedds) external/gcc_toolchain_aarch64/bin/gcc -shared -o bazel-out/k8-fastbuild/bin/external/ros2_rmw_cyclonedds/librmw_cyclonedds.so ... (remaining 42 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/home/henrik/.cache/bazel/_bazel_henrik/30c47f5a3d285140f3fa83b1f6b1c678/external/gcc_toolchain_aarch64_files/bin/aarch64-linux-ld: /tmp/librmw_cyclonedds.so.p2msOx.ltrans3.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `ddsi_sertype_ops_builtintopic' which may bind externally can not be used when making a shared object; recompile with -fPIC
/tmp/librmw_cyclonedds.so.p2msOx.ltrans3.ltrans.o: in function `new_sertype_builtintopic':
<artificial>:(.text+0x7470): dangerous relocation: unsupported relocation
/home/henrik/.cache/bazel/_bazel_henrik/30c47f5a3d285140f3fa83b1f6b1c678/external/gcc_toolchain_aarch64_files/bin/aarch64-linux-ld: /tmp/librmw_cyclonedds.so.p2msOx.ltrans3.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `ddsi_sertopic_serdata_ops_wrap' which may bind externally can not be used when making a shared object; recompile with -fPIC
/tmp/librmw_cyclonedds.so.p2msOx.ltrans3.ltrans.o: in function `ddsi_sertype_from_sertopic':
<artificial>:(.text+0xa9c4): dangerous relocation: unsupported relocation
...

Expected result:

INFO: Analyzed target @ros2_rmw_cyclonedds//:rmw_cyclonedds (12 packages loaded, 703 targets configured).
INFO: Found 1 target...
Target @ros2_rmw_cyclonedds//:rmw_cyclonedds up-to-date:
  bazel-bin/external/ros2_rmw_cyclonedds/librmw_cyclonedds.so
INFO: Elapsed time: 14.028s, Critical Path: 11.99s
INFO: 13 processes: 1 internal, 12 processwrapper-sandbox.
INFO: Build completed successfully, 13 total action

Workaround:

Tried following the error message and adding -fPIC to copts and CMAKE_C_FLAGS, which did not work.

Patching repositories/cyclonedds.BUILD.bazel back to commit c4a1c00a06692b8553a29e2bc6b869dc611eef45 causes the shared library to compile correctly.

unable to build any python examples

commit : 106a7b615c6bcab0c96ea82d83c53351c6cb182e
command: bazel run //examples/chatter
output:

DEBUG: Rule 'ros2cli' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1663423078 +0200"
DEBUG: Repository ros2cli instantiated at:
  /home/liyou/work/rules_ros2/WORKSPACE:5:18: in <toplevel>
  /home/liyou/work/rules_ros2/repositories/repositories.bzl:331:10: in ros2_repositories
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule new_git_repository defined at:
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in <toplevel>
DEBUG: Rule 'ros2_rosidl' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1622892676 +0200"
DEBUG: Repository ros2_rosidl instantiated at:
  /home/liyou/work/rules_ros2/WORKSPACE:5:18: in <toplevel>
  /home/liyou/work/rules_ros2/repositories/repositories.bzl:45:10: in ros2_repositories
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule new_git_repository defined at:
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in <toplevel>
DEBUG: Rule 'ros2_rosidl_typesupport' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1622921586 +0200"
DEBUG: Repository ros2_rosidl_typesupport instantiated at:
  /home/liyou/work/rules_ros2/WORKSPACE:5:18: in <toplevel>
  /home/liyou/work/rules_ros2/repositories/repositories.bzl:174:10: in ros2_repositories
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule new_git_repository defined at:
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in <toplevel>
DEBUG: Rule 'ros2_rcpputils' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1622921172 +0200"
DEBUG: Repository ros2_rcpputils instantiated at:
  /home/liyou/work/rules_ros2/WORKSPACE:5:18: in <toplevel>
  /home/liyou/work/rules_ros2/repositories/repositories.bzl:70:10: in ros2_repositories
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule new_git_repository defined at:
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in <toplevel>
DEBUG: Rule 'ros2_rmw_implementation' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1622921874 +0200"
DEBUG: Repository ros2_rmw_implementation instantiated at:
  /home/liyou/work/rules_ros2/WORKSPACE:5:18: in <toplevel>
  /home/liyou/work/rules_ros2/repositories/repositories.bzl:86:10: in ros2_repositories
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule new_git_repository defined at:
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in <toplevel>
DEBUG: Rule 'ros2_launch' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1662324633 +0200"
DEBUG: Repository ros2_launch instantiated at:
  /home/liyou/work/rules_ros2/WORKSPACE:5:18: in <toplevel>
  /home/liyou/work/rules_ros2/repositories/repositories.bzl:306:10: in ros2_repositories
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
Repository rule new_git_repository defined at:
  /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/bazel_tools/tools/build_defs/repo/git.bzl:186:37: in <toplevel>
INFO: Analyzed target //examples/chatter:chatter (16 packages loaded, 1037 targets configured).
INFO: Found 1 target...
INFO: From Action external/ros2_rcl_interfaces/statistics_msgs/rosidl_adapter_map.idls:
Reading input file: external/ros2_rcl_interfaces/statistics_msgs/msg/MetricsMessage.msg
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/665/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/statistics_msgs/msg/MetricsMessage.idl
Reading input file: external/ros2_rcl_interfaces/statistics_msgs/msg/StatisticDataPoint.msg
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/665/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/statistics_msgs/msg/StatisticDataPoint.idl
Reading input file: external/ros2_rcl_interfaces/statistics_msgs/msg/StatisticDataType.msg
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/665/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/statistics_msgs/msg/StatisticDataType.idl
INFO: From Action external/ros2_rcl_interfaces/composition_interfaces/rosidl_adapter_map.idls:
Reading input file: external/ros2_rcl_interfaces/composition_interfaces/srv/ListNodes.srv
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/689/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/composition_interfaces/srv/ListNodes.idl
Reading input file: external/ros2_rcl_interfaces/composition_interfaces/srv/LoadNode.srv
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/689/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/composition_interfaces/srv/LoadNode.idl
Reading input file: external/ros2_rcl_interfaces/composition_interfaces/srv/UnloadNode.srv
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/689/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/composition_interfaces/srv/UnloadNode.idl
INFO: From Action external/ros2_rcl_interfaces/lifecycle_msgs/rosidl_adapter_map.idls:
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/msg/State.msg
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/msg/State.idl
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/msg/Transition.msg
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/msg/Transition.idl
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/msg/TransitionDescription.msg
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/msg/TransitionDescription.idl
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/msg/TransitionEvent.msg
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/msg/TransitionEvent.idl
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/srv/ChangeState.srv
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/srv/ChangeState.idl
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/srv/GetAvailableStates.srv
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/srv/GetAvailableStates.idl
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/srv/GetAvailableTransitions.srv
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/srv/GetAvailableTransitions.idl
Reading input file: external/ros2_rcl_interfaces/lifecycle_msgs/srv/GetState.srv
Writing output file: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/682/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/lifecycle_msgs/srv/GetState.idl
ERROR: /home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/external/ros2_rcl_interfaces/BUILD.bazel:57:23: Action external/ros2_rcl_interfaces/rosgraph_msgs/msg/_clock.py failed: (Exit 1): rosidl_generator_py_app failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app ... (remaining 2 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ImportError in template 'external/ros2_rosidl_python/rosidl_generator_py/resource/_msg.py.em': 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray' from partially initialized module 'numpy.core' (most likely due to a circular import) (/usr/lib/python3/dist-packages/numpy/core/__init__.py)

ImportError when expanding '_idl.py.em' into 'bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/rosgraph_msgs/msg/_clock.py': 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray' from partially initialized module 'numpy.core' (most likely due to a circular import) (/usr/lib/python3/dist-packages/numpy/core/__init__.py)

Error processing idl file: bazel-out/k8-fastbuild/bin/external/ros2_rcl_interfaces/rosgraph_msgs/msg/Clock.idl
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
ImportError: cannot import name 'multiarray' from partially initialized module 'numpy.core' (most likely due to a circular import) (/usr/lib/python3/dist-packages/numpy/core/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/ros2_rosidl_python/rosidl_generator_py_app.py", line 40, in <module>
    sys.exit(main())
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/ros2_rosidl_python/rosidl_generator_py_app.py", line 36, in main
    return generate_py(args.generator_arguments_file, args.typesupport_impls.split(';'))
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/ros2_rosidl_python/rosidl_generator_py/rosidl_generator_py/generate_py_impl.py", line 61, in generate_py
    generate_files(generator_arguments_file, mapping)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/ros2_rosidl/rosidl_cmake/rosidl_cmake/__init__.py", line 96, in generate_files
    raise(e)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/ros2_rosidl/rosidl_cmake/rosidl_cmake/__init__.py", line 87, in generate_files
    expand_template(
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/ros2_rosidl/rosidl_cmake/rosidl_cmake/__init__.py", line 149, in expand_template
    interpreter.string(template_content, template_path, locals=data)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2391, in string
    self.safe(scanner, True, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2401, in safe
    self.parse(scanner, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2421, in parse
    token.run(self, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 1547, in run
    self.subrun(info[0][1], interpreter, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 1631, in subrun
    token.run(interpreter, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2596, in execute
    _exec(statements, self.globals, locals)
  File "<string>", line 2, in <module>
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/ros2_rosidl/rosidl_cmake/rosidl_cmake/__init__.py", line 198, in _expand_template
    interpreter.string(content, str(template_path), kwargs)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2391, in string
    self.safe(scanner, True, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2401, in safe
    self.parse(scanner, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2421, in parse
    token.run(self, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2596, in execute
    _exec(statements, self.globals, locals)
  File "<string>", line 3, in <module>
  File "/usr/lib/python3/dist-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib/python3/dist-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python3/dist-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib/python3/dist-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib/python3/dist-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray' from partially initialized module 'numpy.core' (most likely due to a circular import) (/usr/lib/python3/dist-packages/numpy/core/__init__.py)

Exception ignored in: <function Interpreter.__del__ at 0x7f038772c040>
Traceback (most recent call last):
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2094, in __del__
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2157, in shutdown
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2647, in finalize
  File "/home/liyou/.cache/bazel/_bazel_liyou/e75e8ec54e95eaef5eea312839932295/sandbox/linux-sandbox/674/execroot/com_github_mvukov_rules_ros2/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app.runfiles/rules_ros2_pip_deps_empy/site-packages/em.py", line 2200, in push
AttributeError: '_io.TextIOWrapper' object has no attribute 'push'
Target //examples/chatter:chatter failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/liyou/work/rules_ros2/examples/chatter/BUILD.bazel:38:12 Middleman _middlemen/examples_Schatter_Schatter-runfiles failed: (Exit 1): rosidl_generator_py_app failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2_rosidl_python/rosidl_generator_py_app ... (remaining 2 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
INFO: Elapsed time: 49.644s, Critical Path: 1.53s
INFO: 108 processes: 81 internal, 27 linux-sandbox.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

RMW_LIBRARY_PATH patch creates issues when running without Bazel

The rmw_implementation_library_path.patch creates a nice experience when running via bazel, but it creates a lot of unecessary annoyance when running without. For example, it causes the node processes to look for the rmw lib in external/ros2_rmw_cyclonedds/librmw_cyclonedds.so.

I'm looking to improve this system a bit. Which solution would be acceptable for you?

What if I change the patch to first check at RMW_LIBRARY_PATH and if it's not there fall back to the normal code?

Failed to load shared library

Hi, I love the idea of this project. I've been trying to use it but when everything is built I get the following error when trying to run the examples:

terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
what(): failed to initialize rcl init options: failed to load shared library 'external/ros2_rmw_cyclonedds/librmw_cyclonedds.so' due to LoadLibrary error: external/ros2_rmw_cyclonedds/librmw_cyclonedds.so: cannot open shared object file: No such file or directory, at external/ros2_rcutils/src/shared_library.c:84, at external/ros2_rmw_implementation/rmw_implementation/src/functions.cpp:90, at external/ros2_rcl/rcl/src/rcl/init_options.c:61
Aborted (core dumped)

Is there any documentation where I can check the proper usage of this rules for bazel?
Thanks in advance

ros2_ament_setup breaks when adding data dep to ros2_launch

Just tried to update rules_ros2 from 013c02f to 345ec1f, but it looks like there is a regression where data deps must be valid deps as well:

load("@com_github_mvukov_rules_ros2//ros2:launch.bzl", "ros2_launch")
ros2_launch(
    name = "mynode_launch",
    data = ["config/the_config.yaml"],
    launch_file = "launch/my_launch.py",
    nodes = [":my_node"],
)

ERROR: /home/user/repo/package/BUILD:32:12: in deps attribute of ros2_ament_setup rule //package:mynode_launch_launch_ament_setup: source file '//package:config/the_config.yaml' is misplaced here (expected no files). Since this rule was created by the macro 'ros2_launch', the error might have been caused by the macro implementation

The config yaml file path is used in the launch_ros.actions.node.Node parameters argument.

`ros2_interface_library` generate wrong message include path for action and srv

I created a minimal repro at https://github.com/zhuhaow/ros2-bazel-message-error-demo/

When running bazel build --keep_going //..., we will get error

ERROR: /home/zhuhaow/demo/example/BUILD.bazel:57:17: Compiling example/example_action.cpp failed: (Exit 1): gcc failed: error executing CppCompile command (from target //example:example_action_lib) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++14' -MD -MF ... (remaining 195 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from bazel-out/k8-fastbuild/bin/example/example_action/action/example.hpp:7,
                 from example/example_action.cpp:1:
bazel-out/k8-fastbuild/bin/example/example_action/action/detail/example__struct.hpp:20:10: fatal error: example_action/msg/detail/example__struct.hpp: No such file or directory
   20 | #include "example_action/msg/detail/example__struct.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
ERROR: /home/zhuhaow/demo/example/BUILD.bazel:46:17: Compiling example/example_srv.cpp failed: (Exit 1): gcc failed: error executing CppCompile command (from target //example:example_srv_lib) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++14' -MD -MF ... (remaining 181 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from bazel-out/k8-fastbuild/bin/example/example_srv/srv/example.hpp:7,
                 from example/example_srv.cpp:1:
bazel-out/k8-fastbuild/bin/example/example_srv/srv/detail/example__struct.hpp:20:10: fatal error: example_srv/msg/detail/example__struct.hpp: No such file or directory
   20 | #include "example_srv/msg/detail/example__struct.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

The problem seems like the message header should be example_msg/msg/detail/example__struct.hpp but somehow it is generated as the target depends on it {TARGET_NAME}/msg/detail/example__struct.hpp.

Plugin registration doesn't work with clang compiler

If you have clang set up as default compiler, or explicitly force it in .bazelrc like

build --repo_env=CC=clang
build --repo_env=CXX=clang++

Then bazel test //... in this repo will fail.

Here is one test output that shows the issue:

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //ros2/test/image_common:image_transport_plugins_tests
-----------------------------------------------------------------------------
Running main() from gmock_main.cc
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from TestImageTransportPlugins
[ RUN      ] TestImageTransportPlugins.WhenRawPluginsAvailable_EnsurePublisherPluginCanBeLoaded
unknown file: Failure
C++ exception with description "MultiLibraryClassLoader: Could not create object of class type image_transport::RawPublisher as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()" thrown in the test body.
[  FAILED  ] TestImageTransportPlugins.WhenRawPluginsAvailable_EnsurePublisherPluginCanBeLoaded (16 ms)
[ RUN      ] TestImageTransportPlugins.WhenRawPluginsAvailable_EnsureSubscriberPluginCanBeLoaded
unknown file: Failure
C++ exception with description "MultiLibraryClassLoader: Could not create object of class type image_transport::RawSubscriber as no factory exists for it. Make sure that the library exists and was explicitly loaded through MultiLibraryClassLoader::loadLibrary()" thrown in the test body.
[  FAILED  ] TestImageTransportPlugins.WhenRawPluginsAvailable_EnsureSubscriberPluginCanBeLoaded (16 ms)
[----------] 2 tests from TestImageTransportPlugins (32 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (32 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] TestImageTransportPlugins.WhenRawPluginsAvailable_EnsurePublisherPluginCanBeLoaded
[  FAILED  ] TestImageTransportPlugins.WhenRawPluginsAvailable_EnsureSubscriberPluginCanBeLoaded

 2 FAILED TESTS

Running --spawn_strategy=local

Hi, for validation purposes I need to run this repo with --spawn_strategy=local. However it breaks the dependencies:


$ bazelisk run --spawn_strategy=local //examples/chatter:talker
Starting local Bazel server and connecting to it...
INFO: Analyzed target //examples/chatter:talker (64 packages loaded, 1703 targets configured).
INFO: Found 1 target...
ERROR: /home/mobuser/.cache/bazel/_bazel_mobuser/c9f305f88dd2169115dab55cd07eb97d/external/ros2_rmw_cyclonedds/BUILD.bazel:4:10: Compiling rmw_cyclonedds_cpp/src/rmw_node.cpp failed: undeclared inclusion(s) in rule '@ros2_rmw_cyclonedds//:rmw_cyclonedds':
this rule is missing dependency declarations for the following files included by 'rmw_cyclonedds_cpp/src/rmw_node.cpp':
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/gid.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/gid__struct.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/gid__builder.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/gid__traits.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/node_entities_info.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/node_entities_info__struct.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/node_entities_info__builder.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/node_entities_info__traits.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/participant_entities_info.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/participant_entities_info__struct.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/participant_entities_info__builder.hpp'
  'bazel-out/k8-fastbuild/bin/external/ros2_rmw_dds_common/rmw_dds_common/msg/detail/participant_entities_info__traits.hpp'
Target //examples/chatter:talker failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 17.207s, Critical Path: 4.56s
INFO: 39 processes: 4 internal, 35 local.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Any idea on why this might happen and how can it be fixed?

Unable to build using Zig hermetic toolchain (linker cannot find library -latomic)

Hi, thanks for your work on this, it is overall a great library.

We are using Uber's hermetic CC toolchain to compile and are unable to get simple python scripts depending on rclpy to build. A minimal reproduction can be found here: https://github.com/tervay-bdai/zig-linking-repro

$ bazelisk run //src:ex

INFO: Analyzed target //src:ex (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/jtervay/.cache/bazel/_bazel_jtervay/2ba880a27a7b10a0e8a3abfc5bd990ba/external/ros2_rclpy/BUILD.bazel:11:16: Linking external/ros2_rclpy/rclpy/rclpy/_rclpy_pybind11.so failed: (Exit 1): c++ failed: error executing command (from target @ros2_rclpy//:rclpy/rclpy/_rclpy_pybind11.so) external/zig_sdk/tools/x86_64-linux-gnu.2.34/c++ -shared -o bazel-out/k8-fastbuild-ST-35841e508e03/bin/external/ros2_rclpy/rclpy/rclpy/_rclpy_pybind11.so ... (remaining 59 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ld.lld: error: unable to find library -latomic
Target //src:ex failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.504s, Critical Path: 0.30s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target

I am truthfully not sure if this problem lies within the toolchain or within rules_ros2. It seems that when building with this toolchain, it's not able to find the atomic library, even though mentions of it seem to be found in the generated bazel directories.

The line from rules_ros2 causing the problem is here:

I've tried patching the flag out, but it results in an illegal operation runtime error, so I assume the flag is actually required and patching it out doesn't actually solve anything.

Guidance would be appreciated here, if any; I can also file an issue on the Zig toolchain repo but again, I'm not sure where the problem actually is.

[question] ROS2 Nodes

Hello, thanks so much for making this project! I have a question:

How did you figure out the minimum set of nodes/packages required to "bazelify" Foxy?

I'm trying to do a similar project, except with Buck and with ROS2 Humble, and have been making use of the colcon graph output to figure out the dependency graph, but I'm unsure of which packages I can get rid of.

Thanks for any help!
#question

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.