You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use rules_go and Bazel to compile a Go program on an operating system with a RISC-V CPU architecture, and I want to use the locally installed Go to compile the example project in rules_go. Unfortunately, when I tried running the test program, I encountered the following issue:
[zjq@openeuler-riscv-4-4 basic-gazelle]$ bazel run //:basic-gazelle --@io_bazel_rules_go//go/toolchain:sdk_version="host"
INFO: Build options --@io_bazel_rules_go//go/toolchain:sdk_version and --toolchain_resolution_debug have changed, discarding analysis cache.
ERROR: /home/zjq/bazel_test/rules_go/examples/basic-gazelle/BUILD.bazel:29:10: While resolving toolchains for target //:basic-gazelle: No matching toolchains found for types @io_bazel_rules_go//go:toolchain.
To debug, rerun with --toolchain_resolution_debug='@io_bazel_rules_go//go:toolchain'
If platforms or toolchains are a new concept for you, we'd encourage reading https://bazel.build/concepts/platforms-intro.
ERROR: Analysis of target '//:basic-gazelle' failed; build aborted:
INFO: Elapsed time: 12.347s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 212 targets configured)
ERROR: Build failed. Not running target
After investigating related issues, I found one that closely matches my problem: issue. It was resolved by adding the parameter "ppc64": "@platforms//cpu:ppc" to BAZEL_GOARCH_CONSTRAINTS in rules_go/go/private/platforms.bzl. Should I do something similar, such as adding "riscv64": "@platforms//cpu:riscv64"?
I also ran the command bazel run //:basic-gazelle --toolchain_resolution_debug='.*', and the output showed:
I successfully ran the example program using the command: bazel run //:basic-gazelle --host_platform="@io_bazel_rules_go//go/toolchain:linux_riscv64" --platforms="@io_bazel_rules_go//go/toolchain:linux_riscv64".
I am attempting to use
rules_go
and Bazel to compile a Go program on an operating system with aRISC-V
CPU architecture, and I want to use the locally installed Go to compile the example project in rules_go. Unfortunately, when I tried running the test program, I encountered the following issue:After investigating related issues, I found one that closely matches my problem: issue. It was resolved by adding the parameter
"ppc64": "@platforms//cpu:ppc"
toBAZEL_GOARCH_CONSTRAINTS
inrules_go/go/private/platforms.bzl
. Should I do something similar, such as adding"riscv64": "@platforms//cpu:riscv64"
?I also ran the command
bazel run //:basic-gazelle --toolchain_resolution_debug='.*'
, and the output showed:INFO: ToolchainResolution: Type @io_bazel_rules_go//go:toolchain: target platform @local_config_platform//:host: Rejected toolchain @go_sdk//:go_linux_riscv64-impl; mismatching values: riscv64.
Additionally, please note that I have set
go_register_toolchains(go_version = "host")
in theWORKSPACE
file.The text was updated successfully, but these errors were encountered: