I'm trying to get a Bazel build working on my MacBook Pro M1 on Monterey, and I'm having a difficult time. When I try to build a docker image, I get go toolchain errors (with --toolchain_resolution_debug='go') that look like this:
INFO: ToolchainResolution: Type @io_bazel_rules_go//go:toolchain: target platform @local_config_platform//:host: Rejected toolchain @go-auto//:go_darwin_amd64-impl; mismatching values: x86_64
INFO: ToolchainResolution: Type @io_bazel_rules_go//go:toolchain: target platform @local_config_platform//:host: Rejected toolchain @go-auto//:go_darwin_arm-impl; mismatching values: arm
INFO: ToolchainResolution: Type @io_bazel_rules_go//go:toolchain: execution platform @local_config_platform//:host: Rejected toolchain @go-auto//:go_darwin_arm64-impl; mismatching values: x86_64
Why does it say it rejects an arm64 implementation because it's not x86_64? It seems like there's something broken here.
For reference, here's bazel version:
Bazelisk version: development
Build label: 5.2.0
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 7 16:11:09 2022 (1654618269)
Build timestamp: 1654618269
Build timestamp as int: 1654618269
And some relevant bits from my WORKSPACE:
http_archive(
name = "io_bazel_rules_docker",
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)
...
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "io_bazel_rules_k8s",
remote = "https://github.com/bazelbuild/rules_k8s.git",
# branch = "master",
commit = "fee80eb69e1921c076167ebebcf5eea3d2e9c707",
shallow_since = "1655492445 -0700",
)
load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_repositories")
k8s_repositories()
load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains()
go_download_sdk(
name = "go-auto",
)