maliput / drake_ros_buildfarm

ROS packaging for building Drake into the ros_buildfarm
0 stars 0 forks source link

Determine the required version of Bazel to build Drake selected version #2

Closed j-rivero closed 1 year ago

j-rivero commented 1 year ago

Part of #1

The top level CMakeLists.txt in Drake 1.12 code declares a minimum version for Bazel of 3.0. This should not be a problem for Ubuntu Jammy since the bazel-bootstrap package is in version 3.5.1.

While I was testing the build of Drake using 3.5.1 I have discovered a discrepancy with Bazel top level WORKSPACE file that declares a dependency of Bazel in 4.0. Build fails:

#13 2.754 Starting local Bazel server and connecting to it...
#13 5.020 Loading: 
#13 5.029 Loading: 0 packages loaded
#13 6.068 Loading: 0 packages loaded
#13 7.071 Loading: 0 packages loaded
#13 7.511 ERROR: Traceback (most recent call last):
#13 7.511   File "/drake-1.12.0/WORKSPACE", line 22, column 15, in <toplevel>
#13 7.511       versions.check(minimum_bazel_version = "4.0")
#13 7.511   File "/home/buildfarm/.cache/bazel/_bazel_/b6ff13812797f14f8237d5cb6219a28f/external/bazel_skylib/lib/versions.bzl", line 105, column 13, in _check_bazel_version
#13 7.511       fail("Current Bazel version is {}; expected at least {}".format(
#13 7.511 Error in fail: Current Bazel version is 3.5.1- (@non-git); expected at least 4.0
#13 7.923 ERROR: error loading package 'external': Package 'external' contains errors
#13 7.947 INFO: Elapsed time: 5.114s
#13 7.957 INFO: 0 processes.
#13 7.957 FAILED: Build did NOT complete successfully (0 packages loaded)
#13 7.959 FAILED: Build did NOT complete successfully (0 packages loaded)
#13 7.959 make[2]: *** [CMakeFiles/drake_cxx_python.dir/build.make:86: drake_cxx_pytho

If I tried to relax the dependency in WORKSPACE to match the 3.0, then the code does not build with problems related to env in py_test which seems a feature introduced in Bazel 4.0

#15 7.273 Loading: 0 packages loaded
#15 7.273     currently loading:
#15 7.424 ERROR: /drake-1.12.0/BUILD.bazel:72:13: //:py/install_test: no such attribute 'env' in 'py_test' rule
#15 7.629 ERROR: error loading package '': Package '' contains errors
#15 7.654 INFO: Elapsed time: 5.655s
#15 7.663 INFO: 0 processes.
#15 7.664 FAILED: Build did NOT complete successfully (1 packages loaded)
#15 7.668 FAILED: Build did NOT complete successfully (1 packages loaded)
#15 7.670 make[2]: *** [CMakeFiles/drake_cxx_python.dir/build.make:86: drake_cxx_python-prefix/src/drake_cxx_python-stamp/drake_cxx_python-build] Error 1
j-rivero commented 1 year ago

Looking into the drake changes related to this, https://github.com/RobotLocomotion/drake/pull/15711 confirms that the required version of Bazel is 4.0.0.