labgrid_binary doesn't work with genrule
When trying to use a labgrid_binary
target from within a genrule
:
labgrid_binary(
name = "printenv",
src = "@ape//ape:printenv",
platform = "@rules_labgrid//labgrid/platform:localhost",
)
genrule(
name = "env",
srcs = [":printenv"],
outs = ["out.log"],
cmd = "$(location :printenv) LG_ENV > $@",
)
The build fails with:
$ bazel build //localhost:env
INFO: Invocation ID: 3d354d2f-5c8a-431c-8020-7d97a9bcef5d
INFO: Analyzed target //localhost:env (2 packages loaded, 79 targets configured).
ERROR: localhost/BUILD.bazel:140:8: Executing genrule //localhost:env failed: (Exit 1): bash failed: error executing Genrule command (from target //localhost:env) /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/k8-fastbuild-ST-c0a075c84b15/bin/localhost/printenv LG_ENV > bazel-out/k8-fastbuild/bin/localhost/out.log'
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
realpath: missing operand
Try 'realpath --help' for more information.
Unable to find runfiles directory for bazel-out/k8-fastbuild-ST-c0a075c84b15/bin/localhost/printenv
Target //localhost:env failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.627s, Critical Path: 0.03s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully