Hi Marcel (or anyone else),
I'm working on upgrading to bazel 0.21.0. It's a monster. On the plus side, rules_go seems to work with our CROSSTOOL out of the box, so that's good news.
Target toolchain suite:
cc_toolchain_suite(
name = "toolchain",
toolchains = {
"k8|clang": ":cc-compiler-k8-clang",
"k8|gcc": ":cc-compiler-k8-gcc",
"armhf-debian|clang": ":cc-compiler-armhf-clang",
"armhf-debian|gcc": ":cc-compiler-armhf-gcc",
"darwin|clang": ":cc-compiler-darwin",
"arm64-debian|gcc": "cc-compiler-arm64-gcc",
},
visibility = ["//visibility:public"],
)
Host toolchain suite:
# This is the entry point for --host_crosstool_top.
cc_toolchain_suite(
name = "toolchain",
toolchains = {
# The error below triggers both with and without this
"k8": ":cc-compiler-k8-clang",
"k8|clang": ":cc-compiler-k8-clang",
},
visibility = ["//visibility:public"],
)
I'm getting the following 3 errors:
1)
ERROR: /home/austin/local/peloton-tech/tools/host_cpp/BUILD:7:1: in cc_toolchain_suite rule //tools/host_cpp:toolchain: Error while selecting cc_toolchain: No toolchain found for cpu 'k8'. Valid toolchains are: [
local_linux_k8: --cpu='k8' --compiler='clang',
local_linux_gcc: --cpu='k8' --compiler='gcc',
clang_linux_armhf: --cpu='armhf-debian' --compiler='clang',
linaro_linux_armhf: --cpu='armhf-debian' --compiler='gcc',
local_darwin: --cpu='darwin' --compiler='clang',
linaro_linux_aarch64_gcc_2018_05: --cpu='arm64-debian' --compiler='gcc',
]
2)
ERROR: /home/austin/local/peloton-tech/tools/cpp/BUILD:67:1: in cc_toolchain_suite rule //tools/cpp:toolchain: cc_toolchain_suite '//tools/cpp:toolchain' does not contain a toolchain for cpu 'k8'
And:
3)
ERROR: /home/austin/.cache/bazel/_bazel_austin/dd758a6cc6943296d5c6a65e2c252c63/external/com_google_protobuf/BUILD:1131:13: Configurable attribute "copts" doesn't match this configuration (would a default condition help?).
Conditions checked:
//tools:compiler_gcc
//tools:compiler_clang
Where compiler_gcc and compiler_clang are:
config_setting(
name = "compiler_clang",
values = {"compiler": "clang"},
)
config_setting(
name = "compiler_gcc",
values = {"compiler": "gcc"},
)
I can get rid of error 1 and 2 by adding a k8 entry without a compiler specified, but that doesn't fix it. I'd really like to set it up so clang is the default compiler (and my selects work properly to catch it). How would you recommend setting the default compiler and detecting compiler type for selecting flags? We've got a macro set up right now to wrap the specifics up, but I need to update it to use the new 0.21.0 methodology.
Austin