From 1c9d87f9bc2e6a44b101e09b8b5fef70777cc8f8 Mon Sep 17 00:00:00 2001 From: Robin Linden Date: Mon, 11 Dec 2023 22:16:15 +0100 Subject: [PATCH 1/4] deps/icu: Fix Windows build w/ Bazel 7 With Bazel 7, trying to compile icu:common resulted in `cl : Command line error D8004 : '/I' requires an argument` --- third_party/icu.BUILD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/third_party/icu.BUILD b/third_party/icu.BUILD index b92a57cc..03f60c79 100644 --- a/third_party/icu.BUILD +++ b/third_party/icu.BUILD @@ -15,9 +15,9 @@ cc_library( copts = select({ "@platforms//os:windows": [ "/GR", - "-I source/common/", - "-I source/common/unicode/", - "-I source/stubdata/", + "-Isource/common/", + "-Isource/common/unicode/", + "-Isource/stubdata/", ], "//conditions:default": [ "-frtti", From b5b76b9b08c721518690ae6b89e8fa9338b73ee6 Mon Sep 17 00:00:00 2001 From: Robin Linden Date: Wed, 13 Dec 2023 01:08:01 +0100 Subject: [PATCH 2/4] build: Add link-time workaround for aarch64 cross-compilation w/ Bazel 7 --- .bazelrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.bazelrc b/.bazelrc index 50a372e0..590e7d14 100644 --- a/.bazelrc +++ b/.bazelrc @@ -104,6 +104,11 @@ build:linux-aarch64-musl --copt=-fPIC build:linux-aarch64-musl --dynamic_mode=off # TODO(robinlinden): asio assumes __GLIBC__ is defined. build:linux-aarch64-musl --copt=-Wno-error=undef +# --incompatible_sandbox_hermetic_tmp (defaults to true in Bazel 7) leads to +# incredibly long link times. +# See: https://github.com/uber/hermetic_cc_toolchain/issues/134 +build:linux-aarch64-musl --noincompatible_sandbox_hermetic_tmp + # Fuzzing options # ========================================================= From bf7831486312c888979895c783f5076966a604eb Mon Sep 17 00:00:00 2001 From: Robin Linden Date: Wed, 13 Dec 2023 01:22:52 +0100 Subject: [PATCH 3/4] build: Use apple_support to configure the objc toolchain This is required starting with Bazel 7. --- .bazelrc | 3 +++ WORKSPACE | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.bazelrc b/.bazelrc index 590e7d14..f3ffd162 100644 --- a/.bazelrc +++ b/.bazelrc @@ -29,6 +29,9 @@ build:linux --features=layering_check build:linux --cxxopt='-std=c++2b' build:linux --cxxopt='-fno-rtti' +build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain +build:macos --crosstool_top=@local_config_apple_cc//:toolchain +build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain build:macos --features=layering_check build:macos --cxxopt='-std=c++2b' build:macos --cxxopt='-fno-rtti' diff --git a/WORKSPACE b/WORKSPACE index 3cfd52b0..48b8815f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,6 +3,13 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Bazel # ========================================================= +# https://github.com/bazelbuild/apple_support +http_archive( + name = "build_bazel_apple_support", + sha256 = "cf4d63f39c7ba9059f70e995bf5fe1019267d3f77379c2028561a5d7645ef67c", + url = "https://github.com/bazelbuild/apple_support/releases/download/1.11.1/apple_support.1.11.1.tar.gz", +) + # https://github.com/bazelbuild/platforms http_archive( name = "platforms", # Apache-2.0 @@ -308,6 +315,11 @@ http_archive( # This needs to go last so that we can override any dependencies these calls may # pull in. +# build_bazel_apple_support +load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") + +apple_support_dependencies() + # rules_python load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") From 65d2d1ccc25fa7253e80f17eefdf5c35ec0c7691 Mon Sep 17 00:00:00 2001 From: Robin Linden Date: Mon, 11 Dec 2023 22:25:36 +0100 Subject: [PATCH 4/4] build: Update to Bazel 7 --incompatible_enable_cc_toolchain_resolution is now flipped by default. --- .bazelrc | 1 - .bazelversion | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index f3ffd162..4bed50b1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -16,7 +16,6 @@ test --test_verbose_timeout_warnings build --incompatible_config_setting_private_default_visibility build --incompatible_disallow_empty_glob -build --incompatible_enable_cc_toolchain_resolution build --incompatible_enforce_config_setting_visibility # Compiler configuration diff --git a/.bazelversion b/.bazelversion index 19b860c1..66ce77b7 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.4.0 +7.0.0