toolchains_llvm icon indicating copy to clipboard operation
toolchains_llvm copied to clipboard

Host platform still uses gcc

Open froody opened this issue 2 years ago • 2 comments

Maybe there's an obvious solution to this. I have multiple build configs, the default one uses clang via bazel-toolchain, the others use emscripten to target js/wasm. When I test c++ targets in the js/wasm config, I need a host tool at runtime. I get this using attr.label(..., cfg="host"). The problem is this tool is compiled with gcc. Is there a way to use the clang toolchain for the "host" in addition to "target"?

froody avatar Oct 06 '22 10:10 froody

I tried --host_crosstool_top=@llvm_toolchain//:cc-toolchain-x86_64-linux but that gives me

external/bazel_tools/tools/cpp/BUILD:63:11: in :cc_toolchain attribute of cc_library rule @bazel_tools//tools/cpp:malloc: '@llvm_toolchain//:cc-toolchain-x86_64-linux' does not have mandatory providers: 'CcToolchainInfo'

froody avatar Oct 06 '22 23:10 froody

Ah I need to pass --noincompatible_enable_cc_toolchain_resolution for my wasm build, otherwise it tries to use clang to compile c++ files for wasm, and this disables llvm_toolchain

froody avatar Oct 07 '22 00:10 froody