From db378a0cc839efc255656c18b894de4b90f20fbe Mon Sep 17 00:00:00 2001 From: William Allen <16820599+williamjallen@users.noreply.github.com> Date: Mon, 23 Jan 2023 11:21:57 -0500 Subject: [PATCH] [setup] Upgrade Bazel to 6.0.0 (#18545) Co-authored-by: William Allen Co-authored-by: Jeremy Nimmer --- .bazeliskrc | 6 +++++- doc/_pages/from_source.md | 8 ++++---- setup/ubuntu/source_distribution/install_prereqs.sh | 6 +++--- tools/skylark/drake_cc.bzl | 10 ++++++++++ tools/wheel/image/provision-base.sh | 2 +- tools/workspace/drake_visualizer/image/provision.sh | 2 +- tools/workspace/dreal/patches/pull18545.patch | 12 ++++++++++++ tools/workspace/dreal/repository.bzl | 1 + 8 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 tools/workspace/dreal/patches/pull18545.patch diff --git a/.bazeliskrc b/.bazeliskrc index 4913d8672069..5fb18181ca1c 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1,3 +1,7 @@ # Keep this version number in sync with the Ubuntu deb installed by # drake/setup/ubuntu/source_distribution/install_prereqs.sh. -USE_BAZEL_VERSION=5.3.1 +# +# These files should also be updated: +# drake/tools/workspace/drake_visualizer/image/provision.sh +# drake/tools/wheel/image/provision-base.sh +USE_BAZEL_VERSION=6.0.0 diff --git a/doc/_pages/from_source.md b/doc/_pages/from_source.md index 4670ad9b558d..60ade785f655 100644 --- a/doc/_pages/from_source.md +++ b/doc/_pages/from_source.md @@ -15,10 +15,10 @@ integration. Any other configurations are provided on a best-effort basis. | Operating System ⁽²⁾ | Architecture | Python ⁽¹⁾ | Bazel | CMake | C/C++ Compiler ⁽³⁾ | Java | |------------------------------------|--------------|------------|-------|-------|------------------------------|-------------------------------| -| Ubuntu 20.04 LTS (Focal Fossa) | x86_64 | 3.8 | 5.3 | 3.16 | GCC 9 (default) or Clang 12 | OpenJDK 11 | -| Ubuntu 22.04 LTS (Jammy Jellyfish) | x86_64 | 3.10 | 5.3 | 3.22 | GCC 11 (default) or Clang 12 | OpenJDK 11 | -| macOS Monterey (12) | x86_64 | 3.10 | 5.3 | 3.24 | Apple LLVM 14 (Xcode 14) | AdoptOpenJDK 16 (HotSpot JVM) | -| macOS Monterey (12) | arm64 | 3.10 | 5.3 | 3.24 | Apple LLVM 14 (Xcode 14) | AdoptOpenJDK 16 (HotSpot JVM) | +| Ubuntu 20.04 LTS (Focal Fossa) | x86_64 | 3.8 | 6.0 | 3.16 | GCC 9 (default) or Clang 12 | OpenJDK 11 | +| Ubuntu 22.04 LTS (Jammy Jellyfish) | x86_64 | 3.10 | 6.0 | 3.22 | GCC 11 (default) or Clang 12 | OpenJDK 11 | +| macOS Monterey (12) | x86_64 | 3.10 | 6.0 | 3.24 | Apple LLVM 14 (Xcode 14) | AdoptOpenJDK 16 (HotSpot JVM) | +| macOS Monterey (12) | arm64 | 3.10 | 6.0 | 3.24 | Apple LLVM 14 (Xcode 14) | AdoptOpenJDK 16 (HotSpot JVM) | ⁽¹⁾ CPython is the only Python implementation supported. diff --git a/setup/ubuntu/source_distribution/install_prereqs.sh b/setup/ubuntu/source_distribution/install_prereqs.sh index 419364963216..0060638c3c89 100755 --- a/setup/ubuntu/source_distribution/install_prereqs.sh +++ b/setup/ubuntu/source_distribution/install_prereqs.sh @@ -181,7 +181,7 @@ if [[ $(arch) = "aarch64" ]]; then fi else dpkg_install_from_wget \ - bazel 5.3.1 \ - https://releases.bazel.build/5.3.1/release/bazel_5.3.1-linux-x86_64.deb \ - 1e939b50d90f68d30fa4f3c12dfdf31429b83ddd8076c622429854f64253c23d + bazel 6.0.0 \ + https://releases.bazel.build/6.0.0/release/bazel_6.0.0-linux-x86_64.deb \ + b27749e59d7d57d9cf6ca0edce7fbd26bb677797217429052d62ee0f2d008b35 fi diff --git a/tools/skylark/drake_cc.bzl b/tools/skylark/drake_cc.bzl index c3256e456d1f..f2be352f0bda 100644 --- a/tools/skylark/drake_cc.bzl +++ b/tools/skylark/drake_cc.bzl @@ -726,6 +726,11 @@ def drake_cc_binary( linkshared = linkshared, linkstatic = linkstatic, linkopts = linkopts, + features = [ + # We should deduplicate symbols while linking (for a ~6% reduction + # in disk use), to conserve space in CI; see #18545 for details. + "-no_deduplicate", + ], **kwargs ) @@ -804,6 +809,11 @@ def drake_cc_test( args = args, deps = deps + add_deps, copts = new_copts, + features = [ + # We should deduplicate symbols while linking (for a ~6% reduction + # in disk use), to conserve space in CI; see #18545 for details. + "-no_deduplicate", + ], **kwargs ) diff --git a/tools/wheel/image/provision-base.sh b/tools/wheel/image/provision-base.sh index 14fa9824283e..ec4a36f170dc 100755 --- a/tools/wheel/image/provision-base.sh +++ b/tools/wheel/image/provision-base.sh @@ -5,7 +5,7 @@ set -eu -o pipefail -readonly BAZEL_VERSION=5.1.0 +readonly BAZEL_VERSION=6.0.0 readonly BAZEL_ROOT=https://github.com/bazelbuild/bazel/releases/download # Fix ssh permissions. diff --git a/tools/workspace/drake_visualizer/image/provision.sh b/tools/workspace/drake_visualizer/image/provision.sh index a4e45aeec5a0..1f6dc9ff0cf1 100755 --- a/tools/workspace/drake_visualizer/image/provision.sh +++ b/tools/workspace/drake_visualizer/image/provision.sh @@ -4,7 +4,7 @@ set -eu -o pipefail export DEBIAN_FRONTEND=noninteractive -readonly BAZEL_VERSION=5.1.0 +readonly BAZEL_VERSION=6.0.0 readonly BAZEL_ROOT=https://github.com/bazelbuild/bazel/releases/download # Install prerequisites. diff --git a/tools/workspace/dreal/patches/pull18545.patch b/tools/workspace/dreal/patches/pull18545.patch new file mode 100644 index 000000000000..463e539a5ca5 --- /dev/null +++ b/tools/workspace/dreal/patches/pull18545.patch @@ -0,0 +1,12 @@ +See https://github.com/RobotLocomotion/drake/pull/18545 for details +about this patch. + +--- tools/dreal.bzl.orig ++++ tools/dreal.bzl +@@ -65,7 +65,6 @@ + return select({ + "//tools:gcc_build": GCC_FLAGS + extra_gcc_flags + rule_copts, + "//tools:clang_build": CLANG_FLAGS + rule_copts, +- "//tools:apple": CLANG_FLAGS + rule_copts, + "//conditions:default": CXX_FLAGS + rule_copts, + }) \ No newline at end of file diff --git a/tools/workspace/dreal/repository.bzl b/tools/workspace/dreal/repository.bzl index 35f3a5ec2aa6..a31ff93d290a 100644 --- a/tools/workspace/dreal/repository.bzl +++ b/tools/workspace/dreal/repository.bzl @@ -19,6 +19,7 @@ def dreal_repository( ":patches/platforms.patch", ":patches/pull283.patch", ":patches/warnings.patch", + ":patches/pull18545.patch", ], repo_mapping = { "@nlopt": "@nlopt_internal",