bazel-contrib / rules_jsonnet

Jsonnet rules for Bazel
https://bazelbuild.github.io/rules_jsonnet/
Apache License 2.0
68 stars 73 forks source link

no matching toolchains found for types #164

Closed schwehr closed 7 months ago

schwehr commented 1 year ago

This is seen on a Mac Book M1. I've done things from scratch using homebrew on an x86 mac and don't have the issue.

This looks to be trouble with things that are built for x86 and then hitting arm with the mac? Is there some easy way to get this to work?

bazel test //...

ERROR: /private/var/tmp/_bazel_USERNAME/4a5433d4170f6762643f428698e8cc02/external/google_jsonnet_go/cmd/jsonnet/BUILD.bazel:15:10: While resolving toolchains for target @google_jsonnet_go//cmd/jsonnet:jsonnet: no matching toolchains found for types @io_bazel_rules_go//go:toolchain

ERROR: Analysis of target '//catalog:jsonnet_to_json_AHN_AHN_AHN2_05M_NON.jsonnet' failed; build aborted: 
type bazelisk
bazelisk is /opt/homebrew/bin/bazelisk

bazelisk --version
bazel 5.3.2

type bazel
bazel is /opt/homebrew/bin/bazel

bazel --version
bazel 5.3.2

type jsonnet
jsonnet is /opt/homebrew/bin/jsonnet

jsonnet --version
Jsonnet commandline interpreter v0.19.1

The WORKSPACE file:

https://github.com/google/earthengine-catalog/blob/4c44f52548abf6893391c21820f31983fd3a8712/WORKSPACE

# Bazel workspace for the Earth Engine Catalog.

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

http_archive(
    name = "io_bazel_rules_jsonnet",
    sha256 = "d20270872ba8d4c108edecc9581e2bb7f320afab71f8caa2f6394b5202e8a2c3",
    strip_prefix = "rules_jsonnet-0.4.0",
    urls = ["https://github.com/bazelbuild/rules_jsonnet/archive/0.4.0.tar.gz"],
)
load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_repositories")

jsonnet_repositories()

load("@google_jsonnet_go//bazel:repositories.bzl", "jsonnet_go_repositories")

jsonnet_go_repositories()

load("@google_jsonnet_go//bazel:deps.bzl", "jsonnet_go_dependencies")

jsonnet_go_dependencies()
EdSchouten commented 7 months ago

This specific issue is not specific to/caused by rules_jsonnet. Instead, it is caused by using versions of Bazel, rules_go, jsonnet-go, etc. that are not compatible with macOS running on Apple Silicon. If I take the earthengine-catalog repository, update .bazelversion, remove WORKSPACE and add MODULE.bazel with the following contents:

bazel_dep(name = "rules_jsonnet", version = "0.6.0", repo_name = "io_bazel_rules_jsonnet")

Then I am able to build all Jsonnet sources just fine. I am therefore going to close this issue. Thanks for reporting it regardless!