You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the bright side, the workaround is to add -lm to cc_test linkopts or link_flags of cc toolchain configuration.
Perhaps we should start with exposing action_configs in unix_cc_toolchain_config and then override the cpp actions in toolchains_llvm. Alternative would be to inline unix_cc_toolchain_config into toolchains_llvm.
Looking forward to your feedback.
The text was updated successfully, but these errors were encountered:
With all these small inconsistencies between Bazel and the rest of the world, I wonder whether we shouldn't just make Bazel's default toolchain use clang for C and clang++ for C++. Bazel 8 could be a good time for that as it may not be doable in a fully backwards compatible way.
Thank you for responses. Long term definitely changing the defaults is the best choice.
But would be good to have some improvement short / middle term.
I don't know how feasible it is to add -lm by default for linux compilation.
Maybe lets start a "Known issues" section in readme to increase visibility? It takes some time to debug such issues so that might help future strugglers.
Side note: The original post was about linux, on macos I had to add "-lstdc++" to link flags.
Hi,
Thank you for the work on the project so far. It makes cc toolchain configuration much easier.
I've noticed that some builds fail with linker errors, for instance, compiling
cc_test
withcom_google_google_test
fails withThis is related to google/googletest#3878
I think the problem is as described in the issue above - compiling c++ should use clang++.
This might be, however, problematic as it goes down to bazel implementation of default actions that is using
gcc
instead ofg++
.It is possible to override the action configs in
cc_common.create_cc_toolchain_config_info
, but unix_cc_toolchain_config does not expose it.I did some rough experiment and replaced clang with clang++ in https://github.com/bazel-contrib/toolchains_llvm/blob/master/toolchain/cc_wrapper.sh.tpl and that did the trick. This is not a generic solution though, as it would fail c compilation.
On the bright side, the workaround is to add
-lm
tocc_test
linkopts or link_flags of cc toolchain configuration.Perhaps we should start with exposing
action_configs
in unix_cc_toolchain_config and then override the cpp actions in toolchains_llvm. Alternative would be to inline unix_cc_toolchain_config into toolchains_llvm.Looking forward to your feedback.
The text was updated successfully, but these errors were encountered: