Make variable substitution in local_defines in C++ rule does not accept labels from data
#13930
Labels
P4
This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Rules-CPP
Issues for C++ rules
type: feature request
Description of the problem / feature request:
In C++ rules,
local_defines
allow "Make" variable substitution, includingexecpath
: List of defines to add to the compile line. Subject to "Make" variable substitution and Bourne shell tokenization. (https://docs.bazel.build/versions/main/be/c-cpp.html#cc_binary.local_defines)In "Make" variable substitution, C++ rules are documented to be able to use labels referenced in the
data
attribute: All referenced labels must appear in the consuming rule's srcs, output files, or deps. Otherwise the build fails. C++ rules can also reference labels in data. (https://docs.bazel.build/versions/main/be/make-variables.html)However, if a
local_defines
rule tries to do"VAR=\"$(execpath :data_label)\""
, the expansion fails with the error "label ':data_label' in $(location) expression is not a declared prerequisite of this rule."Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What operating system are you running Bazel on?
Linux
What's the output of
bazel info release
?2021/08/31 23:23:18 Using unreleased version at commit 662cf54
development version
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?Have you found anything relevant by searching the web?
cfb6989#diff-dded2426bd501014f754eeb69f0eb986a5db2a8908ff219106af4c76a5da09e2R531
I think this should also get do
getPrerequisites("data")
Any other information, logs, or outputs that you want to share?
The text was updated successfully, but these errors were encountered: