bazelbuild / bazelbuild/rules_cc
cc_binary dep on cc_library#linkstamp doesn't set up include paths correctly for non-root module deps
- Dominant language
- Starlark
- Stars
- 247
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
Suppose you have two bazel modules, A and B. B depends upon A.
A has a cc_library called "src/foo:foo". This library has `linkstamp = build_embed.cc", where build_embed.cc has a local include path: `#include "src/foo/build_embed.h"`.
A's "src/foo:foo" library is a dep of a binary called "src/foo:main", also within A.
B has two targets that just copy from A: "ersatz_main" and "ersatz_foo". Both of these targets just copy the output files of `@A//src/foo:{foo,main}` into B's repository.
Within B, it is possible to compile ersatz_foo correctly. However, it is _not_ possible to compile ersatz_main. This error occurs:
```
external/foo+/src/foo/build_embed.cc:1:10: fatal error: src/foo/build_embed.h: No such file or directory
1 | #include "src/foo/build_embed.h"
```
It seems that the compilation action for cc_binary targets with linkstamp set does not properly add all required include paths.
See https://github.com/ted-xie/linkstamp_issue_rules_cc for full repro.
Bazel version: 8.2.1 (also repros at 7.4.1)
rules_cc version: 0.1.1 (also repros at 0.0.10)
Contributor guide
Assessment
This issue has not been assessed yet.