Skip to content

Commit

Permalink
zetasql: Disable @toolchain_llvm rules
Browse files Browse the repository at this point in the history
These rules will attempt to download an LLVM toolchain for
the detected OS, but LLVM does not currently provide builds
for Wolfi OS, so the build errors out (see below[*]).
We build zetasql with GCC, so we don't need LLVM at all and
can just disable these rules.

Here we disable them by way of applying a patch. Patches
add to our maintenance burden, so this is not ideal. It
would be better if upstream made these rules conditional
on the user-selected toolchain.

[*]
2025/01/21 18:36:50 WARN Loading:
2025/01/21 18:36:50 WARN Loading: 0 packages loaded
2025/01/21 18:36:50 WARN DEBUG: /home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/io_grpc_grpc_java/java_grpc_library.bzl:203:14: Multiple values in 'deps' is deprecated in local_service_java_grpc
2025/01/21 18:36:50 WARN Analyzing: 1298 targets (34 packages loaded, 0 targets configured)
2025/01/21 18:36:51 WARN INFO: Repository llvm_toolchain_llvm instantiated at:
2025/01/21 18:36:51 WARN   /home/build/WORKSPACE:85:20: in <toplevel>
2025/01/21 18:36:51 WARN   /home/build/bazel/zetasql_deps_step_1.bzl:33:19: in zetasql_deps_step_1
2025/01/21 18:36:51 WARN   /home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/toolchains_llvm/toolchain/rules.bzl:50:13: in llvm_toolchain
2025/01/21 18:36:51 WARN Repository rule llvm defined at:
2025/01/21 18:36:51 WARN   /home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/toolchains_llvm/toolchain/rules.bzl:27:23: in <toplevel>
2025/01/21 18:36:51 WARN ERROR: An error occurred during the fetch of repository 'llvm_toolchain_llvm':
2025/01/21 18:36:51 WARN    Traceback (most recent call last):
2025/01/21 18:36:51 WARN     File "/home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/toolchains_llvm/toolchain/internal/repo.bzl", line 303, column 35, in llvm_repo_impl
2025/01/21 18:36:51 WARN         updated_attrs = _download_llvm(rctx)
2025/01/21 18:36:51 WARN     File "/home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/toolchains_llvm/toolchain/internal/llvm_distributions.bzl", line 535, column 56, in download_llvm
2025/01/21 18:36:51 WARN         urls, sha256, strip_prefix = _distribution_urls(rctx)
2025/01/21 18:36:51 WARN     File "/home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/toolchains_llvm/toolchain/internal/llvm_distributions.bzl", line 573, column 38, in _distribution_urls
2025/01/21 18:36:51 WARN         basename = _llvm_release_name(rctx, llvm_version)
2025/01/21 18:36:51 WARN     File "/home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/toolchains_llvm/toolchain/internal/release_name.bzl", line 209, column 22, in llvm_release_name
2025/01/21 18:36:51 WARN         return _linux(llvm_version, os, version, arch)
2025/01/21 18:36:51 WARN     File "/home/build/.cache/bazel/_bazel_build/79a1bfc8c8b5b6a6d226b38d072f165b/external/toolchains_llvm/toolchain/internal/release_name.bzl", line 182, column 13, in _linux
2025/01/21 18:36:51 WARN         fail("Unsupported linux distribution and version: %s, %s" % (distname, version))
2025/01/21 18:36:51 WARN Error in fail: Unsupported linux distribution and version: wolfi, 20230201

Signed-off-by: dann frazier <[email protected]>
  • Loading branch information
dannf committed Jan 23, 2025
1 parent 01199bf commit bcced8e
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion zetasql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pipeline:

- uses: patch
with:
patches: multi-arch-for-linux.patch
patches: multi-arch-for-linux.patch no-llvm-deps.patch

- runs: |
cd zetasql
Expand Down
70 changes: 70 additions & 0 deletions zetasql/no-llvm-deps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
diff --git a/WORKSPACE b/WORKSPACE
index 994ce010..a792ed32 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -37,14 +37,6 @@ workspace(name = "com_google_zetasql")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

-http_archive(
- name = "toolchains_llvm",
- canonical_id = "1.0.0",
- sha256 = "e91c4361f99011a54814e1afbe5c436e0d329871146a3cd58c23a2b4afb50737",
- strip_prefix = "toolchains_llvm-1.0.0",
- url = "https://github.com/bazel-contrib/toolchains_llvm/releases/download/1.0.0/toolchains_llvm-1.0.0.tar.gz",
-)
-
http_archive(
name = "rules_jvm_external",
sha256 = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6",
diff --git a/bazel/zetasql_deps_step_1.bzl b/bazel/zetasql_deps_step_1.bzl
index 825bf8ea..87d0fdb8 100644
--- a/bazel/zetasql_deps_step_1.bzl
+++ b/bazel/zetasql_deps_step_1.bzl
@@ -22,26 +22,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# but depend on them being something different. So we have to override them both
# by defining the repo first.
load("@com_google_zetasql//bazel:zetasql_bazel_version.bzl", "zetasql_bazel_version")
-load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
-load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")

def zetasql_deps_step_1(add_bazel_version = True):
if add_bazel_version:
zetasql_bazel_version()

- bazel_toolchain_dependencies()
- llvm_toolchain(
- name = "llvm_toolchain",
- llvm_versions = {
- "": "16.0.0",
- # The LLVM repo stops providing pre-built binaries for the MacOS x86_64
- # architecture for versions >= 16.0.0: https://github.com/llvm/llvm-project/releases,
- # but our Kokoro MacOS tests are still using x86_64 (ventura).
- # TODO: Upgrade the MacOS version to sonoma-slcn.
- "darwin-x86_64": "15.0.7",
- },
- )
-
http_archive(
name = "io_bazel_rules_go",
integrity = "sha256-M6zErg9wUC20uJPJ/B3Xqb+ZjCPn/yxFF3QdQEmpdvg=",
diff --git a/bazel/zetasql_deps_step_2.bzl b/bazel/zetasql_deps_step_2.bzl
index 6873dbe9..2b6b01fa 100644
--- a/bazel/zetasql_deps_step_2.bzl
+++ b/bazel/zetasql_deps_step_2.bzl
@@ -19,7 +19,6 @@
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
-load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
load("@rules_bison//bison:bison.bzl", "bison_register_toolchains")
load("@rules_flex//flex:flex.bzl", "flex_register_toolchains")
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
@@ -29,7 +28,6 @@ load("@rules_proto//proto:setup.bzl", "rules_proto_setup")
load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")

def _load_deps_from_step_1():
- llvm_register_toolchains()
rules_foreign_cc_dependencies()

def textmapper_dependencies():

0 comments on commit bcced8e

Please sign in to comment.