ApexAI / rules_ros

ROS 2 rules for Bazel
Apache License 2.0
42 stars 8 forks source link

Building @rules_ros//examples/bazel_simple_example:publisher fails #1

Open ahans opened 1 year ago

ahans commented 1 year ago

After setting up a local workspace as described in README.md, building a "real" example that depends on ROS packages fails:


$ bazel build @rules_ros//examples/bazel_simple_example:publisher
DEBUG: Rule 'rules_ros' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "f610ed1c39440488dacbc8236d3d3bc7c4ceafb8", shallow_since = "1666309757 +0900" and dropping ["branch"]
DEBUG: Repository rules_ros instantiated at:
  /home/ahans/src/apexai-ros-bazel/WORKSPACE:9:15: in <toplevel>
Repository rule git_repository defined at:
  /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:10:10: Loading: @ament.ament_index
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:25:10: Loading: @eProsima.Fast-CDR
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:39:10: Loading: @eProsima.Fast-DDS
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:53:10: Loading: @eProsima.foonathan_memory_vendor
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:67:10: Loading: @eclipse-cyclonedds.cyclonedds
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:81:10: Loading: @eclipse-iceoryx.iceoryx
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:95:10: Loading: @ros-tooling.libstatistics_collector
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:109:10: Loading: @ros2.common_interfaces
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:123:10: Loading: @ros2.rcl
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:138:10: Loading: @ros2.rcl_interfaces
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:155:10: Loading: @ros2.rcl_logging
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:169:10: Loading: @ros2.rclcpp
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:184:10: Loading: @ros2.rcpputils
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:198:10: Loading: @ros2.rcutils
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:213:10: Loading: @ros2.rmw
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:227:10: Loading: @ros2.ros2_tracing
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:241:10: Loading: @ros2.ros2cli
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:257:10: Loading: @ros2.rosidl
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:279:10: Loading: @ros2.rosidl_dds
DEBUG: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2_config/setup.bzl:293:10: Loading: @ros2.rosidl_typesupport
INFO: Analyzed target @rules_ros//examples/bazel_simple_example:publisher (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/external/ros2.common_interfaces/std_msgs/BUILD.bazel:17:13: Convert bazel-out/k8-fastbuild/bin/external/ros2.common_interfaces/std_msgs/msg/ColorRGBA.msg to idl failed: (Exit 1): msg2idl failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2.rosidl/rosidl_adapter/msg2idl bazel-out/k8-fastbuild/bin/external/ros2.common_interfaces/std_msgs/msg/ColorRGBA.msg

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Traceback (most recent call last):
  File "/home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/sandbox/linux-sandbox/534/execroot/my_first_bazel_ros_workspace/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2.rosidl/rosidl_adapter/msg2idl.runfiles/ros2.rosidl/rosidl_adapter/scripts/msg2idl.py", line 17, in <module>
    from rosidl_adapter.cli import convert_files_to_idl
  File "/home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/sandbox/linux-sandbox/534/execroot/my_first_bazel_ros_workspace/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2.rosidl/rosidl_adapter/msg2idl.runfiles/ros2.rosidl/rosidl_adapter/rosidl_adapter/cli.py", line 27, in <module>
    from rosidl_cli.command.translate.extensions import TranslateCommandExtension
  File "/home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/sandbox/linux-sandbox/534/execroot/my_first_bazel_ros_workspace/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2.rosidl/rosidl_adapter/msg2idl.runfiles/ros2.rosidl/rosidl_cli/rosidl_cli/command/translate/__init__.py", line 19, in <module>
    from .api import translate
  File "/home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/sandbox/linux-sandbox/534/execroot/my_first_bazel_ros_workspace/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2.rosidl/rosidl_adapter/msg2idl.runfiles/ros2.rosidl/rosidl_cli/rosidl_cli/command/translate/api.py", line 19, in <module>
    from .extensions import load_translate_extensions
  File "/home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/sandbox/linux-sandbox/534/execroot/my_first_bazel_ros_workspace/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2.rosidl/rosidl_adapter/msg2idl.runfiles/ros2.rosidl/rosidl_cli/rosidl_cli/command/translate/extensions.py", line 15, in <module>
    from rosidl_cli.extensions import Extension
  File "/home/ahans/.cache/bazel/_bazel_ahans/03b645b18a5c7ac5e50e5ab4c2bbab7d/sandbox/linux-sandbox/534/execroot/my_first_bazel_ros_workspace/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/ros2.rosidl/rosidl_adapter/msg2idl.runfiles/ros2.rosidl/rosidl_cli/rosidl_cli/extensions.py", line 20, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'
Target @rules_ros//examples/bazel_simple_example:publisher failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.343s, Critical Path: 1.28s
INFO: 25 processes: 25 internal.
FAILED: Build did NOT complete successfully
kilian-funk commented 1 year ago

We are still missing some parts of the middleware. Coming soon.

willcbaker commented 1 year ago

+1 subscribed. I have seemed to run into a different issue:

fatal error: rosgraph_msgs/msg/detail/clock__rmw_cyclonedds_cpp.h: No such file or directory
   10 | #include "rosgraph_msgs/msg/detail/clock__rmw_cyclonedds_cpp.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I have created a repo to help those interested in trying to reproduce. https://github.com/willcbaker/ros2_bazel The project uses a osrf/ros:humble-deskptop container with bazel v5.3.2 and the WORKSPACE file as instructed in https://github.com/ApexAI/rules_ros#workspace-setup

ZhenshengLee commented 5 months ago

We are still missing some parts of the middleware. Coming soon.

Friendly ping for updates @kilian-funk