-
Couldn't load subscription status.
- Fork 139
Description
As far as I can tell a cc_library target will produce an .a as its output, but in the case that your linker supports --start_lib --end_lib, these .a files aren't even used by the rest of the build: as the constituent .o files are used instead. So we have these .a files almost doubling the disk use by the bazel build (for build types using enough dynamic linking where most space is used by .o files, not the final binaries), and in CI when we use remote caching and do a bazel build //... it spends half of its time downloading these .a files which aren't used.
I can see a few options:
- For compatible toolchains stop every building the .a file, they would no longer be an output of the cc_library rule (probably a big change, hard for various reasons).
- Offer a mode which allows you to filter out the .a targets specifically, so when using a wide build spec like //... they are not built (but the .o files will mostly all be built as they are dependency for targets which need them).
Perhaps (2) could already be the basis of a workaround: somehow filter out all the library targets from a build and build the remaining targets, probably possible with one of the query commands.
I wasn't sure if this should go here or in the main bazel repo, LMK if it's in the wrong place.