bazelbuild / bazelbuild/rules_cc
cc_library linked_statically_by attribute Only Works With Absolute Label Paths
- Dominant language
- Starlark
- Stars
- 247
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
### Description of the problem / feature request:
The "linked_statically_by" attribute of cc_library errors out when used with relative labels
>ERROR: /usr/local/google/home/bmzhao/Code/experimental/BUILD:11:1: in cc_shared_library rule //:a_so:
Traceback (most recent call last):
File "/usr/local/google/home/bmzhao/Code/experimental/BUILD", line 11
cc_shared_library(name = 'a_so')
File "/usr/local/google/home/bmzhao/.cache/bazel/_bazel_bmzhao/346f8c89ce367ab1eaf00095a9f73200/external/rules_cc/examples/expe
rimental_cc_shared_library.bzl", line 216, in _cc_shared_library_impl
_filter_inputs(ctx, <4 more arguments>)
File "/usr/local/google/home/bmzhao/.cache/bazel/_bazel_bmzhao/346f8c89ce367ab1eaf00095a9f73200/external/rules_cc/examples/expe
rimental_cc_shared_library.bzl", line 172, in _filter_inputs
fail(<1 more arguments>)
We can't link //:a either statically or dynamically
ERROR: Analysis of target '//:a_so' failed; build aborted: Analysis of target '//:a_so' failed; build aborted
### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I've got a working repro here: https://gist.github.com/bmzhao/02c695048cbd591bd93d9bdfd93e4f78
based on github repo: https://github.com/bmzhao/experimental/tree/f727f572395b2a72e119f9865b05716bcafea54d
If you comment out line 8, and uncomment line 7, things start working:
https://github.com/bmzhao/experimental/blob/f727f572395b2a72e119f9865b05716bcafea54d/BUILD#L8
### What operating system are you running Bazel on?
> Debian Linux
### What's the output of `bazel info release`?
> release 1.2.0
### What version of rules_cc do you use? Can you paste the workspace rule used to fetch rules_cc? What other relevant dependencies does your project have?
> http_archive(
name = "rules_cc",
sha256 = "cf3b76a90c86c0554c5b10f4b160f05af71d252026b71362c4674e2fb9936cf9",
strip_prefix = "rules_cc-01d4a48911d5e7591ecb1c06d3b8af47fe872371",
urls = ["https://github.com/bazelbuild/rules_cc/archive/01d4a48911d5e7591ecb1c06d3b8af47fe872371.zip"],
)
rules_cc is pinned to commit: https://github.com/bazelbuild/rules_cc/commit/01d4a48911d5e7591ecb1c06d3b8af47fe872371
Contributor guide
Assessment
This issue has not been assessed yet.