I'm not sure how that will help with my problem unfortunately. The dependency between my code and the targets provided by `rules_foreign_cc` is in some library code that is called by both my `cc_binary` targets and my `cc_test` targets.
I've managed to dig a bit deeper into what is going on:
| out_static_libs | out_shared_libs | Effect |
| ---------------- | --------------- | ------ |
| foo.a | - | Everything is statically linked, |
| foo.a | foo.so | Dynamically linked but tests fail at runtime with linker error |
| foo.a | foo.so.1 | Everything is statically linked + fails at runtime with linker error |
| - | foo.so.1 | Small files, cc_binary is also dynamically linked |
So it seems like if I declare the out_shared_libs as a `foo.so` file Bazel's static/dynamic linking logic works. But it's trying to link against the versioned soname `foo.so.1` which isn't copied into the runfiles.
If I declare the out_shared_libs with the soname `foo.so.1` then Bazel links the library in twice.
I've found a couple of related issues but I still don't quite know what the next step is.
S