Open brians-neptune opened 7 months ago
passing --dynamic_mode=off
might workaround this (but might not be desirable)
cc @pzembrod for triage cc @oquenchil for potential insights
Very likely that this must be fixed on the cc_test
side, not cc_shared_library
. The implementation already filters out the nodeps *.so
that don't need to be linked, I don't remember adding code to filter out those same files from runfiles which would explain this behavior.
If this affects cc_test
, then it probably affects cc_binary
with linkstatic = 0
. The code path is the same, so fixing one should fix the other.
Description of the bug:
When a
cc_test
depends on acc_shared_library
, it correctly links against thecc_shared_library
. However, thecc_library
shared object still ends up in runfiles. This results in building all of the (transitive) dependencies twice.Which category does this issue belong to?
C++ Rules
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
https://github.com/brians-neptune/bazel-cc_shared_library-cc_test has a pretty minimal example. Here's the
BUILD
file, all the C/C++ files are empty (except for an emptymain
intest.cc
):liblibdep.so
andlibdep_shared.so
are both in runfiles:but only
libdep_shared.so
is actually used:Which operating system are you running Bazel on?
Ubuntu 22.04
What is the output of
bazel info release
?release 7.0.2
If
bazel info release
returnsdevelopment 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