-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update cross compile toolchains #12069
Changes from all commits
a0afcc1
3e4da86
f99652a
d99efd7
5194b8c
ee2dde0
fee76ce
01d49e7
7ec5eb0
317eb00
386d1f7
7b371fc
170f499
253965b
5cb9ac1
4448e49
83ed2c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,24 +11,71 @@ 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: | | ||
Comment on lines
-17
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting changes here, it looks good on widescreen, i promise! |
||
|
||
The configurations above are enforced via pull request presubmit checks. | ||
|
||
### Bazel config flag values | ||
|
||
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 ` | | ||
Comment on lines
+76
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting changes here, it looks good on widescreen, i promise! |
||
| 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 | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These flags were deprecated in bazel 5.0.0. See bazelbuild/bazel#7849