bazel-contrib / toolchains_llvm

LLVM toolchain for bazel
Apache License 2.0
301 stars 217 forks source link

Do not fail if not matching LLVM toolchain root is found #249

Closed gferon closed 7 months ago

gferon commented 9 months ago

This fixes one small, but quite important, difference between using the repository rule with or without bzlmod enabled.

Example:

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
    llvm_versions = {
        "linux-aarch64": "17.0.6",
        "linux-x86_64": "17.0.6",
    },
    sha256 = {
        "linux-aarch64": "6dd62762285326f223f40b8e4f2864b5c372de3f7de0731cb7cd55ca5287b75a",
        "linux-x86_64": "884ee67d647d77e58740c1e645649e29ae9e8a6fe87c1376be0f3a30f3cc9ab3",
    },
    stdlib = {
        "linux-aarch64": "stdc++",
        "linux-x86_64": "stdc++",
    },
    strip_prefix = {
        "linux-aarch64": "clang+llvm-17.0.6-aarch64-linux-gnu",
        "linux-x86_64": "clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04",
    },
    urls = {
        "linux-aarch64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-aarch64-linux-gnu.tar.xz"],
        "linux-x86_64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04.tar.xz"],
    },
)

and run the following on a Mac host (on which we want to use the Xcode LLVM toolchain from the system).

siddharthab commented 7 months ago

Thanks for the PR. Makes sense.