Search code examples
bazel

How to inspect @local_config_platform//:host?


I'm running into some toolchain issues, with errors like:

INFO: ToolchainResolution:     Type @io_bazel_rules_go//go:toolchain: target platform @local_config_platform//:host: Rejected toolchain @go_sdk//:go_linux_amd64-impl; mismatching values: linux, x86_64
INFO: ToolchainResolution:   Type @io_bazel_rules_go//go:toolchain: target platform @local_config_platform//:host: No toolchains found.

but I believe I am running on x86_64 and Linux, but that would be made clear by inspecting the generated constraints.

This was mentioned earlier, but I was unable to find said-generated file.

And in case it ever helps anyone else, I'm running popos.

Thanks!


Solution

  • Use query --output=build to dump the rule:

    $ bazel query --output=build @local_config_platform//:host
    # /home/user/.cache/_bazel_cache/bf5544946d234767647dbf413a7bc3c9/external/local_config_platform/BUILD.bazel:4:9
    platform(
      name = "host",
      constraint_values = ["@platforms//cpu:x86_64", "@platforms//os:linux"],
    )
    
    

    The comment line even tells you were to find the original generated BUILD file.