Original post

Let’s learn how to make , or any JetBrains IDE, work on a Raspberry Pi 4, a popular development single-board computer.

We’ll cover:

Requirements

Some hardware components are required to follow along with this post:

  • Raspberry Pi4 4GB version.
  • An adequate power supply.
  • An HDMI output cable.
  • As the Raspberry Pi 4 will run rather hot, a case with good heat dissipation or some other cooling method is recommended. I chose this case.
    Note: A T-Cobbler GPIO extension cable will not fit in the space provided by the case by default, a GPIO raiser header will be needed for that to work.
  • A good microSD card, as it’s crucial for the operations you will need to run. I used a 32GB Samsung Pro+.
    You’ll want something that is well balanced, and you’ll want something that’s good for operations on small files at a good price. To find such a card, you can use websites that have benchmarks on Raspberry Pi storage options.
    Alternatively, you can try to boot and use an SSD for your Raspberry Pi 4, which will vastly improve performance, though it will be a bit more complicated.

Installing the Operating System

Download it from http://cdimage.ubuntu.com/releases/19.10/release/, under Preinstalled server image / Raspberry Pi 3 (64-bit ARM) preinstalled server image, e.g. ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz

Flash the image on a microSD card. You can use something like https://www.balena.io/etcher/ to do this.

To connect to our Pi, we’ll use the default username ubuntu and password ubuntu.

Operating System Configuration

Our device has both Ethernet and Wi-Fi capabilities. While connecting an Ethernet cable might be the quick and simple solution, you might not have one available. This response from AskUbuntu explaining how to connect to the wireless network straight from the command line will help in this case.

With our internet connection in place, it’s time to update the OS:

If you get an error about another update that is in progress, then it is best to wait and retry in about 10-15 minutes.

Installing the libraries specific to Raspberry Pi development

As Raspbian does not yet ship with support for the platform, we’ll need to manually add some libraries for our OS and enable the ARMHF platform:

Installing Gnome Desktop Environment

To run GoLand, we need a desktop environment. For the rest of the article, we’ll be using the Gnome Desktop

If you get an error that says tasksel: apt-get failed (100), then this means that another update/upgrade process is in the background. After 10-15 minutes of waiting, it should be safe to try again.

With this done, we can now reboot our device with a sudo reboot command and get our desktop environment up and running.

Installing

We need to install Go itself, so let’s go to https://golang.org/dl/ and grab the latest stable version for ARM64. At the time of writing this article, this is Go 1.13.8, so we’ll get go1.13.8.linux-arm64.tar.gz.

Installing Delve

Delve, the Go debugger, recently received support for the ARM64 platform thanks to this contribution.

We’ll install Delve so that we can debug our applications as the version that ships with the IDE is not compatible with ARM64.

To do so, we can run:

This will download Delve, and compile it into our GOPATH (default under ~/go/). We need to take note of where the location of the Delve binary is, as we’ll need it a bit later on.

Installing GoLand

Now, we can download and install GoLand.

Head over to the website and download the latest version, with a free 30 days trial, or use the free EAP version.

For this post, I downloaded the latest available build, 2020.1 2.
Once the download has finished, we can unpack it and move it to a new directory:

Using the ARM64 Java Runtime

At the time of publishing this post, we don’t ship the IDE with the correct Runtime for the ARM64 platform, so we need to download the correct one from https://bintray.com/jetbrains/intellij-jbr/jbrsdk11-linux-aarch64/722.2#files.

To ensure compatibility with the IDE, we recommend downloading the Runtime that corresponds to the IDE version we have. In this case, it’s 11.0.6+8-b722.2, and we are interested in the last part, specifically, 722.2.

Downloading the Runtime and not the SDK is sufficient for running the IDE, so let’s download the file named jbr-11_0_6-linux-aarch64-b722.2.tar.gz. After that, we’ll unpack it and swap the corresponding runtimes.

Compiling the File Watcher

The next step is to compile the File Watcher that’s native to our ARM64 platform. The complete instructions can be found here: https://confluence.jetbrains.com/display/IDEADEV/Compiling+File+Watcher. This script can also help us download the files we need: https://gist.github.com/dlsniper/97ca1287df1418aef413c465adeac6df

And don’t forget to adjust the inotify(7) instances and watches limits.

With the correct Runtime now in place, and the correct File Watcher binary compiled, we can now start the IDE. We can do so by running:

IDE Configuration

Since this is the first time we are starting the IDE, we need to do a bit of configuration before creating a project.

Click on the Configure button, then select the Edit Custom Properties action, add the following line, then restart the IDE:

idea.filewatcher.executable.path=fsnotifier-aarch64
dlv.path=/home/ubuntu/go/bin/dlv

The entry should look like this:

GoLand properties on Raspberry Pi

Before we restart the IDE, let’s make one last configuration change.

Press the Find Action shortcut, Ctrl+Shift+A, to bring up the dialog and search for Registry…
Open this and search for run.process.with.pty by typing in the window, then disable it by clicking on it.

Now, we can close the IDE and start it again.

GoLand on RaspberryPi - Edit Configuration

Working with the IDE

After all this setup is done, all the familiar IDE features, such as code completion, refactorings, running of applications, or them should work as they work on a regular desktop computer.

Working with the IDE on a Raspberry Pi

Limitations

The built-in terminal doesn’t work at the moment due to an incompatibility with the underlying libraries used, subscribe to https://github.com/JetBrains/pty4j/issues/82, and you’ll receive an update as soon as the issue is solved.

We’ll update the article when these limitations are removed, or if new ones are discovered.

IDE Performance

The big question is: Will the IDE be usable given the limited hardware?

To my surprise and delight, the operations work somewhat smoothly, at least well over my expectations.

So, I ran a couple of ad-hoc tests to check the difference in speed between the Raspberry Pi 4 with 4GB RAM running Ubuntu 19.10 ARM64 and my laptop, which has an Intel Core i7 6700HQ with 32GB RAM and Windows 10.

Unsurprisingly, my Windows laptop is faster, but here are the results:

Raspberry Pi Laptop
Startup time 29 seconds 9 seconds
Indexing of github.com/influxdata/flux 93 seconds 12 seconds

As mentioned earlier, you can improve these by running the from an SSD, but this will make the initial setup a bit more complex.

Remote desktop control

Controlling a Raspberry Pi might be more comfortable in some cases if it’s done remotely.

How do we do this? RealVNC is here to save the day.

Let’s install the VNC Server so that we can control our setup remotely from the comfort of our computer.

Normally, RealVNC comes bundled with Raspbian, but since we are running Ubuntu using ARM64 architecture, we need to install some additional dependencies before we can continue:

To start this, we can run

To make this service run on startup:

Note: Using the RealVNC server to remote control your Raspberry Pi 4 device will incur a pretty big performance penalty, with CPU spikes of up to 50% usage, and constant usage above 15%, so your development experience might suffer.

This concludes our guide on getting started with Go development on a Raspberry Pi using GoLand. In it, we first learned how to install Ubuntu 19.10 ARM64, then we installed Go, Delve, and GoLand. Finally, we set up RealVNC to enable us to remotely control the device, even if we don’t have a screen attached to it.

Let us know your questions and feedback in the comments section below, the issue tracker, or our Twitter account.