Update cross compile toolchains (#12069)

* Regenerate cross-toolchain configs

* Remove some extra whitespaces

* Run gazelle and add that note to the README

* Format numbered lists better in markdown

* gcloud docker command is deprecated, just use docker

* Add comment about docker credentials for gcr.io

* Update dockerfile, some remote executor config work

* gazelle

* Remove commented lines

---------

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Preston Van Loon 2023-03-07 14:09:46 -06:00 committed by GitHub
parent 0893821e35
commit 4356cbc352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 311 additions and 1236 deletions

View File

@ -3,16 +3,6 @@ workspace(name = "prysm")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
http_archive(
name = "bazel_toolchains",
sha256 = "8e0633dfb59f704594f19ae996a35650747adc621ada5e8b9fb588f808c89cb0",
strip_prefix = "bazel-toolchains-3.7.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/3.7.0/bazel-toolchains-3.7.0.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/releases/download/3.7.0/bazel-toolchains-3.7.0.tar.gz",
],
)
http_archive(
name = "com_grail_bazel_toolchain",
sha256 = "b210fc8e58782ef171f428bfc850ed7179bdd805543ebd1aa144b9c93489134f",
@ -39,10 +29,6 @@ load("@prysm//tools/cross-toolchain:prysm_toolchains.bzl", "configure_prysm_tool
configure_prysm_toolchains()
load("@prysm//tools/cross-toolchain:rbe_toolchains_config.bzl", "rbe_toolchains_config")
rbe_toolchains_config()
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(

View File

@ -46,6 +46,7 @@ pkg_deb(
package = "prysm-beacon-chain",
postinst = "postinst.sh",
preinst = "preinst.sh",
tags = ["no-remote"],
version_file = "//runtime:version_file",
visibility = ["//beacon-chain:__pkg__"],
)

View File

@ -2,8 +2,10 @@
-----------------------------------------------
build:cross --crosstool_top=@prysm_toolchains//:multiarch_toolchain
build:cross --host_platform=@io_bazel_rules_go//go/toolchain:linux_amd64
build:cross --extra_execution_platforms=@//tools/cross-toolchain/configs/config:platform
build:cross --extra_toolchains=@prysm_toolchains//:cc-toolchain-multiarch
build:cross --host_crosstool_top=@prysm_toolchains//:hostonly_toolchain
build:cross --platforms=@//tools/cross-toolchain/configs/config:platform
# linux_amd64 config for cross compiler toolchain, not strictly necessary since host/exec env is amd64
build:linux_amd64 --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64_cgo
@ -21,10 +23,10 @@ build:osx_arm64 --cpu=aarch64
# windows
build:windows_amd64 --config=cross
build:windows_amd64 --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64_cgo
build:windows_amd64 --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64_cgo
build:windows_amd64 --compiler=mingw-w64
# linux_arm64 conifg for cross compiler toolchain
# linux_arm64 config for cross compiler toolchain
build:linux_arm64 --config=cross
build:linux_arm64 --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64_cgo
build:linux_arm64 --copt=-funsafe-math-optimizations
@ -38,20 +40,17 @@ build:linux_arm64 --copt=-march=armv8-a
# Docker Sandbox Configs
#-----------------------
# Note all docker sandbox configs must run from a linux x86_64 host
# build:docker-sandbox --experimental_docker_image=gcr.io/prysmaticlabs/rbe-worker:latest
build:docker-sandbox --unconditional_warning="⚠️ Docker sandbox is extremely slow! Consider a remote executor, if possible. See tools/cross-toolchain/README.md#Caveats ⚠️"
build:docker-sandbox --spawn_strategy=docker --strategy=Javac=docker --genrule_strategy=docker
build:docker-sandbox --define=EXECUTOR=remote
build:docker-sandbox --experimental_docker_verbose
build:docker-sandbox --experimental_enable_docker_sandbox
build:docker-sandbox --crosstool_top=@rbe_ubuntu_clang//cc:toolchain
build:docker-sandbox --host_javabase=@rbe_ubuntu_clang//java:jdk
build:docker-sandbox --javabase=@rbe_ubuntu_clang//java:jdk
build:docker-sandbox --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:docker-sandbox --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:docker-sandbox --extra_execution_platforms=@rbe_ubuntu_clang//config:platform
build:docker-sandbox --host_platform=@rbe_ubuntu_clang//config:platform
build:docker-sandbox --platforms=@rbe_ubuntu_clang//config:platform
build:docker-sandbox --extra_toolchains=@prysm_toolchains//:cc-toolchain-multiarch
# Remote with docker sandbox fallback
build:remote --spawn_strategy=remote,docker,linux-sandbox --strategy=Javac=remote,docker,linux-sandbox --genrule_strategy=remote,docker,linux-sandbox
build:remote --define=EXECUTOR=remote
build:remote --experimental_docker_verbose
build:remote --experimental_enable_docker_sandbox
# windows_amd64 docker sandbox build config
build:windows_amd64_docker --config=docker-sandbox --config=windows_amd64

View File

@ -1,15 +1,6 @@
# Prysmatic Labs Remote Build Execution Image with Cross Compile Support.
#
# Update instructions.
# - Build the docker image.
# - Push to gcr.io.
# - Update _PRYSM_BUILD_IMAGE_DIGEST in //tools/cross-toolchain/rbe_toolchains_config.bzl
# - Run ./tools/cross-toolchain/regenerate.sh
# - Add and commit the newly generated configs.
# - Done!
#
# docker build -t gcr.io/prysmaticlabs/rbe-worker:latest .
# gcloud docker -- push gcr.io/prysmaticlabs/rbe-worker:latest
# See README.md for update instructions.
FROM debian:bullseye-slim as build
@ -22,7 +13,7 @@ RUN apt-get update && \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
cmake libssl-dev libxml2-dev vim apt-transport-https \
zip unzip libtinfo5 patch zlib1g-dev autoconf libtool \
pkg-config make docker.io gnupg2 libgmp-dev python
pkg-config make docker.io gnupg2 libgmp-dev python3 openjdk-17-jdk-headless
# install llvm/clang cross-build toolchains
ENV INSTALL_LLVM_VERSION=12.0.0
@ -38,6 +29,7 @@ RUN /tmp/link_osxcross.sh
# containerized development environment
FROM build as devel
RUN mkdir /workdir
WORKDIR /workdir
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/
RUN echo 'PS1="\[$(tput setaf 3)$(tput bold)[\]devel@\\h:\\W]#\[$(tput sgr0) \]"' >> /root/.bashrc

View File

@ -11,13 +11,60 @@ This package declares a c++ toolchain suite with cross compilers for targeting f
This toolchain suite describes cross compile configuration with a Dockerfile with the appropriate host dependencies. These toolchains can be used locally (see [caveats](#caveats)), [Remote Build Execution (RBE)](https://docs.bazel.build/versions/master/remote-execution.html), and in a docker sandbox (like RBE, but local).
### Updating the toolchain suite
1) Build and push the worker docker image, if necessary.
```bash
docker build -t gcr.io/prysmaticlabs/rbe-worker:latest tools/cross-toolchain/.
docker push gcr.io/prysmaticlabs/rbe-worker:latest
```
Note: You must configured your gcr access credentials to push to gcr.io/prysmaticlabs. Run `gcloud auth configure-docker` or contact SRE team for push access.
2) Note the docker image sha256 digest from the recently pushed image or use the latest one available.
3) Download and run [rbe_configs_gen](https://github.com/bazelbuild/bazel-toolchains#rbe_configs_gen---cli-tool-to-generate-configs) CLI tool.
```bash
# Run from the root of the Prysm repo.
rbe_configs_gen \
--bazel_version=$(cat .bazelversion) \
--target_os=linux \
--exec_os=linux \
--output_src_root=tools/cross-toolchain/configs \
--generate_cpp_configs=true \
--generate_java_configs=true \
--cpp_env_json=tools/cross-toolchain/cpp_env_clang.json \
--toolchain_container=gcr.io/prysmaticlabs/rbe-worker@sha256:9a30c5ff7dcd1fbc5cb5b5f320782dec755a31cd2f6811e238a8584d94b04e78 # The sha256 digest from step 2.
```
4) Test the builds work locally for all supported platforms.
```bash
bazel build --config=release --config=linux_amd64 --config=llvm //cmd/beacon-chain //cmd/validator //cmd/client-stats //cmd/prysmctl
bazel build --config=release --config=linux_arm64_docker //cmd/beacon-chain //cmd/validator //cmd/client-stats //cmd/prysmctl
bazel build --config=release --config=osx_amd64_docker //cmd/beacon-chain //cmd/validator //cmd/client-stats //cmd/prysmctl
bazel build --config=release --config=osx_arm64_docker //cmd/beacon-chain //cmd/validator //cmd/client-stats //cmd/prysmctl
bazel build --config=release --config=windows_amd64_docker //cmd/beacon-chain //cmd/validator //cmd/client-stats //cmd/prysmctl
```
5) Run gazelle.
```bash
bazel run //:gazelle
```
6) Add and commit the newly generated configs.
7) Done!
### Cross compile target support
| target | linux_amd64 | linux_arm64 | osx_amd64 | osx_arm64 | windows_amd64 |
|------------------|-------------------|------------------|-----------------|-----------------|-----------------------------------|
| target | linux_amd64 | linux_arm64 | osx_amd64 | osx_arm64 | windows_amd64 |
|------------------|--------------------------------------------------------------------|--------------------------------------------|------------------------------------|------------------------------------|------------------------------------|
| `//beacon-chain` | :heavy_check_mark: docker-sandbox and RBE, supported locally only | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox | :heavy_check_mark: docker-sandbox | :heavy_check_mark: docker-sandbox |
| `//validator` | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox | :heavy_check_mark: docker-sandbox | :heavy_check_mark: |
| `//validator` | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox and RBE | :heavy_check_mark: docker-sandbox | :heavy_check_mark: docker-sandbox | :heavy_check_mark: |
The configurations above are enforced via pull request presubmit checks.
@ -25,10 +72,10 @@ The configurations above are enforced via pull request presubmit checks.
Use these values with `--config=<flag>`, multiple times if more than one value is defined in the table. Example: `bazel build //beacon-chain --config=windows_amd64_docker` to build windows binary in a docker sandbox.
| Config | linux_amd64 | linux_arm64 | osx_amd64 | osx_arm64 | windows_amd64 |
|-------------------------------|-------------------|------------------|---------------------------|---------------------------|------------------------------|
| Local run | `linux_amd64` | `linux_arm64` | `osx_amd64` | `osx_arm64` | `windows_amd64` |
| Docker sandbox | `linux_amd64_docker` | `linux_arm64_docker` | `osx_amd64_docker` | `osx_arm64_docker` | `windows_amd64_docker ` |
| Config | linux_amd64 | linux_arm64 | osx_amd64 | osx_arm64 | windows_amd64 |
|-------------------------------|----------------------------|-----------------------------|---------------------------|---------------------------|-------------------------------|
| Local run | `linux_amd64` | `linux_arm64` | `osx_amd64` | `osx_arm64` | `windows_amd64` |
| Docker sandbox | `linux_amd64_docker` | `linux_arm64_docker` | `osx_amd64_docker` | `osx_arm64_docker` | `windows_amd64_docker ` |
| RBE (See [Caveats](#caveats)) | `linux_amd64` and `remote` | `linux_arm64` and `remote` | `osx_amd64` and `remote` | `osx_arm64` and `remote` | `windows_amd64` and `remote` |
### Caveats

View File

@ -1,33 +0,0 @@
# Copyright 2016 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This .bazelrc file is generated by rbe_autoconfig
# when the output_base attr is used.
# It contains some of the flags required for the provided
# toolchain with Remote Build Execution.
# Specifically, it includes all toolchain/platform flags
# This file is used for testing purposes.
build:remote --host_javabase=//tools/cross-toolchain/configs/clang/bazel_5.3.0/java:jdk
build:remote --javabase=//tools/cross-toolchain/configs/clang/bazel_5.3.0/java:jdk
build:remote --crosstool_top=//tools/cross-toolchain/configs/clang/bazel_5.3.0/cc:toolchain
build:remote --extra_toolchains=//tools/cross-toolchain/configs/clang/bazel_5.3.0/config:cc-toolchain
build:remote --extra_execution_platforms=//tools/cross-toolchain/configs/clang/bazel_5.3.0/config:platform
build:remote --host_platform=//tools/cross-toolchain/configs/clang/bazel_5.3.0/config:platform
build:remote --platforms=//tools/cross-toolchain/configs/clang/bazel_5.3.0/config:platform
# Import the default bazelrc file in bazel-toolchains repo.
# This will only work for tests executed from bazel-toolchains
# repo.
try-import %workspace%/bazelrc/.bazelrc.notoolchain

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -24,19 +24,16 @@ licenses(["notice"]) # Apache 2.0
cc_library(
name = "malloc",
tags = ["manual"],
)
filegroup(
name = "empty",
srcs = [],
tags = ["manual"],
)
filegroup(
name = "cc_wrapper",
srcs = ["cc_wrapper.sh"],
tags = ["manual"],
)
filegroup(
@ -45,7 +42,6 @@ filegroup(
["extra_tools/**"],
allow_empty = True,
) + [":builtin_include_directory_paths"],
tags = ["manual"],
)
# This is the entry point for --crosstool_top. Toolchains are found
@ -53,7 +49,6 @@ filegroup(
# the "${CPU}" entry in the toolchains attribute.
cc_toolchain_suite(
name = "toolchain",
tags = ["manual"],
toolchains = {
"k8|clang": ":cc-compiler-k8",
"k8": ":cc-compiler-k8",
@ -74,7 +69,6 @@ cc_toolchain(
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
tags = ["manual"],
toolchain_config = ":local",
toolchain_identifier = "local",
)
@ -132,7 +126,6 @@ cc_toolchain_config(
],
opt_link_flags = ["-Wl,--gc-sections"],
supports_start_end_lib = True,
tags = ["manual"],
target_libc = "local",
target_system_name = "local",
tool_paths = {
@ -170,12 +163,8 @@ cc_toolchain(
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
tags = ["manual"],
toolchain_config = ":stub_armeabi-v7a",
toolchain_identifier = "stub_armeabi-v7a",
)
armeabi_cc_toolchain_config(
name = "stub_armeabi-v7a",
tags = ["manual"],
)
armeabi_cc_toolchain_config(name = "stub_armeabi-v7a")

View File

@ -0,0 +1,2 @@
# DO NOT EDIT: automatically generated WORKSPACE file for cc_autoconf rule
workspace(name = "local_config_cc")

View File

@ -0,0 +1 @@
int main() {}

View File

@ -1,195 +0,0 @@
package(default_visibility = ["//visibility:public"])
load(":cc_toolchain_config_osx.bzl", "osx_cc_toolchain_config")
load(":cc_toolchain_config_linux_arm64.bzl", "arm64_cc_toolchain_config")
load(":cc_toolchain_config_windows.bzl", "windows_cc_toolchain_config")
cc_toolchain_suite(
name = "multiarch_toolchain",
tags = ["manual"],
toolchains = {
"k8|osxcross": ":cc-clang-osx-amd64",
"aarch64|osxcross": ":cc-clang-osx-arm64",
"k8|clang": "cc-clang-amd64",
"aarch64|clang": ":cc-clang-arm64",
"k8": "cc-clang-amd64",
"aarch64": ":cc-clang-arm64",
"k8|mingw-w64": ":cc-mingw-amd64",
},
)
cc_toolchain_suite(
name = "hostonly_toolchain",
tags = ["manual"],
toolchains = {
"k8": "cc-clang-amd64",
},
)
filegroup(
name = "empty",
srcs = [],
tags = ["manual"],
)
config_setting(
name = "osx_amd64",
constraint_values = [
"@platforms//os:osx",
"@platforms//cpu:x86_64",
],
tags = ["manual"],
)
config_setting(
name = "osx_arm64",
constraint_values = [
"@platforms//os:osx",
"@platforms//cpu:arm64",
],
tags = ["manual"],
)
config_setting(
name = "linux_arm64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
tags = ["manual"],
)
config_setting(
name = "linux_amd64",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
tags = ["manual"],
)
config_setting(
name = "windows_amd64",
constraint_values = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
tags = ["manual"],
)
arm64_cc_toolchain_config(
name = "local-arm64",
tags = ["manual"],
target = "aarch64-linux-gnu",
)
arm64_cc_toolchain_config(
name = "local-amd64",
tags = ["manual"],
target = "x86_64-unknown-linux-gnu",
)
osx_cc_toolchain_config(
name = "local-osxcross-amd64",
tags = ["manual"],
target = "darwin_x86_64",
target_cpu = "x86_64",
)
osx_cc_toolchain_config(
name = "local-osxcross-arm64",
tags = ["manual"],
target = "darwin_aarch64",
target_cpu = "aarch64",
)
windows_cc_toolchain_config(
name = "local-windows",
tags = ["manual"],
target = "x86_64-w64",
)
cc_toolchain(
name = "cc-mingw-amd64",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
tags = ["manual"],
toolchain_config = ":local-windows",
)
cc_toolchain(
name = "cc-clang-arm64",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
tags = ["manual"],
toolchain_config = ":local-arm64",
)
cc_toolchain(
name = "cc-clang-osx-amd64",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
tags = ["manual"],
toolchain_config = ":local-osxcross-amd64",
)
cc_toolchain(
name = "cc-clang-osx-arm64",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
tags = ["manual"],
toolchain_config = ":local-osxcross-arm64",
)
cc_toolchain(
name = "cc-clang-amd64",
all_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 1,
tags = ["manual"],
toolchain_config = ":local-amd64",
)
toolchain(
name = "cc-toolchain-multiarch",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
tags = ["manual"],
target_compatible_with = [],
toolchain = select({
":linux_arm64": ":cc-clang-arm64",
":linux_amd64": ":cc-clang-amd64",
":osx_amd64": ":cc-clang-osx-amd64",
":osx_arm64": ":cc-clang-osx-arm64",
":windows_amd64": ":cc-mingw-amd64",
}),
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

View File

@ -1,2 +0,0 @@
# DO NOT EDIT: automatically generated WORKSPACE file for prysm_toolchains rule
workspace(name = "prysm_toolchains")

View File

@ -1,305 +0,0 @@
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"feature",
"feature_set",
"flag_group",
"flag_set",
"make_variable",
"tool",
"tool_path",
"with_feature_set",
)
load(
"@bazel_tools//tools/cpp:cc_toolchain_config.bzl",
ALL_COMPILE_ACTIONS = "all_compile_actions",
ALL_CPP_COMPILE_ACTIONS = "all_cpp_compile_actions",
ALL_LINK_ACTIONS = "all_link_actions",
)
def _impl(ctx):
toolchain_identifier = "clang-linux-cross"
compiler = "clang"
abi_version = "clang"
abi_libc_version = "glibc_unknown"
target_libc = "glibc_unknown"
target_cpu = ctx.attr.target.split("-")[0]
if (target_cpu == "aarch64"):
sysroot = "/usr/aarch64-linux-gnu"
include_path_prefix = sysroot
elif (target_cpu == "x86_64"):
sysroot = "/"
include_path_prefix = "/usr"
else:
fail("Unreachable")
if (target_cpu == "aarch64"):
cross_system_include_dirs = [
include_path_prefix + "/include/c++/v1",
include_path_prefix + "/lib/clang/12.0.0/include",
]
else:
cross_system_include_dirs = [
include_path_prefix + "/include/c++/v1",
include_path_prefix + "/lib/clang/12.0.0/include",
include_path_prefix + "/include/x86_64-linux-gnu",
]
cross_system_include_dirs += [
include_path_prefix + "/include/",
include_path_prefix + "/include/linux",
include_path_prefix + "/include/asm",
include_path_prefix + "/include/asm-generic",
]
if (target_cpu == "aarch64"):
cross_system_lib_dirs = [
"/usr/" + ctx.attr.target + "/lib",
]
else:
cross_system_lib_dirs = [
"/usr/lib/x86_64-linux-gnu/",
]
cross_system_lib_dirs += [
"/usr/lib/gcc/x86_64-linux-gnu/8",
]
opt_feature = feature(name = "opt")
dbg_feature = feature(name = "dbg")
fastbuild_feature = feature(name = "fastbuild")
random_seed_feature = feature(name = "random_seed", enabled = True)
supports_pic_feature = feature(name = "supports_pic", enabled = True)
supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
unfiltered_compile_flags_feature = feature(
name = "unfiltered_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-no-canonical-prefixes",
"-Wno-builtin-macro-redefined",
"-D__DATE__=\"redacted\"",
"-D__TIMESTAMP__=\"redacted\"",
"-D__TIME__=\"redacted\"",
],
),
],
),
],
)
# explicit arch specific system includes
system_include_flags = []
for d in cross_system_include_dirs:
system_include_flags += ["-idirafter", d]
default_compile_flags_feature = feature(
name = "default_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"--target=" + ctx.attr.target,
"-nostdinc",
"-U_FORTIFY_SOURCE",
"-fstack-protector",
"-fno-omit-frame-pointer",
"-fcolor-diagnostics",
"-Wall",
"-Wthread-safety",
"-Wself-assign",
] + system_include_flags,
),
],
),
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [flag_group(flags = ["-g", "-fstandalone-debug"])],
with_features = [with_feature_set(features = ["dbg"])],
),
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-g0",
"-O2",
"-D_FORTIFY_SOURCE=1",
"-DNDEBUG",
"-ffunction-sections",
"-fdata-sections",
],
),
],
with_features = [with_feature_set(features = ["opt"])],
),
flag_set(
actions = ALL_CPP_COMPILE_ACTIONS,
flag_groups = [flag_group(flags = ["-std=c++17", "-nostdinc++"])],
),
],
)
additional_link_flags = [
"-l:libc++.a",
"-l:libc++abi.a",
"-l:libunwind.a",
"-lpthread",
"-ldl",
"-rtlib=compiler-rt",
]
default_link_flags_feature = feature(
name = "default_link_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_LINK_ACTIONS,
flag_groups = [
flag_group(
flags = additional_link_flags + [
"--target=" + ctx.attr.target,
"-lm",
"-no-canonical-prefixes",
"-fuse-ld=lld",
"-Wl,--build-id=md5",
"-Wl,--hash-style=gnu",
"-Wl,-z,relro,-z,now",
] + ["-L" + d for d in cross_system_lib_dirs],
),
],
),
flag_set(
actions = ALL_LINK_ACTIONS,
flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
with_features = [with_feature_set(features = ["opt"])],
),
],
)
objcopy_embed_flags_feature = feature(
name = "objcopy_embed_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ["objcopy_embed_data"],
flag_groups = [flag_group(flags = ["-I", "binary"])],
),
],
)
user_compile_flags_feature = feature(
name = "user_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
expand_if_available = "user_compile_flags",
flags = ["%{user_compile_flags}"],
iterate_over = "user_compile_flags",
),
],
),
],
)
sysroot_feature = feature(
name = "sysroot",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS + ALL_LINK_ACTIONS,
flag_groups = [
flag_group(
expand_if_available = "sysroot",
flags = ["--sysroot=%{sysroot}"],
),
],
),
],
)
coverage_feature = feature(
name = "coverage",
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = ["-fprofile-instr-generate", "-fcoverage-mapping"],
),
],
),
flag_set(
actions = ALL_LINK_ACTIONS,
flag_groups = [flag_group(flags = ["-fprofile-instr-generate"])],
),
],
provides = ["profile"],
)
features = [
opt_feature,
fastbuild_feature,
dbg_feature,
random_seed_feature,
supports_pic_feature,
supports_dynamic_linker_feature,
unfiltered_compile_flags_feature,
default_link_flags_feature,
default_compile_flags_feature,
objcopy_embed_flags_feature,
user_compile_flags_feature,
sysroot_feature,
coverage_feature,
]
tool_paths = [
tool_path(name = "ld", path = "/usr/bin/ld.lld"),
tool_path(name = "cpp", path = "/usr/bin/clang-cpp"),
tool_path(name = "dwp", path = "/usr/bin/llvm-dwp"),
tool_path(name = "gcov", path = "/usr/bin/llvm-profdata"),
tool_path(name = "nm", path = "/usr/bin/llvm-nm"),
tool_path(name = "objcopy", path = "/usr/bin/llvm-objcopy"),
tool_path(name = "objdump", path = "/usr/bin/llvm-objdump"),
tool_path(name = "strip", path = "/usr/bin/strip"),
tool_path(name = "gcc", path = "/usr/bin/clang"),
tool_path(name = "ar", path = "/usr/bin/llvm-ar"),
]
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
abi_version = abi_version,
abi_libc_version = abi_libc_version,
builtin_sysroot = sysroot,
compiler = compiler,
cxx_builtin_include_directories = cross_system_include_dirs,
host_system_name = "x86_64-unknown-linux-gnu",
target_cpu = target_cpu,
target_libc = target_libc,
target_system_name = ctx.attr.target,
tool_paths = tool_paths,
toolchain_identifier = toolchain_identifier,
)
arm64_cc_toolchain_config = rule(
implementation = _impl,
attrs = {
"target": attr.string(mandatory = True),
"stdlib": attr.string(),
},
provides = [CcToolchainConfigInfo],
)

View File

@ -1,260 +0,0 @@
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"feature",
"feature_set",
"flag_group",
"flag_set",
"make_variable",
"tool",
"tool_path",
"with_feature_set",
)
load(
"@bazel_tools//tools/cpp:cc_toolchain_config.bzl",
ALL_COMPILE_ACTIONS = "all_compile_actions",
ALL_CPP_COMPILE_ACTIONS = "all_cpp_compile_actions",
ALL_LINK_ACTIONS = "all_link_actions",
)
def _impl(ctx):
toolchain_identifier = "osxcross"
compiler = "clang"
clang_version = "12.0.0"
target_libc = "macosx"
target_cpu = ctx.attr.target_cpu
osxcross = "/usr/osxcross/"
sdkroot = osxcross + "SDK/MacOSX12.3.sdk/"
if (target_cpu == "aarch64"):
abi_version = "darwin_aarch64"
abi_libc_version = "darwin_aarch64"
osxcross_binprefix = osxcross + "bin/aarch64-apple-darwin21.4-"
tool_cpp = osxcross + "bin/oa64-clang++"
tool_gcc = osxcross + "bin/oa64-clang"
elif (target_cpu == "x86_64"):
abi_version = "darwin_x86_64"
abi_libc_version = "darwin_x86_64"
osxcross_binprefix = osxcross + "bin/x86_64-apple-darwin21.4-"
tool_cpp = osxcross + "bin/o64-clang++"
tool_gcc = osxcross + "bin/o64-clang"
else:
fail("Unreachable")
cross_system_include_dirs = [
"/usr/lib/clang/12.0.0/include",
osxcross + "include",
sdkroot + "usr/include",
]
opt_feature = feature(name = "opt")
dbg_feature = feature(name = "dbg")
fastbuild_feature = feature(name = "fastbuild")
random_seed_feature = feature(name = "random_seed", enabled = True)
supports_pic_feature = feature(name = "supports_pic", enabled = True)
supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
unfiltered_compile_flags_feature = feature(
name = "unfiltered_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-stdlib=libc++",
"-no-canonical-prefixes",
"-Wno-builtin-macro-redefined",
"-D__DATE__=\"redacted\"",
"-D__TIMESTAMP__=\"redacted\"",
"-D__TIME__=\"redacted\"",
],
),
],
),
],
)
# explicit arch specific system includes
system_include_flags = []
for d in cross_system_include_dirs:
system_include_flags += ["-idirafter", d]
default_compile_flags_feature = feature(
name = "default_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-mlinker-version=400",
"-B " + osxcross + "bin",
"-nostdinc",
"-U_FORTIFY_SOURCE",
"-fstack-protector",
"-fno-omit-frame-pointer",
"-fcolor-diagnostics",
"-Wall",
"-Wthread-safety",
"-Wself-assign",
] + system_include_flags,
),
],
),
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [flag_group(flags = ["-g", "-fstandalone-debug"])],
with_features = [with_feature_set(features = ["dbg"])],
),
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-g0",
"-O2",
"-D_FORTIFY_SOURCE=1",
"-DNDEBUG",
"-ffunction-sections",
"-fdata-sections",
],
),
],
with_features = [with_feature_set(features = ["opt"])],
),
flag_set(
actions = ALL_CPP_COMPILE_ACTIONS,
flag_groups = [flag_group(flags = ["-std=c++17", "-nostdinc++"])],
),
],
)
default_link_flags_feature = feature(
name = "default_link_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_LINK_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-v",
"-lm",
"-no-canonical-prefixes",
"-lc++",
"-lc++abi",
"-F" + sdkroot + "System/Library/Frameworks/",
"-L"+ sdkroot + "usr/lib",
"-undefined",
"dynamic_lookup",
],
),
],
),
],
)
objcopy_embed_flags_feature = feature(
name = "objcopy_embed_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ["objcopy_embed_data"],
flag_groups = [flag_group(flags = ["-I", "binary"])],
),
],
)
user_compile_flags_feature = feature(
name = "user_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
expand_if_available = "user_compile_flags",
flags = ["%{user_compile_flags}"],
iterate_over = "user_compile_flags",
),
],
),
],
)
coverage_feature = feature(
name = "coverage",
flag_sets = [
flag_set(
actions = ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = ["-fprofile-instr-generate", "-fcoverage-mapping"],
),
],
),
flag_set(
actions = ALL_LINK_ACTIONS,
flag_groups = [flag_group(flags = ["-fprofile-instr-generate"])],
),
],
provides = ["profile"],
)
features = [
opt_feature,
fastbuild_feature,
dbg_feature,
random_seed_feature,
supports_pic_feature,
supports_dynamic_linker_feature,
unfiltered_compile_flags_feature,
default_link_flags_feature,
default_compile_flags_feature,
objcopy_embed_flags_feature,
user_compile_flags_feature,
coverage_feature,
]
tool_paths = [
tool_path(name = "ld", path = osxcross_binprefix + "ld"),
tool_path(name = "cpp", path = tool_cpp),
tool_path(name = "dwp", path = "/usr/bin/dwp"),
tool_path(name = "gcov", path = "/usr/bin/gcov"),
tool_path(name = "nm", path = osxcross_binprefix + "nm"),
tool_path(name = "objdump", path = osxcross_binprefix + "ObjectDump"),
tool_path(name = "strip", path = osxcross_binprefix + "strip"),
tool_path(name = "gcc", path = tool_gcc),
tool_path(name = "ar", path = osxcross_binprefix + "libtool"),
]
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
abi_version = abi_version,
abi_libc_version = abi_libc_version,
compiler = compiler,
cxx_builtin_include_directories = cross_system_include_dirs,
host_system_name = "x86_64-unknown-linux-gnu",
target_cpu = target_cpu,
target_libc = target_libc,
target_system_name = ctx.attr.target,
tool_paths = tool_paths,
toolchain_identifier = toolchain_identifier,
)
osx_cc_toolchain_config = rule(
implementation = _impl,
attrs = {
"target": attr.string(mandatory = True),
"target_cpu": attr.string(mandatory = True),
"stdlib": attr.string(),
},
provides = [CcToolchainConfigInfo],
)

View File

@ -1,217 +0,0 @@
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"feature",
"feature_set",
"flag_group",
"flag_set",
"make_variable",
"tool",
"tool_path",
"with_feature_set",
"artifact_name_pattern",
"env_set",
"env_entry",
)
load(
"@bazel_tools//tools/cpp:cc_toolchain_config.bzl",
ALL_COMPILE_ACTIONS = "all_compile_actions",
ALL_CPP_COMPILE_ACTIONS = "all_cpp_compile_actions",
ALL_LINK_ACTIONS = "all_link_actions",
)
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
def _impl(ctx):
toolchain_identifier = "msys_x64_mingw"
host_system_name = "local"
target_system_name = "local"
target_cpu = "x64_windows"
target_libc = "mingw"
compiler = "mingw-gcc"
abi_version = "local"
abi_libc_version = "local"
cc_target_os = None
builtin_sysroot = None
action_configs = []
install = "/usr/x86_64-w64-mingw32/"
gcc_libpath = "/usr/lib/gcc/x86_64-w64-mingw32/10-win32/"
bin_prefix = "/usr/bin/x86_64-w64-mingw32-"
targets_windows_feature = feature(
name = "targets_windows",
implies = ["copy_dynamic_libraries_to_binary"],
enabled = True,
)
copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary")
gcc_env_feature = feature(
name = "gcc_env",
enabled = True,
env_sets = [
env_set(
actions = [
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.cpp_link_executable,
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
ACTION_NAMES.cpp_link_static_library,
],
env_entries = [
env_entry(key = "PATH", value = "NOT_USED"),
],
),
],
)
msys_mingw_flags = [
"-B " + install + "bin",
"-nostdinc",
"-U_FORTIFY_SOURCE",
"-fstack-protector",
"-fno-omit-frame-pointer",
"-fcolor-diagnostics",
"-Wall",
"-Wthread-safety",
"-Wself-assign",
"-x c++",
"-lstdc++",
"-lpthread"
]
msys_mingw_link_flags = [
"-l:libstdc++.a",
"-L" + install + "lib",
"-L/usr/lib/gcc/x86_64-w64-mingw32/8.3-w32",
"-v",
"-lm",
"-no-canonical-prefixes",
]
default_compile_flags_feature = feature(
name = "default_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = [
ACTION_NAMES.assemble,
ACTION_NAMES.preprocess_assemble,
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.c_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.lto_backend,
ACTION_NAMES.clif_match,
],
),
flag_set(
actions = [
ACTION_NAMES.linkstamp_compile,
ACTION_NAMES.cpp_compile,
ACTION_NAMES.cpp_header_parsing,
ACTION_NAMES.cpp_module_compile,
ACTION_NAMES.cpp_module_codegen,
ACTION_NAMES.lto_backend,
ACTION_NAMES.clif_match,
],
flag_groups = ([flag_group(flags = msys_mingw_flags)] if msys_mingw_flags else []),
),
],
)
compiler_param_file_feature = feature(
name = "compiler_param_file",
)
default_link_flags_feature = feature(
name = "default_link_flags",
enabled = True,
flag_sets = [
flag_set(
actions = ALL_LINK_ACTIONS,
flag_groups = ([flag_group(flags = msys_mingw_link_flags)] if msys_mingw_link_flags else []),
),
],
)
supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
features = [
targets_windows_feature,
copy_dynamic_libraries_to_binary_feature,
gcc_env_feature,
default_compile_flags_feature,
compiler_param_file_feature,
default_link_flags_feature,
supports_dynamic_linker_feature,
]
cxx_builtin_include_directories = [
install +"include",
gcc_libpath +"include",
gcc_libpath +"include-fixed",
"/usr/share/mingw-w64/include/"
]
artifact_name_patterns = [
artifact_name_pattern(
category_name = "executable",
prefix = "",
extension = ".exe",
),
]
make_variables = []
tool_paths = [
tool_path(name = "ld", path = bin_prefix + "ld"),
tool_path(name = "cpp", path = bin_prefix + "cpp"),
tool_path(name = "gcov", path = "/usr/bin/gcov"),
tool_path(name = "nm", path = bin_prefix + "nm"),
tool_path(name = "objcopy", path = bin_prefix + "objcopy"),
tool_path(name = "objdump", path = bin_prefix + "objdump"),
tool_path(name = "strip", path = bin_prefix + "strip"),
tool_path(name = "gcc", path = bin_prefix + "gcc"),
tool_path(name = "ar", path = bin_prefix + "ar"),
]
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
action_configs = action_configs,
artifact_name_patterns = artifact_name_patterns,
cxx_builtin_include_directories = cxx_builtin_include_directories,
toolchain_identifier = toolchain_identifier,
host_system_name = host_system_name,
target_system_name = target_system_name,
target_cpu = target_cpu,
target_libc = target_libc,
compiler = compiler,
abi_version = abi_version,
abi_libc_version = abi_libc_version,
tool_paths = tool_paths,
make_variables = make_variables,
builtin_sysroot = builtin_sysroot,
cc_target_os = cc_target_os,
)
windows_cc_toolchain_config = rule(
implementation = _impl,
attrs = {
"target": attr.string(mandatory = True),
"stdlib": attr.string(),
},
provides = [CcToolchainConfigInfo],
)

View File

@ -1,4 +1,4 @@
# Copyright 2016 The Bazel Authors. All rights reserved.
# Copyright 2020 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,36 +12,36 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is auto-generated by an rbe_autoconfig repository rule
# This file is auto-generated by github.com/bazelbuild/bazel-toolchains/pkg/rbeconfigsgen
# and should not be modified directly.
# See @bazel_toolchains//rules:rbe_repo.bzl
package(default_visibility = ["//visibility:public"])
toolchain(
name = "cc-toolchain",
exec_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@platforms//os:linux",
"@platforms//cpu:x86_64",
"@bazel_tools//tools/cpp:clang",
],
target_compatible_with = [
"@bazel_tools//platforms:linux",
"@bazel_tools//platforms:x86_64",
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
toolchain = "//tools/cross-toolchain/configs/clang/bazel_5.3.0/cc:cc-compiler-k8",
toolchain = "//cc:cc-compiler-k8",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
platform(
name = "platform",
constraint_values = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@platforms//os:linux",
"@platforms//cpu:x86_64",
"@bazel_tools//tools/cpp:clang",
],
exec_properties = {
"container-image": "docker://gcr.io/prysmaticlabs/rbe-worker@sha256:9e04c71268adeb4028b4016ca8cc02d134c2e5d7e3a53fdc68154d1797bb3d70",
"container-image": "docker://gcr.io/prysmaticlabs/rbe-worker@sha256:90d490709a0fb0c817569f37408823a0490e5502cbecc36415caabfc36a0c2e8",
"OSFamily": "Linux",
},
parents = ["@local_config_platform//:host"],
)

View File

@ -1,4 +1,4 @@
# Copyright 2016 The Bazel Authors. All rights reserved.
# Copyright 2020 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -12,15 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is auto-generated by an rbe_autoconfig repository rule
# This file is auto-generated by github.com/bazelbuild/bazel-toolchains/pkg/rbeconfigsgen
# and should not be modified directly.
# See @bazel_toolchains//rules:rbe_repo.bzl
load("@bazel_tools//tools/jdk:local_java_repository.bzl", "local_java_runtime")
package(default_visibility = ["//visibility:public"])
java_runtime(
alias(
name = "jdk",
srcs = [],
java_home = "/usr/lib/jvm/java-8-openjdk-amd64",
tags = ["manual"],
actual = "rbe_jdk",
)
local_java_runtime(
name = "rbe_jdk",
java_home = "/usr/lib/jvm/java-17-openjdk-amd64/",
version = "17.0.6",
)

View File

@ -1,16 +0,0 @@
# Generated file, do not modify by hand
# Generated by 'rbe_ubuntu_clang_gen' rbe_autoconfig rule
"""Definitions to be used in rbe_repo attr of an rbe_autoconf rule """
toolchain_config_spec0 = struct(config_repos = ["prysm_toolchains"], create_cc_configs = True, create_java_configs = True, env = {"BAZEL_COMPILER": "clang", "BAZEL_LINKLIBS": "-l%:libstdc++.a", "BAZEL_LINKOPTS": "-lm:-static-libgcc", "BAZEL_USE_LLVM_NATIVE_COVERAGE": "1", "GCOV": "llvm-profdata", "CC": "clang", "CXX": "clang++"}, java_home = "/usr/lib/jvm/java-8-openjdk-amd64", name = "clang")
_TOOLCHAIN_CONFIG_SPECS = [toolchain_config_spec0]
_BAZEL_TO_CONFIG_SPEC_NAMES = {"5.3.0": ["clang"]}
LATEST = "sha256:9e04c71268adeb4028b4016ca8cc02d134c2e5d7e3a53fdc68154d1797bb3d70"
CONTAINER_TO_CONFIG_SPEC_NAMES = {"sha256:9e04c71268adeb4028b4016ca8cc02d134c2e5d7e3a53fdc68154d1797bb3d70": ["clang"]}
_DEFAULT_TOOLCHAIN_CONFIG_SPEC = toolchain_config_spec0
TOOLCHAIN_CONFIG_AUTOGEN_SPEC = struct(
bazel_to_config_spec_names_map = _BAZEL_TO_CONFIG_SPEC_NAMES,
container_to_config_spec_names_map = CONTAINER_TO_CONFIG_SPEC_NAMES,
default_toolchain_config_spec = _DEFAULT_TOOLCHAIN_CONFIG_SPEC,
latest_container = LATEST,
toolchain_config_specs = _TOOLCHAIN_CONFIG_SPECS,
)

View File

@ -0,0 +1,9 @@
{
"BAZEL_COMPILER": "clang",
"BAZEL_LINKLIBS": "-l%:libstdc++.a",
"BAZEL_LINKOPTS": "-lm:-static-libgcc",
"BAZEL_USE_LLVM_NATIVE_COVERAGE": "1",
"GCOV": "llvm-profdata",
"CC": "clang",
"CXX": "clang++"
}

View File

@ -1,18 +0,0 @@
_BAZEL_TO_CONFIG_SPEC_NAMES = {}
# sha256 digest of the latest version of the toolchain container.
LATEST = ""
_CONTAINER_TO_CONFIG_SPEC_NAMES = {}
_DEFAULT_TOOLCHAIN_CONFIG_SPEC = ""
_TOOLCHAIN_CONFIG_SPECS = []
TOOLCHAIN_CONFIG_AUTOGEN_SPEC = struct(
bazel_to_config_spec_names_map = _BAZEL_TO_CONFIG_SPEC_NAMES,
container_to_config_spec_names_map = _CONTAINER_TO_CONFIG_SPEC_NAMES,
default_toolchain_config_spec = _DEFAULT_TOOLCHAIN_CONFIG_SPEC,
latest_container = LATEST,
toolchain_config_specs = _TOOLCHAIN_CONFIG_SPECS,
)

View File

@ -1,102 +0,0 @@
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
load("@prysm//tools/cross-toolchain:configs/versions.bzl", _generated_toolchain_config_suite_autogen_spec = "TOOLCHAIN_CONFIG_AUTOGEN_SPEC")
_PRYSM_BUILD_IMAGE_REGISTRY = "gcr.io"
_PRYSM_BUILD_IMAGE_REPOSITORY = "prysmaticlabs/rbe-worker"
_PRYSM_BUILD_IMAGE_DIGEST = "sha256:9e04c71268adeb4028b4016ca8cc02d134c2e5d7e3a53fdc68154d1797bb3d70"
_PRYSM_BUILD_IMAGE_JAVA_HOME = "/usr/lib/jvm/java-8-openjdk-amd64"
_CONFIGS_OUTPUT_BASE = "tools/cross-toolchain/configs"
_CLANG_ENV = {
"BAZEL_COMPILER": "clang",
"BAZEL_LINKLIBS": "-l%:libstdc++.a",
"BAZEL_LINKOPTS": "-lm:-static-libgcc",
"BAZEL_USE_LLVM_NATIVE_COVERAGE": "1",
"GCOV": "llvm-profdata",
"CC": "clang",
"CXX": "clang++",
}
_GCC_ENV = {
"BAZEL_COMPILER": "gcc",
"BAZEL_LINKLIBS": "-l%:libstdc++.a",
"BAZEL_LINKOPTS": "-lm:-static-libgcc",
"CC": "gcc",
"CXX": "g++",
}
_TOOLCHAIN_CONFIG_SUITE_SPEC = {
"container_registry": _PRYSM_BUILD_IMAGE_REGISTRY,
"container_repo": _PRYSM_BUILD_IMAGE_REPOSITORY,
"output_base": _CONFIGS_OUTPUT_BASE,
"repo_name": "prysm",
"toolchain_config_suite_autogen_spec": _generated_toolchain_config_suite_autogen_spec,
}
def _rbe_toolchains_generator():
rbe_autoconfig(
name = "rbe_ubuntu_clang_gen",
digest = _PRYSM_BUILD_IMAGE_DIGEST,
export_configs = True,
java_home = _PRYSM_BUILD_IMAGE_JAVA_HOME,
registry = _PRYSM_BUILD_IMAGE_REGISTRY,
repository = _PRYSM_BUILD_IMAGE_REPOSITORY,
env = _CLANG_ENV,
toolchain_config_spec_name = "clang",
toolchain_config_suite_spec = _TOOLCHAIN_CONFIG_SUITE_SPEC,
use_checked_in_confs = "False",
config_repos = [
"prysm_toolchains",
],
use_legacy_platform_definition = False,
exec_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@bazel_tools//tools/cpp:clang",
],
)
rbe_autoconfig(
name = "rbe_ubuntu_gcc_gen",
digest = _PRYSM_BUILD_IMAGE_DIGEST,
export_configs = True,
java_home = _PRYSM_BUILD_IMAGE_JAVA_HOME,
registry = _PRYSM_BUILD_IMAGE_REGISTRY,
repository = _PRYSM_BUILD_IMAGE_REPOSITORY,
env = _GCC_ENV,
toolchain_config_spec_name = "gcc",
toolchain_config_suite_spec = _TOOLCHAIN_CONFIG_SUITE_SPEC,
use_checked_in_confs = "False",
config_repos = [
"prysm_toolchains",
],
use_legacy_platform_definition = False,
exec_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@bazel_tools//tools/cpp:gcc",
],
)
def _generated_rbe_toolchains():
rbe_autoconfig(
name = "rbe_ubuntu_clang",
digest = _PRYSM_BUILD_IMAGE_DIGEST,
export_configs = True,
java_home = _PRYSM_BUILD_IMAGE_JAVA_HOME,
registry = _PRYSM_BUILD_IMAGE_REGISTRY,
repository = _PRYSM_BUILD_IMAGE_REPOSITORY,
toolchain_config_spec_name = "clang",
toolchain_config_suite_spec = _TOOLCHAIN_CONFIG_SUITE_SPEC,
use_checked_in_confs = "Force",
use_legacy_platform_definition = False,
exec_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@bazel_tools//tools/cpp:clang",
],
)
def rbe_toolchains_config():
_rbe_toolchains_generator()
_generated_rbe_toolchains()

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -e
export RBE_AUTOCONF_ROOT=$(bazel info workspace)
rm -rf "${RBE_AUTOCONF_ROOT}/tools/cross-toolchain/configs/*"
cp -vf "${RBE_AUTOCONF_ROOT}/tools/cross-toolchain/empty.bzl" "${RBE_AUTOCONF_ROOT}/tools/cross-toolchain/configs/versions.bzl"
# Bazel query is the right command so bazel won't fail itself.
bazel query "@rbe_ubuntu_clang_gen//..."

View File

@ -46,6 +46,7 @@ pkg_deb(
package = "prysm-validator",
postinst = "postinst.sh",
preinst = "preinst.sh",
tags = ["no-remote"],
version_file = "//runtime:version_file",
visibility = ["//validator:__pkg__"],
)