bazel
bazel copied to clipboard
cc_shared_library ignores objc_library transitive dependencies
Description of the bug:
If you have a cc_shared_library with a direct dependency on an objc_library it fails to build with this error:
Traceback (most recent call last):
File "/virtual_builtins_bzl/common/cc/cc_shared_library.bzl", line 666, column 114, in _cc_shared_library_impl
File "/virtual_builtins_bzl/common/cc/cc_shared_library.bzl", line 382, column 48, in _filter_inputs
Error: <target //:bar> (rule 'objc_library') doesn't contain declared provider 'GraphNodeInfo'
ERROR: /private/tmp/objc_library_cc_shared_library/BUILD:11:18: Analysis of target '//:baz' failed
If it has a transitive dependency instead, it is ignored and the symbols from it are not linked in.
You can work around this now with this:
additional_linker_inputs = [
":lib",
],
user_link_flags = [
"$(location :lib)",
],
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
build this project objc_library_cc_shared_library.zip
Which operating system are you running Bazel on?
macOS
What is the output of bazel info release
?
7.1.1
If bazel info release
returns development version
or (@non-git)
, tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD
?
No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
cc @pzembrod for triage cc @oquenchil for potential insights
cc_shared_library
wasn't designed with objc_library
rules in mind so I'm surprised it even works with that small workaround. Looking quickly at the objc_library
rule definition it doesn't announce that it provides CcInfo
with provides =
. If all the information that you need is in CcInfo
and the rule starts announcing that it provides it, then it should work. Apart from that the cc_shared_library
rule doesn't currently make any special considerations for objc_library
.