Intellij: Clion plugin doesn't work with custom CROSSTOOL

Created on 8 Jan 2019  路  6Comments  路  Source: bazelbuild/intellij

I configured a custom CROSSTOOL for clang on ubuntu 18.04. I was able to build my workspace by setting --crosstool_top=//bazel/tools/cpp:toolchain --cpu=k8 --compiler=clang

and I added
build --crosstool_top=//bazel/tools/cpp:toolchain --cpu=k8 --compiler=clang
to .bazelrc, which works well in command line. But CLion fails to sync build file.

Got the following error
"intellij_aspect/intellij_info_impl.bzl", line 365, in collect_c_toolchain_info

cc_common.configure_features(cc_toolchain = cpp_toolchain, requ..., ...))

expected value of type 'CcToolchainInfo' for parameter 'cc_toolchain', in method call configure_features(ToolchainInfo cc_toolchain, list requested_features, list unsupported_features) of 'cc_common'.

CLion c++ linux bug

All 6 comments

Are you on the newest version of Clion, Bazel, and the Bazel plugin? I saw this error recently when building with Bazel 0.21.0 on an outdated Bazel plugin version.

Let me update bazel and clion then report back.

CLion bazel plugin 2018.12.03.0.2
CLion 2018.2.7
bazel 0.21.0

FWIW, I just compiled the plugin from current master (0f45ef4c3bdc931c3c92df0fb3f75fdb53347b32) and had the same issue.

Also saw this on Bazel 0.24.1.

It seems that this line is returning an instance of ToolchainInfo instead of CcToolchainInfo:
https://github.com/bazelbuild/intellij/blob/f3399ff15516fa93f0df490c6d0649c6e32a60e1/aspect/intellij_info_impl.bzl#L435-L436

I just stumbled across this issue with bazel 0.29 and the latest version of the clion bazel plugin using a custom c++ toolchain.

Thanks @kevin-nuro for pointing me in the right direction for a workaround.

A workaround is to define tags = ["no-ide"] on targets created with the cc_toolchain rule. Using this workaround the plugin picks up the CCToolchainInfo from your defined cc_toolchain_suite and everything works as expected.

Was this page helpful?
0 / 5 - 0 ratings