Transition to exec configuration for `bazel run --run_under=... --platforms=...`
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
This is closely related to https://github.com/bazelbuild/bazel/issues/22624.
That issue (now fixed) was about transitioning to the exec configuration when `bazel test --run_under=... --platforms=...` is invoked.
The same behavior should apply to `bazel run` as to `bazel test`, but currently does not: the `--run_under` binary is built for the target platform, even though it is then immediately executed on the exec platform. There's actually a TODO to handle this (added by @katre in https://github.com/katre/bazel/commit/b03e4c5e4df4728b943945370141c047b9d98039), but I don't believe there was a tracking issue before.
The context in which this bit us this week is trying to run a binary in emulation. We build the binary for an embedded platform (by setting `--platforms`) and then use `--run_under` to run it under [QEMU](https://www.qemu.org/). But this does not work as expected, because Bazel tries to build the emulator itself for the embedded platform!
### Which category does this issue belong to?
Configurability
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
_No response_
### Which operating system are you running Bazel on?
Linux
### What is the output of `bazel info release`?
8.1.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
```
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.