【问题标题】:Platform constraints rejecting the host (matching) platform拒绝主机(匹配)平台的平台约束
【发布时间】:2022-11-02 04:13:47
【问题描述】:

我正在尝试对目标使用平台约束:

cc_test(
    name = "library_test",
    srcs = ["library_test.cc"],
    deps = [":library"],
    target_compatible_with = [
        "@platforms//cpu:x86_64",
        "@platforms//os:linux"
    ]
)

但我收到了这个错误:

Dependency chain:
//platforms:library_test (1f7c4b)   <-- target platform (@local_config_platform//:host) didn't satisfy constraints [@platforms//cpu:x86_64, @platforms//os:linux]

考虑到这应该是正确的,我觉得这很令人困惑。如何打印 @local_config_platform//:host 中的值是什么?

我确实打开了--incompatible_enable_cc_toolchain_resolution 标志。

【问题讨论】:

    标签: bazel


    【解决方案1】:

    您可以在 bazel-out/../../../external/local_config_platform/constraints.bzl 中找到它(相对于您的 Bazel 工作区)。

    类似的路径也适用于任何其他外部存储库(@somethingbazel-out/../../../external/something 中)。 Repository rules通过各种机制创建这些文件夹,能够看到结果对调试很有帮助。

    【讨论】:

      猜你喜欢
      • 2023-02-07
      • 2021-03-22
      • 1970-01-01
      • 2022-08-11
      • 1970-01-01
      • 1970-01-01
      • 2013-02-26
      • 2022-08-17
      • 1970-01-01
      相关资源
      最近更新 更多