Skip to content
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 support for LLVM toolchain #2014

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fzakaria
Copy link
Contributor

We should strive to make our Bazel builds as hermetic as possible. Bazel has support for toolchains
(https://bazel.build/extending/toolchains) which I admit are a bit more advanced than I am familiar with.

Fortunately, there seems to be a community contribution, for a toolchain that is provided for LLVM.

I picked a version that is quite old (11.1) since some of our developers at Google are on 20.04 LTS.

Alternate approach is to use something like https://nixos.org/ to bring in toolchains.

We should strive to make our Bazel builds as hermetic as possible.
Bazel has support for toolchains
(https://bazel.build/extending/toolchains) which I admit are a bit more
advanced than I am familiar with.

Fortunately, there seems to be a community contribution, for a toolchain
that is provided for LLVM.

I picked a version that is quite old (11.1) since some of our developers
at Google are on 20.04 LTS.
@sdasgup3 sdasgup3 self-requested a review February 15, 2024 19:54
Copy link
Member

@sdasgup3 sdasgup3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the making the bazel build more predictable.

@@ -4,6 +4,7 @@
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
bazel_dep(name = "toolchains_llvm", version = "0.10.3")
bazel_dep(name = "bazel_skylib", version = "1.3.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we need to change the bazel_skylib version here to 1.4.2

@steeve
Copy link

steeve commented Feb 15, 2024

We build stablehlo using https://github.com/uber/hermetic_cc_toolchain with great success

# Make sure we don't pickup the default CPP toolchains
build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# Not needed after https://github.com/bazelbuild/bazel/issues/7260 is closed
build --incompatible_enable_cc_toolchain_resolution
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline at eof

@fzakaria
Copy link
Contributor Author

fzakaria commented Mar 4, 2024

I'm going to pause on this PR -- I should contribute for bazel-contrib/toolchains_llvm#275 so that it's a bit more straightforward for us at Google.

@ghpvnist ghpvnist added the Build label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants