Bazel: CLion Bazel 1.2.1 incompatiability macOS

Created on 7 Jan 2020  路  5Comments  路  Source: bazelbuild/bazel

Also posted in the plugin repo issues but also posting here as it is toolchain related and happened on a Bazel upgrade.

When using CLion with the default toolchain on macOS (10.14.6). The plugin fails when invoking wrapped_clang. Tested on CLion 2019.2.5, plugin version 2019.12.02.0.0. Bazel 0.29.1 works perfectly fine on this version of CLion and the plugin. Although only a warning, it does result in CLion not being able to find symbols and basic IDE functionality ceases to function. This specifically only happens when Syncing the project, Compile Project works fine.

Warning:Unable to check compiler version for "/private/var/tmp/_bazel_wesleywilliams/67e49888db524d169925325d83f7e7d6/execroot/<my_repo>/external/local_config_cc/cc_wrapper.sh".
stderr: "Error: DEVELOPER_DIR not set.
/private/var/tmp/_bazel_wesleywilliams/67e49888db524d169925325d83f7e7d6/execroot/<my_repo>/external/local_config_cc/cc_wrapper.sh: line 56: 21198 Abort trap: 6           "$(/usr/bin/dirname "$0")"/wrapped_clang "$@"
"
stdout: ""
Check if running the compiler with --version works on the cmdline.
P3 team-XProduct bug

Most helpful comment

I was able to solve this by adding:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk"

Now after running the same target I don't get the above error and everything is linked properly so I can move through source with command clicks

All 5 comments

/cc @jin not sure what our actions could be, though

CLion on macOS is not supported by the IntelliJ team.

See https://ij.bazel.build/docs/bazel-support.html

I was able to solve this by adding:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk"

Now after running the same target I don't get the above error and everything is linked properly so I can move through source with command clicks

I've experienced the same on OSX 10.15.4, CLion 2019.3.6, Bazel 3.1.0, Bazel plugin 2020.04.13.0.0.
I've worked around it by adding those 2 exports to my .profile.

Apologies I didn't update the ticket. Another way to get around this issue is to use the auto configured C++ only toolchain, and avoid going through XCode by setting the env var BAZEL_USE_CPP_ONLY_TOOLCHAIN=1.

Was this page helpful?
0 / 5 - 0 ratings