Intellij: CLion "bazel info" fails on macOS

Created on 9 Jul 2018  Â·  2Comments  Â·  Source: bazelbuild/intellij

I'm trying to use a Hello-World Bazel project from CLion.

Any help appreciated :)

It fails immediately after creating the project, with the following error:

Syncing project: Sync (incremental)...
Updating VCS...
Running Bazel info...
Command: bazel info --tool_tag=ijwb:CLion --curses=no --color=yes --experimental_ui=no --progress_in_terminal_title=no --



==== TIMING REPORT ====

Sync: 52ms
    BazelInfo: 14ms

Timing summary:

BlazeInvocation: 14ms
Sync failed

A click on the "!" icon brings up the following stack-trace:

com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:502)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:481)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:78)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.lambda$run$0(FutureUtil.java:96)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:37)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.run(FutureUtil.java:86)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.doSyncProject(BlazeSyncTask.java:327)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.syncProject(BlazeSyncTask.java:236)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$run$0(BlazeSyncTask.java:192)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:60)
    at com.google.idea.blaze.base.scope.Scope.root(Scope.java:52)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.run(BlazeSyncTask.java:164)
    at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTask$0(ProgressiveTaskWithProgressIndicator.java:79)
    at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$2(ProgressiveTaskWithProgressIndicator.java:113)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$3(ProgressiveTaskWithProgressIndicator.java:113)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.runBlazeInfo(BlazeInfoRunnerImpl.java:102)
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.lambda$runBlazeInfo$2(BlazeInfoRunnerImpl.java:72)
    ... 6 more


java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:502)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:481)
    at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:78)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.lambda$run$0(FutureUtil.java:96)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:37)
    at com.google.idea.blaze.base.async.FutureUtil$Builder.run(FutureUtil.java:86)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.doSyncProject(BlazeSyncTask.java:327)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.syncProject(BlazeSyncTask.java:236)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.lambda$run$0(BlazeSyncTask.java:192)
    at com.google.idea.blaze.base.scope.Scope.push(Scope.java:60)
    at com.google.idea.blaze.base.scope.Scope.root(Scope.java:52)
    at com.google.idea.blaze.base.sync.BlazeSyncTask.run(BlazeSyncTask.java:164)
    at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTask$0(ProgressiveTaskWithProgressIndicator.java:79)
    at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$2(ProgressiveTaskWithProgressIndicator.java:113)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:173)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
    at com.google.idea.blaze.base.async.executor.ProgressiveTaskWithProgressIndicator.lambda$submitTaskWithResult$3(ProgressiveTaskWithProgressIndicator.java:113)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: -1
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.runBlazeInfo(BlazeInfoRunnerImpl.java:102)
    at com.google.idea.blaze.base.command.info.BlazeInfoRunnerImpl.lambda$runBlazeInfo$2(BlazeInfoRunnerImpl.java:72)
    ... 6 more

And the "Blaze Error" view says:

Error:Cannot run program "bazel" (in directory "/Users/my_user/path/to/workspace"): error=2, No such file or directory
Error:Could not run Bazel info

Versions:

I am using:

  • macOS High Sierra, Version 10.13.5 (17F77)
  • CLion 2018.1.5
    Build #CL-181.5281.33, built on June 14, 2018
    …
    JRE: 1.8.0_152-release-1136-b39 x86_64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  • Bazel Plugin: Version: 2018.06.11.0.3
  • Bazel is installed from homebrew:
    ```bazel: stable 0.15.0 (bottled)
    Google's own build tool
    https://bazel.build/
    /usr/local/Cellar/bazel/0.12.0 (12 files, 99.5MB)
    Poured from bottle on 2018-04-17 at 22:01:44
    /usr/local/Cellar/bazel/0.14.1 (12 files, 108.9MB)
    Poured from bottle on 2018-06-13 at 21:15:57
    /usr/local/Cellar/bazel/0.15.0 (12 files, 109MB) *
    Poured from bottle on 2018-07-03 at 22:47:06
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/bazel.rb
## More info
Other issues that I think are not the same:
* https://github.com/bazelbuild/intellij/issues/108

## Code
My code:
BUILD: `cc_binary(name = "main", srcs = ["main.cc"],)`
WORKSPACE: Empty file.
main.cc: `int main() {return 0; }`

Works from the command line! (`bazel run //:main`) The running of the crashing command also works on the command line:

bazel info --tool_tag=ijwb:CLion --curses=no --color=yes --experimental_ui=no --progress_in_terminal_title=no --
bazel-bin: /private/var/tmp/_bazel_my_user/ed8d981430f03f64aa79d70e702d0d36/execroot/__main__/bazel-out/darwin-fastbuild/bin
bazel-genfiles: /private/var/tmp/_bazel_my_user/ed8d981430f03f64aa79d70e702d0d36/execroot/__main__/bazel-out/darwin-fastbuild/genfiles
bazel-testlogs: /private/var/tmp/_bazel_my_user/ed8d981430f03f64aa79d70e702d0d36/execroot/__main__/bazel-out/darwin-fastbuild/testlogs
character-encoding: file.encoding = ISO-8859-1, defaultCharset = ISO-8859-1
command_log: /private/var/tmp/_bazel_my_user/ed8d981430f03f64aa79d70e702d0d36/command.log
committed-heap-size: 224MB
execution_root: /private/var/tmp/_bazel_my_user/ed8d981430f03f64aa79d70e702d0d36/execroot/__main__
gc-count: 16
gc-time: 502ms
install_base: /var/tmp/_bazel_my_user/install/d331f9e9a85949656b5b02a1de8e9a82
java-home: /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre
java-runtime: Java(TM) SE Runtime Environment (build 1.8.0_172-b11) by Oracle Corporation
java-vm: Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode) by Oracle Corporation
max-heap-size: 3817MB
output_base: /private/var/tmp/_bazel_my_user/ed8d981430f03f64aa79d70e702d0d36
output_path: /private/var/tmp/_bazel_my_user/ed8d981430f03f64aa79d70e702d0d36/execroot/__main__/bazel-out
package_path: %workspace%
release: release 0.15.0-homebrew
repository_cache: /var/tmp/_bazel_my_user/cache/repos/v1server_pid: 24900
used-heap-size: 41MB
workspace: /Users/my_user/devel/property_based_testing/property_based_testing_cpp
```

Most helpful comment

You need to tell the plugin your bazel binary location:

Settings -> Other Settings -> Bazel Settings -> Bazel binary location

All 2 comments

I can also reproduce this on current master of 'intellij' (194f34b0690827918356eab5ae84fe85c8f6c50c).

You need to tell the plugin your bazel binary location:

Settings -> Other Settings -> Bazel Settings -> Bazel binary location

Was this page helpful?
0 / 5 - 0 ratings