We have to pass a special linkopts
flag to cc_library
rules that use <filesystem>
, specifically for the GCC version that ships with Debian 10 (gcc 8.3).
I don't want to make developers pass a --config=old_gcc
or similar at the top level.
I was hoping an incantation kind of like this would work:
linkopts = select({
"@bazel_tools//tools/cpp:gcc": ["-lstdc++fs"],
"//conditions:default": [],
}),
But a) gcc is not a configurable attribute that select()
can use and b) we more specifically should test the version number is 8 (we'll only support 8 or above).
How do I extract a is_gcc8
-like config_setting I can select on like this for targets using <filesystem>
? TIA!
One way to do this is to change to using a manual CROSSTOOL setup instead of relying on the automatic crosstool setup (documentation here). This would allow you to specify a set of linker flags to apply when compiling with a certain combination of --cpu
and --compiler
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With