question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

select need be able to recognise exec_compatible_with and target_compatible_with

See original GitHub issue

Description of the feature request:

my project import rules_proto and grpc, when I cross compile for arm, rules_proto will choose a wrong platform protoc, host platform protoc expected but arm platform protoc choosed, but I think it’s not rules_proto’s bug, for:

my platforms value pass to bazel was

platform(
    name = "linux_gcc11_aarch64_none_musleabi",
    constraint_values = [
        "@platforms//cpu:aarch64",
        "@platforms//os:linux",
        ":gcc_11",
        ":musleabi",
    ],
)

toolchain defined by myself:

toolchain(
    name = "gcc11_arm_aarch64_none_gnueabi_xcompile_toolchain",
    exec_compatible_with = [
        "@platforms//cpu:x86_64",
        "@platforms//os:linux",
    ],
    target_compatible_with = [
        "@platforms//cpu:aarch64",
        "@platforms//os:linux",
        "//platforms:gcc_11",
        "//platforms:gnueabi",
    ],
    toolchain = "@gcc11_arm_aarch64_none_gnueabi//:cc_toolchain",
    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

rules_proto use select to decide use which platform protoc, cpu:x86_64 and os:linux from target_compatible_with will be recognised by rules_proto, so linux-aarch64 choosed, it’s a wrong choice, it didn’t recognise it’s a cross compile. so I think there exists two way to solve this problem:

  1. rules_proto choose protoc by detect host platform, not by select
  2. make bazel compitable with this situation, I think select should be able to recogise exec_compatible_with and target_compatible_with
alias(
    name = "protoc",
    actual = select({
        ":linux-aarch64": "@com_google_protobuf_protoc_linux_aarch64//:protoc",
        ":linux-ppc": "@com_google_protobuf_protoc_linux_ppc//:protoc",
        ":linux-s390x": "@com_google_protobuf_protoc_linux_s390_64//:protoc",
        ":linux-x86_32": "@com_google_protobuf_protoc_linux_x86_32//:protoc",
        ":linux-x86_64": "@com_google_protobuf_protoc_linux_x86_64//:protoc",
        ":macos-aarch64": "@com_google_protobuf_protoc_macos_aarch64//:protoc",
        ":macos-x86_64": "@com_google_protobuf_protoc_macos_x86_64//:protoc",
        ":windows-x86_32": "@com_google_protobuf_protoc_windows_x86_32//:protoc",
        ":windows-x86_64": "@com_google_protobuf_protoc_windows_x86_64//:protoc",
        "//conditions:default": "@com_github_protocolbuffers_protobuf//:protoc",
    }),
    visibility = ["//visibility:public"],
)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
meteorcloudycommented, Jul 12, 2022

@sgowroji This issue belongs to the configurability team

0reactions
sgowrojicommented, Sep 15, 2022

Closing as stale. Please reopen if you’d like to work on this further.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow selecting different python paths for different platforms
We want to be able to have python interpreters in different paths ... If I just annotate the py_binary with an exec-compatible-with to...
Read more >
Platforms | Bazel
Multi-platform builds - host, execution, and target platforms are all different. Defining constraints and platforms. The space of possible ...
Read more >
Compositional Verification of Relaxed-Memory Program ...
is paper is about verifying program transformations on an axiomatic relaxed memory model of the kind used in C/C++ and Java.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found