-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add hermetic_cc_toolchain for a hermetic cc toolchain #12135
Conversation
build:llvm-asan --config=asan | ||
build:llvm-asan --linkopt -fuse-ld=ld.lld | ||
|
||
build:fuzz --@io_bazel_rules_go//go/config:tags=fuzz |
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.
just a note that we are removing fuzzing and the sanitize_address stuff is used for this.
build/bazelrc/zig-cc.bazelrc
Outdated
build --incompatible_enable_cc_toolchain_resolution | ||
|
||
# Add a no-op warning for users still using --config=llvm | ||
build:llvm --unconditional_warning="llvm config is no longer used as clang is now the default compiler" |
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.
we don't need to mention zig here at all right? even though it's using clang underneath?
WORKSPACE
Outdated
"@zig_sdk//toolchain:linux_arm64_gnu.2.31", | ||
"@zig_sdk//toolchain:darwin_amd64", | ||
"@zig_sdk//toolchain:darwin_arm64", | ||
"@zig_sdk//toolchain:windows_amd64", |
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.
+1 to your suggestion in huddle to rename this to match the upstream repo.
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.
I can't rename this one, it's a static value here: https://github.com/uber/hermetic_cc_toolchain/blob/bbd965d3ab0803475bd3bb9b59fb50c3451b5c71/toolchain/defs.bzl#L79
build/bazelrc/zig-cc.bazelrc
Outdated
@@ -0,0 +1,19 @@ | |||
# From Bazel's perspective, this is almost equivalent to always specifying |
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.
another thing to rename zig-cc.bazelrc
build/bazelrc/zig-cc.bazelrc
Outdated
build --incompatible_enable_cc_toolchain_resolution | ||
|
||
# Add a no-op warning for users still using --config=llvm | ||
build:llvm --unconditional_warning="llvm config is no longer used as clang is now the default compiler" |
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.
will this force a build failure with llvm or just display a warning (that could get missed in the piles of compiler output)?
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.
It is just a warning. Without some build:llvm
, the build will fail entirely when using --config=llvm
darwin arm64 currently failing with
Looks like ziglang/zig#10513 |
Windows fails to build too. I think the bazel rules for protoc are not compatible... I'm not sure we ever supported building on windows. |
Another blocker for mac amd64 ziglang/zig#15438 |
This reverts commit 7bb4b6b.
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.
was building fine locally so approving this
* Add bazel-zig-cc for a hermetic cc toolchain * gazelle * Remove llvm * remove wl * Add new URLs for renamed repo * gazelle * Update to v2.0.0-rc1 * bump to rc2 * Some PR feedback * use v2.0.0 from rc2 * Disable hermetic builds for mac and windows. * bump bazel version, add darwin hack * fix * Add the no-op emtpy cc toolchain code * typo and additional copy * update protobuf and fix vaticle warning * Revert "update protobuf and fix vaticle warning" This reverts commit 7bb4b6b. --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
What type of PR is this?
Other
What does this PR do? Why is it needed?
This PR introduces a replacement C/C++ toolchain for Prysm. Previously, we were using a LLVM toolchain from github.com/grailbio/bazel-toolchain and only when the user requested
--config=llvm
.This PR aims to solve two problems:
Building C++ Depends on Host Tooling -- When building anything that depends on C or C++ code in prysm, bazel will use the host machine gcc. This can cause undesired behavior where identical builds on different linux machines result in different outputs. Namely, if your host is using a recent version of gcc then non-backwards compatible glibc libraries will be requested. See #7750 for an example. This behavior is non-hermetic and violates the desired principal of reproducible builds.
llvm Config Doesn't Work on Many OSes -- The way that the existing cc toolchain works is that it downloads an appropriate version of llvm based on the host's OS. Some users have complained that the LLVM toolchain fails when using an operating system like Pop!OS or even Arch Linux. Again, this may be non-hermetic behavior as the host's OS should not influence how the CC toolchain compiles Prysm.
The key features/changes are:
Which issues(s) does this PR fix?
Supercedes #12100
Fixes #7750
Fixes #9515
Other notes for review
Testing plan
To test this PR, we want to see that the release assets will build and everything else should build, but some manual targets are expected to fail on some configurations. (Some things are linux only)
❌ Builds on windows amd64 (Not supported)
Additionally, we want to see cross compile continues to work on from linux amd64