# Adding Bazel as an official alternative build system for ROS2 Iron?

**URL:** <https://discourse.openrobotics.org/t/adding-bazel-as-an-official-alternative-build-system-for-ros2-iron/28476>\
**Category:** ROS General\
**Tags:** ros2, wg-safety-critical, iron\
**Created:** [November 23, 2022, 9:28am UTC](https://discourse.openrobotics.org/t/adding-bazel-as-an-official-alternative-build-system-for-ros2-iron/28476 "2022-11-23T09:28:32Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![sloretz](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/sloretz/32/23113_2.png) [@sloretz](https://discourse.openrobotics.org/u/sloretz)\
**Post date:** [November 23, 2022, 5:15pm UTC](https://discourse.openrobotics.org/t/adding-bazel-as-an-official-alternative-build-system-for-ros2-iron/28476/6 "2022-11-23T17:15:11Z")

</div>

Another option: [drake-ros/bazel\_ros2\_rules at main · RobotLocomotion/drake-ros · GitHub](https://github.com/RobotLocomotion/drake-ros/tree/main/bazel_ros2_rules)

To use this option you add a repository rule to your `WORKSPACE` file that points to a ROS workspace. This can be a system install of ROS like `/opt/ros/<distro>` or a tarball. Your targets can then depend on packages in that ROS workspace with labels like `@ros2//:rclcpp_cc`, or `@ros2//:visualization_msgs_py`, etc.

You don’t have to rewrite the build system for packages using ROS 2; however, if you want “reproducible” and “traceable” you’re responsible for building and hosting your own tarball somewhere. Further, the ROS packages are going to depend on system dependencies, which -if I understand correctly- isn’t “hermetic” or “traceable” in bazel.

---

_[View the full topic](https://discourse.openrobotics.org/t/adding-bazel-as-an-official-alternative-build-system-for-ros2-iron/28476)._
