-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
I would like to be able to specify that a binary should be built for a specific platform and run it under gdb
toolchains_arm_gnu/examples/bzlmod on HEAD (2f22aa8) [!] via 6GiB/8GiB | 6GiB/7GiB
❯ bazel run --platforms=//custom/platform:cortex_m3 --run_under=@arm_none_eabi//:gdb //custom:binaryHowever, this fails as gdb is constrained
toolchains_arm_gnu/toolchain/templates/top.BUILD
Lines 23 to 36 in 2f22aa8
| native_binary( | |
| name = tool, | |
| src = select({ | |
| host: "@%toolchain_name%_{}//:{}".format(host, tool) | |
| for host in hosts["%toolchain_prefix%"].keys() | |
| }), | |
| out = tool, | |
| target_compatible_with = select({ | |
| host: constraint_values | |
| for host, constraint_values in hosts["%toolchain_prefix%"].items() | |
| } | { | |
| "//conditions:default": ["@platforms//:incompatible"], | |
| }), | |
| ) |
Is there a specific reason to constrain the binaries in this way?
If not, would it make sense to remove target_compatible_with and set
src = "@%toolchain_name%_{}//:{}".format(_normalize(HOST_CONSTRAINTS), tool),similar to how the toolchain alias is created for custom toolchains?
toolchains_arm_gnu/toolchain/templates/toolchain.bazel
Lines 125 to 130 in 2f22aa8
| if _normalize(os) == host.os and _normalize(cpu) == host.cpu: | |
| native.alias( | |
| name = name, | |
| actual = ":{}_{}".format(name, host_repo), | |
| visibility = visibility, | |
| ) |
Metadata
Metadata
Assignees
Labels
No labels