Bazel seems to be automatically configure the local system and select a cc_toolchain for me. Is there any way I can know of all available toolchain options so that I can choose another one instead of the toolchain chosen by default? (I assume there can be many. For instance, a toolchain with gcc, another one with clang, and so on) Also, is there any way I can access to the toolchain info, which is chosen for the actions?
bazel
indeed auto generates a toolchain. Using protobuf
, if we run a simple bazel build :protobuf
we end up with a directory bazel-protobuf/external/local_config_cc/
that is worth exploring. Especially the BUILD.bazel
inside shows which toolchains are auto detected. https://github.com/limdor/bazel-examples/tree/master/linux_toolchain is a great write up providing some background in addition to the official documentation at https://bazel.build/docs/cc-toolchain-config-reference.
Note that you can let bazel
auto detect a different compiler by using something like:
CC=clang CXX=clang bazel build :protobuf