intellij: code navigation broken on project with custom toolchain and `--incompatible_enable_cc_toolchain_resolution --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1`
We have a project where we configured a custom toolchain (using clang
as executable on posix) skipping the auto-configured one by bazel. We are setting the --incompatible_enable_cc_toolchain_resolution
and --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
. On this project the intellij bazel pluging prints the following warning when synced:
Warning:Unable to access compiler executable
"<path to bazel cache>/execroot/__main__/external/local_config_cc/gcc".
Check if it is accessible from the cmdline.
and as a consequence, code navigation is more or less completely broken. We do have a workaround, which is to link symbolically clang to the location indicated by the warning, but thatโs not ideal.
I managed to reduce our case to a rather small project presenting the same warning (on Linux with gcc). You can find it here:
https://github.com/redsun82/foo
I noticed dropping --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
removes the warning, but my guess is that in that case the plugin will then use the host auto-configured compiler instead of the custom one.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (1 by maintainers)
yeah, I ended up with the same result, and the same solution ๐ I added a
cc_toolchain_suite
target (which is not required with the platform-driven toolchain resolution) and the--crosstool_top
option in.bazelrc
, with notes to remove them when CLion allows it.Still, many thanks for pointing me in the right direction ๐