Open yicm opened 4 years ago
In general, this is expected to work. rules_go uses the platform and toolchain mechanism to select a Go toolchain, to configure GOOS
and GOARCH
, and to decide whether a C/C++ toolchain is needed for cgo or external linking. It shouldn't matter whether the C/C++ toolchain is configured with --cpu
or --platforms
; rules_go gets the same view of it either way. It just needs to match the target platform that rules_go expects.
The area where this gets a little tricky is setting up the platform
definitions. The targets in @io_bazel_rules_go//go/platform
are provided for convenience, but you can use your own. Whichever platform you use needs three constraint values:
@platforms//os
. This is needed to set GOOS
.@platforms//arch
. This is needed to set GOARCH
.@io_bazel_rules_go//go/toolchain:cgo_on
or @io_bazel_rules_go//go/toolchain:cgo_off
, depending on whether you want cgo.I would guess the last constraint is missing from your platforms. Does --toolchain_resolution_debug
give any useful output there?
I took a quick look at your example, but it's too large for me to read through it and audit for security in a reasonable amount of time. If you can give a more minimal example (like ~100 lines, no non-essential dependencies), I can take a look next week.
@jayconrod I added these three constraints to each custom native.platform
, and then --toolchain_resolution_debug
gave two results that matched ToolchainResolution
. It seemed that toolchain toolchain @go_sdk//:go_linux_arm-impl...
was selected first, and then custom toolchain toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain...
. The following is the complete compilation output information.
$ bazel build --platforms=//platforms:p_ubuntu_arm_linux_gnueabihf //golang/cmd/hello
output:
Loading:
Loading: 0 packages loaded
Analyzing: target //golang/cmd/hello:hello (1 packages loaded, 0 targets configured)
Analyzing: target //golang/cmd/hello:hello (14 packages loaded, 10 targets configured)
INFO: ToolchainResolution: Looking for toolchain of type @io_bazel_rules_go//go:toolchain...
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_aix_ppc64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:aix, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:ppc64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_aix_ppc64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_dragonfly_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:dragonfly, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_dragonfly_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_illumos_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:illumos, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_illumos_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_js_wasm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:js, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:wasm, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_js_wasm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_arm-impl...
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mips-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mips, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mips-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mips64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mips64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mips64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mips64le-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mips64le, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mips64le-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mipsle-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mipsle, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mipsle-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_ppc64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:ppc64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_ppc64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_ppc64le-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:ppc, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_ppc64le-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_riscv64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:riscv64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_riscv64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_s390x-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:s390x, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_s390x-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_nacl_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:nacl, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_nacl_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_nacl_amd64p32-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:nacl, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:amd64p32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_nacl_amd64p32-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_nacl_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:nacl, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_nacl_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_plan9_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:plan9, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_plan9_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_plan9_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:plan9, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_plan9_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_plan9_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:plan9, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_plan9_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_solaris_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:solaris, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_solaris_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_windows_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:windows, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_windows_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_windows_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:windows, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_windows_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_windows_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:windows, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_windows_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: For toolchain type @io_bazel_rules_go//go:toolchain, possible execution platforms and toolchains: {@local_config_platform//:host -> @go_sdk//:go_linux_arm-impl}
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_arm-impl
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host,
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host,
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/cpp:toolchain_type...
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_gcc_linux_x86_64_gcc__cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_gcc, which does not match value //platforms/devices:ubuntu_arm_linux_gnueabihf from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_gcc_linux_x86_64_gcc__cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_clang_linux_x86_64_clang__cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_clang, which does not match value //platforms/devices:ubuntu_arm_linux_gnueabihf from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_clang_linux_x86_64_clang__cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain...
INFO: ToolchainResolution: Considering toolchain @local_config_cc//:cc-compiler-armeabi-v7a...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @local_config_cc//:cc-compiler-armeabi-v7a, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @local_config_cc//:cc-compiler-k8...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_64, which does not match value @platforms//cpu:arm from the target platform //platforms:p_ubuntu_arm_linux_gnueabihf
INFO: ToolchainResolution: Rejected toolchain @local_config_cc//:cc-compiler-k8, because of target platform mismatch
INFO: ToolchainResolution: For toolchain type @bazel_tools//tools/cpp:toolchain_type, possible execution platforms and toolchains: {@local_config_platform//:host -> //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain}
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/cpp:toolchain_type...
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_gcc_linux_x86_64_gcc__cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_gcc, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_gcc_linux_x86_64_gcc__cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_clang_linux_x86_64_clang__cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_clang, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_clang_linux_x86_64_clang__cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_arm_linux_gnueabihf, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @local_config_cc//:cc-compiler-armeabi-v7a...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @local_config_cc//:cc-compiler-armeabi-v7a, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @local_config_cc//:cc-compiler-k8...
INFO: ToolchainResolution: For toolchain type @bazel_tools//tools/cpp:toolchain_type, possible execution platforms and toolchains: {@local_config_platform//:host -> @local_config_cc//:cc-compiler-k8}
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-k8
INFO: ToolchainResolution: Looking for toolchain of type @io_bazel_rules_go//go:toolchain...
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_aix_ppc64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:aix, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:ppc64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_aix_ppc64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_android_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_android_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_darwin_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_darwin_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_dragonfly_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:dragonfly, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_dragonfly_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_freebsd_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:freebsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_freebsd_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_illumos_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:illumos, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_illumos_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_js_wasm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:js, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:wasm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_js_wasm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_amd64-impl...
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mips-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mips, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mips-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mips64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mips64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mips64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mips64le-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mips64le, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mips64le-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_mipsle-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:mipsle, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_mipsle-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_ppc64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:ppc64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_ppc64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_ppc64le-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:ppc, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_ppc64le-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_riscv64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:riscv64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_riscv64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_linux_s390x-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:s390x, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_linux_s390x-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_nacl_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:nacl, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_nacl_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_nacl_amd64p32-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:nacl, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @io_bazel_rules_go//go/toolchain:amd64p32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_nacl_amd64p32-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_nacl_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:nacl, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_nacl_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_netbsd_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:netbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_netbsd_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_openbsd_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:openbsd, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_openbsd_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_plan9_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:plan9, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_plan9_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_plan9_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:plan9, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_plan9_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_plan9_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:plan9, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_plan9_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_solaris_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @io_bazel_rules_go//go/toolchain:solaris, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_solaris_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_windows_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:windows, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_windows_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_windows_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:windows, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_windows_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_windows_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:windows, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_windows_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_arm-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_arm-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_arm64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:aarch64, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_arm64-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_386-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:x86_32, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_386-impl, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @go_sdk//:go_ios_amd64-impl...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:ios, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @go_sdk//:go_ios_amd64-impl, because of target platform mismatch
INFO: ToolchainResolution: For toolchain type @io_bazel_rules_go//go:toolchain, possible execution platforms and toolchains: {@local_config_platform//:host -> @go_sdk//:go_linux_amd64-impl}
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_amd64-impl
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host,
INFO: ToolchainResolution: Looking for toolchain of type @bazel_tools//tools/cpp:toolchain_type...
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_gcc_linux_x86_64_gcc__cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_gcc, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_gcc_linux_x86_64_gcc__cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_clang_linux_x86_64_clang__cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_clang, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_clang_linux_x86_64_clang__cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_arm_linux_gnueabihf, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @local_config_cc//:cc-compiler-armeabi-v7a...
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:android, which does not match value @platforms//os:linux from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain @local_config_cc//:cc-compiler-armeabi-v7a, because of target platform mismatch
INFO: ToolchainResolution: Considering toolchain @local_config_cc//:cc-compiler-k8...
INFO: ToolchainResolution: For toolchain type @bazel_tools//tools/cpp:toolchain_type, possible execution platforms and toolchains: {@local_config_platform//:host -> @local_config_cc//:cc-compiler-k8}
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-k8
Analyzing: target //golang/cmd/hello:hello (39 packages loaded, 6802 targets configured)
Analyzing: target //golang/cmd/hello:hello (39 packages loaded, 6802 targets configured)
INFO: Analyzed target //golang/cmd/hello:hello (67 packages loaded, 7248 targets configured).
INFO: Found 1 target...
[0 / 4] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[6 / 38] checking cached actions
Target //golang/cmd/hello:hello up-to-date:
bazel-bin/golang/cmd/hello/hello_/hello
INFO: Elapsed time: 8.660s, Critical Path: 2.70s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Looks like it selected both toolchains and the build succeeded. Any other problems or should this issue be closed?
@jayconrod But only one binary file is generated, and it is not generated by the compiler I want, how do I control only the toolchain I want?
What other binaries did you expect to be generated? The command line bazel build --platforms=//platforms:p_ubuntu_arm_linux_gnueabihf //golang/cmd/hello
only names one target, so I'd only expect to see the Go binary generated there.
What Go compiler did you expect it to use? It says it selected @go_sdk//:go_linux_arm-impl
for the target configuration, which seems correct.
What C compiler did you expect it to use? It says it selected //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain
for the target configuration. That also seems correct.
Your go_binary
doesn't seem to contain any cgo
code and isn't built in a way that would require external linking, so it should be configured to use the C compiler (CGO_ENABLED=1
and CC
will be set for each action), but I don't think it will actually be used.
Are you able to build a cc_binary
in this configuration?
@jayconrod Maybe I didn't make it clear, because at the end two prompts of successful compilation were output.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
How do I know which compiler was selected from the debugging information of --toolchain_resolution_debug
? I tested it and the binary file generated by the compilation is always the compiler bound to the platform I set, which meets my needs. I am just confused why more than one compiler is matched. In addition, I also tested whether CGO is turned on and off, and everything is normal.
Maybe I didn't make it clear, because at the end two prompts of successful compilation were output.
Not sure why that line is printed twice. Doesn't seem like a problem though?
How do I know which compiler was selected from the debugging information of --toolchain_resolution_debug? I tested it and the binary file generated by the compilation is always the compiler bound to the platform I set, which meets my needs. I am just confused why more than one compiler is matched. In addition, I also tested whether CGO is turned on and off, and everything is normal.
Look for lines containing the word "Selected" in the --toolchain_resolution_debug
output. These lines say which toolchain was selected for each toolchain type. The surrounding lines add context.
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_arm-impl
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-k8
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_amd64-impl
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-k8
Bazel considers three platforms when selecting toolchains: host (where Bazel runs), execution (where actions run), and target (where your binaries should run). It will attempt to select one toolchain of each type for each platform where it's required.
This shows that Go and C toolchains are selected for the execution and target platforms. A C toolchain is also selected for the host platform.
I can't speak for C, but Go often needs separate toolchains for execution and target in order to build code generation or analysis tools like protoc-gen-go. Although there are different toolchains as far as Bazel is considered, they're actually the same compiler / linker binaries, just with different GOOS
/ GOARCH
settings. Bazel doesn't tell us any information about the target platform, so we have to infer that from the toolchain that gets selected.
@jayconrod Please forgive me for persisting to the bottom of the matter ^_^.
Not sure why that line is printed twice. Doesn't seem like a problem though?
I only know that the compilation completion event is triggered twice here, but I don't know why it is triggered twice
Bazel considers three platforms when selecting toolchains......
I am even more confused 😕😖. I know from the official documentation that the host platform is automatically selected based on @local_config_platform//:host
, and it only indicates the platform on which the binary file Bazel runs. My current build scenario is a Cross-compilation builds
scenario, it means that the host and the execution platform are the same, but the target platform is different.
A C toolchain is also selected for the host platform.
The host platform I understand is just an environment for running the bazel binary, and has nothing to do with the specific build toolchain, as can be seen from the parameters of the toolchain(... exec_compatible_with, target_compatible_with, toolchain, toolchain_type ...)
rule.
This shows that Go and C toolchains are selected for the execution and target platforms.
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_arm-impl INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-k8 INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_amd64-impl INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain @local_config_cc//:cc-compiler-k8
Is the execution platform here related to the target_compatible_with
parameter of the toolchain
rule? I call it like this in the actual sample.
Interestingly, I actually tested and found that if the execution platform constraint OS of rule toolchain()
is inconsistent with the host platform OS, the Go target can be compiled successfully, but the C++ target will fail.
native.toolchain(
name = toolchain_name,
exec_compatible_with = [
# change the OS constraint value in here
"@platforms//os:%s" % bazel_exec_platform_info["os"],
"@platforms//cpu:%s" % bazel_exec_platform_info["cpu"],
],
target_compatible_with = [
"//platforms/devices:%s" % platform,
"@platforms//os:%s" % target_os,
"@platforms//cpu:%s" % target_arch,
"@io_bazel_rules_go//go/toolchain:cgo_%s" % target_cgo,
],
toolchain = "//toolchains/cpp:%s" % cc_name,
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
Finally, back to the original point, I may still not understand the toolchain
rule and the toolchain selection here and the relevance of the three types of platforms. Is there a better reference or a simpler way to understand it?
My current build scenario is a Cross-compilation builds scenario, it means that the host and the execution platform are the same, but the target platform is different.
Right. Bazel still separates host and execution though, even when they're identical. The same toolchain will be selected for both.
Is the execution platform here related to the target_compatible_with parameter of the toolchain rule?
No, toolchain
has two sets of constraints: exec_compatible_with
is used to match the execution platform, and target_compatible_with
is used to match the target platform. The terminology here is with respect to an action, not the overall build. For example, let's say you're cross-compiling from linux_amd64
to windows_amd64
, and as part of the build, you need to build a binary for code generation. The toolchain used to build that binary will be selected with both execution and target platform linux_amd64
.
Interestingly, I actually tested and found that if the execution platform constraint OS of rule toolchain() is inconsistent with the host platform OS, the Go target can be compiled successfully, but the C++ target will fail.
I'm a little surprised either build would work. Depends a lot on the exact setup though.
Finally, back to the original point, I may still not understand the toolchain rule and the toolchain selection here and the relevance of the three types of platforms. Is there a better reference or a simpler way to understand it?
I wrote Writing Bazel rules: platforms and toolchains a while ago. Might be useful as an example, but it sounds like you already know most of it. The bazel-discuss mailing list is another good place to ask.
@jayconrod
I wrote Writing Bazel rules: platforms and toolchains a while ago. Might be useful as an example, but it sounds like you already know most of it. The bazel-discuss mailing list is another good place to ask.
Yes, I basically know everything in this article. I want to wait for a thorough understanding before going to the bazel-discuss mailing list to ask new questions.
I'm a little surprised either build would work. Depends a lot on the exact setup though.
I carefully analyzed the information printed when the --toolchain_resolution_debug
debugging command parameter is turned on in the two cases:
Conditions:
native.platform(
name = "p_%s" % target_platform,
constraint_values = [
"//platforms/devices:%s" % target_platform,
# needs three constraint values in rules_go for cross-compile
"@platforms//os:%s" % target_os,
"@platforms//cpu:%s" % target_arch,
"@io_bazel_rules_go//go/toolchain:cgo_%s" % target_cgo,
],
visibility = ["//visibility:public"],
)
native.toolchain(
name = toolchain_name,
exec_compatible_with = [
# change the OS constraint value in here
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
target_compatible_with = [
"//platforms/devices:%s" % device,
"@platforms//os:%s" % target_os,
"@platforms//cpu:%s" % target_arch,
"@io_bazel_rules_go//go/toolchain:cgo_%s" % target_cgo,
],
toolchain = "//toolchains/cpp:%s" % cc_name,
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
# ① build failed
$ bazel build --platforms=//platforms:p_ubuntu_arm_linux_gnueabihf //cpp/hello-world
# ② build success
$ bazel build --platforms=//platforms:p_ubuntu_arm_linux_gnueabihf //golang/cmd/hello
Outputs:
①
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint @platforms//os:os has value @platforms//os:osx, which does not match value @platforms//os:linux from the execution platform @local_config_platform//:host
②
INFO: ToolchainResolution: Considering toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain...
INFO: ToolchainResolution: Toolchain constraint //platforms/devices:platform has value //platforms/devices:ubuntu_arm_linux_gnueabihf, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @platforms//cpu:cpu has value @platforms//cpu:arm, which does not match value @platforms//cpu:x86_64 from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Toolchain constraint @io_bazel_rules_go//go/toolchain:cgo_constraint has value @io_bazel_rules_go//go/toolchain:cgo_off, which does not match value <missing> from the target platform @local_config_platform//:host
INFO: ToolchainResolution: Rejected toolchain //toolchains/cpp:ubuntu_arm_linux_gnueabihf_linux_arm_gcc_arm-linux-gnueabihf-_cc_toolchain, because of target platform mismatch
......
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_arm-impl
......
INFO: ToolchainResolution: Selected execution platform @local_config_platform//:host, type @io_bazel_rules_go//go:toolchain -> toolchain @go_sdk//:go_linux_amd64-impl
My analysis:
@local_config_platform//:host
represents the autodetected host platform, Why is it related to the execution platform here? Is the execution platform automatically detected like the host platform?@go_sdk//:go_linux_arm-impl
and @go_sdk//:go_linux_amd64-impl
, and I executed the compiled binary file on the target platform, and it can run successfully. The confusing thing is, why is it still able to execute successfully on the target platform if there is no matching custom toolchain?I don’t know if I clarified my confusion this time. ^_^
For (1), I'm guessing here, but perhaps the build requires some tool built with the C toolchain, and the tool needs to run on the execution platform? So from the perspective of the actions that generate that tool, the action's target platform is the execution platform. If that's the case, you'd need multiple C toolchains registered, one which generates code for the target platform and one which generates code for the execution platform.
For (2), sorry, I don't know the toolchain resolution logic well enough to answer that without firing up a debugger. The mailing list may be able to help more than I can. If you're feeling adventurous, SingleToolchainResolutionFunction.java seems to be the file where those messages are printed.
Thank you for the discussion ^_^ . I will continue to dig deeper and try to understand.
What version of rules_go are you using?
What version of gazelle are you using?
What version of Bazel are you using?
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Any other potentially useful information about your toolchain?
What did you do?
For a mixed project of
C++
andGo
, I want to achieve cross compilation, and the two programming languages share the C++ cross compilation toolchain. Is there a way to use the following commands to achieve one-time compilation? eg:Able to compile successfully in two steps, but not share a compiler:
I want to compile successfully in one step, and use the same compiler:
Demo project: https://github.com/yicm/BazelMixedLanguage/
What did you expect to see?
What did you see instead?