Skip to content

Commit 7742438

Browse files
erock2112SkCQ
authored andcommitted
[bazel] Regenerate RBE toolchain configs
Add rbe_configs_gen to WORKSPACE. This is needed to support dependencies which require a newer C++ standard. Bug: b/432211966 Change-Id: I5e8bd98d8c3cb6bf42052c592ca525d45fd49aa2 Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/1026537 Reviewed-by: Kaylee Lubick <kjlubick@google.com> Commit-Queue: Eric Boren <borenet@google.com>
1 parent f19ef69 commit 7742438

5 files changed

Lines changed: 117 additions & 31 deletions

File tree

BUILD.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,12 @@ alias(
299299
actual = "//sk/go/sk",
300300
visibility = ["//visibility:public"],
301301
)
302+
303+
################################################
304+
# rbe_configs_gen #
305+
################################################
306+
alias(
307+
name = "rbe_configs_gen",
308+
actual = "@rbe_configs_gen_linux_amd64//file:rbe_configs_gen",
309+
visibility = ["//visibility:public"],
310+
)

WORKSPACE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,22 @@ load("//bazel/external:google_chrome.bzl", "google_chrome")
631631

632632
google_chrome(name = "google_chrome")
633633

634+
################################################
635+
# bazel-toolchains rbe_configs_gen (prebuilt). #
636+
################################################
637+
638+
http_file(
639+
name = "rbe_configs_gen_linux_amd64",
640+
downloaded_file_path = "rbe_configs_gen",
641+
executable = True,
642+
sha256 = "1206e8a79b41cb22524f73afa4f4ee648478f46ef6990d78e7cc953665a1db89",
643+
urls = gcs_mirror_url(
644+
ext = "",
645+
sha256 = "1206e8a79b41cb22524f73afa4f4ee648478f46ef6990d78e7cc953665a1db89",
646+
url = "https://github.com/bazelbuild/bazel-toolchains/releases/download/v5.1.2/rbe_configs_gen_linux_amd64",
647+
),
648+
)
649+
634650
##########################
635651
# Buildifier (prebuilt). #
636652
##########################

bazel/rbe/generated/README.md

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,13 @@ regenerating these files, just update the `container-image` exec_property of the
6060
in `//bazel/rbe/generated/config/BUILD`
6161
([example](https://skia.googlesource.com/buildbot/+/bb3604fd9a57bb20d799341b50f616af9e0062d4/bazel/rbe/generated/config/BUILD#43)).
6262

63-
Regenerate the `//bazel/rbe/generated` directory with the `rbe_configs_gen` CLI tool (installation
64-
instructions below):
63+
Regenerate the `//bazel/rbe/generated` directory with the `rbe_configs_gen` CLI tool:
6564

6665
```
6766
# Replace the <PLACEHOLDERS> as needed.
68-
$ rbe_configs_gen \
67+
$ bazelisk run //:rbe_configs_gen \
6968
--bazel_version=<BAZEL VERSION> \
70-
--toolchain_container=gcr.io/skia-public/rbe-container-skia-infra@sha256:<HASH OF MOST RECENT IMAGE> \
69+
--toolchain_container=gcr.io/skia-public/infra-rbe-linux@sha256:<HASH OF MOST RECENT IMAGE> \
7170
--output_src_root=<PATH TO REPOSITORY CHECKOUT> \
7271
--output_config_path=bazel/rbe/generated \
7372
--exec_os=linux \
@@ -78,10 +77,10 @@ $ rbe_configs_gen \
7877
Example:
7978

8079
```
81-
$ rbe_configs_gen \
82-
--bazel_version=4.1.0 \
83-
--toolchain_container=gcr.io/skia-public/rbe-container-skia-infra@sha256:5418d876cd8bb7cdbd05b834254038744d15f2f38327dfa46ff8dc9f83355260 \
84-
--output_src_root=$HOME/buildbot \
80+
$ bazelisk run //:rbe_configs_gen -- \
81+
--bazel_version=$(cat .bazelversion) \
82+
--toolchain_container=gcr.io/skia-public/infra-rbe-linux@sha256:0b12571d1befe54e9300711c8519535d635b867c317b2098915c7733fd65b833 \
83+
--output_src_root=$(pwd) \
8584
--output_config_path=bazel/rbe/generated \
8685
--exec_os=linux \
8786
--target_os=linux \
@@ -111,17 +110,3 @@ Try running various bazel commands with `--config remote` to make use of the new
111110

112111
When uploading the change as a CL, any tasks with the `-RBE` suffix will automatically use the
113112
image specified in `//bazel/rbe/generated/config/BUILD`.
114-
115-
## How to install the `rbe_configs_gen` CLI tool
116-
117-
Clone the [bazel-toolchains](https://github.com/bazelbuild/bazel-toolchains) repository outside of
118-
the Buildbot repository checkout, build the `rbe_configs_gen` binary, and place it on your $PATH:
119-
120-
```
121-
$ git clone https://github.com/bazelbuild/bazel-toolchains
122-
123-
$ cd bazel-toolchains
124-
125-
# This assumes that $HOME/bin is in your $PATH.
126-
$ go build -o $HOME/bin/rbe_configs_gen ./cmd/rbe_configs_gen/rbe_configs_gen.go
127-
```

bazel/rbe/generated/cc/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ cc_toolchain_config(
113113
"-ffunction-sections",
114114
"-fdata-sections"],
115115
dbg_compile_flags = ["-g"],
116-
cxx_flags = ["-std=c++0x"],
116+
cxx_flags = ["-std=c++14"],
117117
link_flags = ["-fuse-ld=/usr/bin/ld.gold",
118118
"-Wl,-no-as-needed",
119119
"-Wl,-z,relro,-z,now",

bazel/rbe/generated/cc/cc_toolchain_config.bzl

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,34 @@ lto_index_actions = [
143143
ACTION_NAMES.lto_index_for_nodeps_dynamic_library,
144144
]
145145

146+
def _sanitizer_feature(name = "", specific_compile_flags = [], specific_link_flags = []):
147+
return feature(
148+
name = name,
149+
flag_sets = [
150+
flag_set(
151+
actions = all_compile_actions,
152+
flag_groups = [
153+
flag_group(flags = [
154+
"-fno-omit-frame-pointer",
155+
"-fno-sanitize-recover=all",
156+
] + specific_compile_flags),
157+
],
158+
with_features = [
159+
with_feature_set(features = [name]),
160+
],
161+
),
162+
flag_set(
163+
actions = all_link_actions,
164+
flag_groups = [
165+
flag_group(flags = specific_link_flags),
166+
],
167+
with_features = [
168+
with_feature_set(features = [name]),
169+
],
170+
),
171+
],
172+
)
173+
146174
def _impl(ctx):
147175
tool_paths = [
148176
tool_path(name = name, path = path)
@@ -783,6 +811,24 @@ def _impl(ctx):
783811
],
784812
)
785813

814+
is_linux = ctx.attr.target_libc != "macosx"
815+
if is_linux:
816+
versioned_library_flag_group = flag_group(
817+
flags = ["-l:%{libraries_to_link.name}"],
818+
expand_if_equal = variable_with_value(
819+
name = "libraries_to_link.type",
820+
value = "versioned_dynamic_library",
821+
),
822+
)
823+
else:
824+
versioned_library_flag_group = flag_group(
825+
flags = ["%{libraries_to_link.path}"],
826+
expand_if_equal = variable_with_value(
827+
name = "libraries_to_link.type",
828+
value = "versioned_dynamic_library",
829+
),
830+
)
831+
786832
libraries_to_link_feature = feature(
787833
name = "libraries_to_link",
788834
flag_sets = [
@@ -840,13 +886,7 @@ def _impl(ctx):
840886
value = "dynamic_library",
841887
),
842888
),
843-
flag_group(
844-
flags = ["-l:%{libraries_to_link.name}"],
845-
expand_if_equal = variable_with_value(
846-
name = "libraries_to_link.type",
847-
value = "versioned_dynamic_library",
848-
),
849-
),
889+
versioned_library_flag_group,
850890
flag_group(
851891
flags = ["-Wl,-no-whole-archive"],
852892
expand_if_true = "libraries_to_link.is_whole_archive",
@@ -1224,7 +1264,37 @@ def _impl(ctx):
12241264
enabled = True,
12251265
)
12261266

1227-
is_linux = ctx.attr.target_libc != "macosx"
1267+
asan_feature = _sanitizer_feature(
1268+
name = "asan",
1269+
specific_compile_flags = [
1270+
"-fsanitize=address",
1271+
"-fno-common",
1272+
],
1273+
specific_link_flags = [
1274+
"-fsanitize=address",
1275+
],
1276+
)
1277+
1278+
tsan_feature = _sanitizer_feature(
1279+
name = "tsan",
1280+
specific_compile_flags = [
1281+
"-fsanitize=thread",
1282+
],
1283+
specific_link_flags = [
1284+
"-fsanitize=thread",
1285+
],
1286+
)
1287+
1288+
ubsan_feature = _sanitizer_feature(
1289+
name = "ubsan",
1290+
specific_compile_flags = [
1291+
"-fsanitize=undefined",
1292+
],
1293+
specific_link_flags = [
1294+
"-fsanitize=undefined",
1295+
],
1296+
)
1297+
12281298
libtool_feature = feature(
12291299
name = "libtool",
12301300
enabled = not is_linux,
@@ -1265,6 +1335,9 @@ def _impl(ctx):
12651335
strip_debug_symbols_feature,
12661336
coverage_feature,
12671337
supports_pic_feature,
1338+
asan_feature,
1339+
tsan_feature,
1340+
ubsan_feature,
12681341
] + (
12691342
[
12701343
supports_start_end_lib_feature,
@@ -1300,6 +1373,9 @@ def _impl(ctx):
13001373
libtool_feature,
13011374
archiver_flags_feature,
13021375
supports_pic_feature,
1376+
asan_feature,
1377+
tsan_feature,
1378+
ubsan_feature,
13031379
] + (
13041380
[
13051381
supports_start_end_lib_feature,

0 commit comments

Comments
 (0)