Monday, October 30, 2017

CLion with Bazel - "Unknown Error" when trying to run the debugger on Ubuntu

I wasted one hour to figure this out, as I'll add another 5 mins to write this up.

If you want to run the debugger on some binary in CLion with Bazel, and just press the Debug button, nothing will happen and a small "Unknown error" toast window will appear at the bottom of your screen. The logs will show a NullPointerException:

java.lang.NullPointerException
        at com.jetbrains.cidr.execution.testing.CidrLauncher.startDebugProcess(CidrLauncher.java:33)
        at com.jetbrains.cidr.execution.CidrCommandLineState.startDebugProcess(CidrCommandLineState.java:30)
        at com.jetbrains.cidr.execution.CidrRunner$1.start(CidrRunner.java:58)
        at com.intellij.xdebugger.impl.XDebuggerManagerImpl.a(XDebuggerManagerImpl.java:217)

To fix this, click on Edit Configurations... and add another before launch task by pressing the green plus button, and select Bazel before-run task from the list. That's it. Happy debugging.

Friday, October 27, 2017

Clion with Bazel

If you're trying to make CLion work with Bazel and are wondering why it doesn't work, note that the latest Clion version usually doesn't usually work with the Bazel plugin.

This page describes which CLion version each Bazel plugin works with:

https://plugins.jetbrains.com/plugin/8609-bazel

In order to figure out the build number of your CLion installation, go to Help->About.