bazel-contrib / bazel-contrib/rules_foreign_cc

`runnable_binary` is not usable in `genrule`

Open
#1,329 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

I have a python interpreter being built from source:

```starlark
configure_make(
name = "python3",
...
```

which is then used in a `runnable_binary` rule:

```starlark
runnable_binary(
name = "python_binary",
binary = "python3",
foreign_cc_target = "python3",
visibility = ["//visibility:public"],
)
```

however, if I want to use the runnable binary in this `genrule`

```starlark
genrule(
name = "repro",
cmd = "$(location :python_binary) -c 'from locale import localeconv; localeconv()' > $@",
srcs = [":python_binary"],
outs = ["thing.txt"],
)
```

I get the classic ` in cmd attribute of genrule rule @@python3.13.0//:repro: label '@@python3.13.0//:python_binary' in $(location) expression expands to more than one file, please use...`

Is there a known workaround for this?

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Reproduce the example using configure_make, runnable_binary, and genrule, then inspect how $(location) handles the runnable_binary output and why it expands to multiple files. Done means identifying a supported workaround or a clearly scoped fix, with a regression test if the project’s existing test structure supports one.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.