Skip to content

Surprising behavior based on inclusion of llvm_version #575

@rafikk

Description

@rafikk

I have a custom toolchain configured and working in MODULE.bazel:

bazel_dep(name = "toolchains_llvm", version = "1.5.0")

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
    name = "llvm_toolchain",
    sha256 = {
        "darwin-aarch64": "02fb0842f75ec34f3df2162c27d01773bd122cf27e01e9e051bb56f9edec66f1",
        "darwin-x86_64": "4b382146c4483cf68b730df3329a975505205dc73dc86cfe9f3bacad06e22d49",
        "linux-aarch64": "46af59ce8c53338d90b72c401b5560d44bbb02df118f0f0daf08bf897a05f1a9",
        "linux-x86_64": "acf8c45aaa3f012d1f140893b5760daafd5965635941a4999c68d2d04a8aae4f",
    },
    urls = {
        "darwin-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-20.1.6-1/darwin_aarch64.tar.zst"],
        "darwin-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-20.1.6-1/darwin_x86_64.tar.zst"],
        "linux-aarch64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-20.1.6-1/linux_aarch64.tar.zst"],
        "linux-x86_64": ["https://github.com/MaterializeInc/toolchains/releases/download/clang-20.1.6-1/linux_x86_64.tar.zst"],
    },
)
use_repo(llvm, "llvm_toolchain")

register_toolchains("@llvm_toolchain//:all")

Note that I'm not setting llvm_version. If I update the llvm.toolchain arguments to include llvm_version = "20.1.6" ...

 llvm.toolchain(
     name = "llvm_toolchain",
+    llvm_version = "20.1.6",
     sha256 = {
         "darwin-aarch64": "02fb0842f75ec34f3df2162c27d01773bd122cf27e01e9e051bb56f9edec66f1",
         "darwin-x86_64": "4b382146c4483cf68b730df3329a975505205dc73dc86cfe9f3bacad06e22d49",

... I receive the following errors as reported in #481.

ERROR: /private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_go+/BUILD.bazel:42:7: GoStdlib external/rules_go+/stdlib_/pkg failed: missing input file '@@toolchains_llvm++llvm+llvm_toolchain//:bin/clang-format'
ERROR: /private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_go+/BUILD.bazel:42:7: GoStdlib external/rules_go+/stdlib_/pkg failed: missing input file '@@toolchains_llvm++llvm+llvm_toolchain//:bin/clang-tidy'
ERROR: /private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_go+/BUILD.bazel:42:7: GoStdlib external/rules_go+/stdlib_/pkg failed: missing input file '@@toolchains_llvm++llvm+llvm_toolchain//:bin/clangd'
ERROR: /private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_go+/BUILD.bazel:42:7: GoStdlib external/rules_go+/stdlib_/pkg failed: 3 input file(s) do not exist
ERROR: /private/var/tmp/_bazel_rafiksalama/1d5a93ad130d5a2bb2604b5c76cd5ad7/external/rules_go+/BUILD.bazel:42:7 GoStdlib external/rules_go+/stdlib_/pkg failed: 3 input file(s) do not exist

And indeed the LLVM distribution I'm using does not include the required binaries.

But why am I able to configure and register the toolchain at all without llvm_version? I assumed the toolchain was configured and working properly, but now I'm wondering if that's actually the case. If it is registered properly, why are these errors only surfaced when llvm_version is set? If llvm_version is required, shouldn't the toolchain tag raise an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions