1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2026-06-13 04:35:58 +02:00
Files
Martin Geisler 90e9146eaf bazel: Configure LLVM toolchain (#3204)
I noticed warnings when compiling Rust code both locally and in GitHub
CI:

> INFO: From Compiling Rust bin mdbook-exerciser (1 file):
> warning: the gold linker is deprecated and has known bugs with Rust
>  |
>  = help: consider using LLD or ld from GNU binutils instead

From what I understands, this is because we haven't configured any C/C++
toolchain for Bazel and it thus picks up what is on the CI runner image.

Configuring `toolchains_llvm` fixes the warnings and ensures a hermetic
build.
2026-06-11 10:37:32 +00:00

33 lines
814 B
Python

module(
name = "comprehensive-rust",
version = "0.1.0",
)
bazel_dep(name = "rules_rust", version = "0.70.0")
bazel_dep(name = "toolchains_llvm", version = "1.7.0")
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2024",
)
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
name = "llvm_toolchain",
llvm_version = "21.1.8",
)
use_repo(llvm, "llvm_toolchain")
register_toolchains("@llvm_toolchain//:all")
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "crates",
cargo_lockfile = "//:Cargo.lock",
manifests = ["//:Cargo.toml"],
)
use_repo(crate, "crates")