Honour LLVM_PATH in the macOS Bazel toolchain configuration

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.1.0-rc0, 9.1.0-rc1022
    • Affects Version/s: None
    • Component/s: Bazel, Build
    • None
    • DevProd Build
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      bazel/toolchains/cc/mongo_apple/mongo_apple_toolchain.bzl declares LLVM_PATH in the mongo_apple_brew_llvm_toolchain_config repository rule's environ list, but _get_llvm_info() never reads it. The compiler prefix is always resolved through brew --prefix llvm@$LLVM_VERSION.

      As a result the macOS toolchain can only be pointed at a Homebrew-managed LLVM whose formula matches the version pinned in .bazelrc. An LLVM installed elsewhere - for example the Xcode / CommandLineTools clang - cannot be selected, even though the environment variable to do so is already declared.

      Proposed change: read LLVM_PATH in _get_llvm_info() and use it directly as the prefix when set, falling back to the existing brew --prefix lookup otherwise. Add a matching LLD_PATH for the lld prefix, which _get_lld_info() resolves separately via brew --prefix lld@$LLVM_VERSION.

            Assignee:
            Unassigned
            Reporter:
            Alex Blekhman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: