One advantage of using web technology and more in particular Eclipse Theia is that the tool can then be accessed directly in the browser without any installation or client set-up. However, this only works, if the tool based on Theia has been deployed somewhere. This could be a cloud server, a docker container, or in our case a Raspberry Pi! You might wonder why you would want to deploy a browser tool on a Raspberry Pi. First of all, a Raspberry is probably the cheapest server you can imagine, so if, for whatever reason, you cannot deploy and access your tool in the cloud, a Raspberry still allows a local client/server deployment. More interestingly, Raspberry Pis are often used to control or orchestrate embedded use cases. That means, the Raspberry executes some software which can control devices that are connected to it. In this scenario, having the tooling to develop this software running on the Raspberry provides a very consistent set-up. You could then ship a Raspberry which includes the software and the tooling – all on one device.

Anyway, since when do we need a reason to deploy something on a Raspberry Pi? It is just fun, so let us get going!

At this point we assume that you already installed the runtime dependencies of Theia, namingly Node.js v8 and Yarn.

The main issue we will have to deal with is a mismatch of processor architectures. The Raspberry Pi is powered by an ARM processor, while your development machine is likely an x86 based architecture. While it is certainly possible to build Theia directly on the Raspberry, you might want to instead use your regular computer for this. Doings so will save you the hassle of setting up the full build environment on the Raspberry and compilation will also be much faster.

However, you cannot simply copy your Theia build from a x86 based machine onto the Raspberry. This might seem odd at first because after all it is JavaScript based. However, Theia uses certain interfaces to make use of native OS functionality. For example, the terminal feature is based on the node-pty module, which forks native OS processes in the background and redirects their output. These interfaces include some C or C++ code, which must be compiled for the architecture Theia is running on. To be able to build code for the ARM architecture on your regular x86 machine you need a so called “cross-compiler”. As the name implies it will allow you to compile code for a target architecture that is different from the architecture the building machine itself is running on. The Raspberry Linaro provides a cross-compiler which you can find here. Clone this repository as a preparation and point the paths to it later (see below).

First, compile Theia as usual using

yarn install

This will build Theia for your current architecture (x86). Now we need to re-compile the native bits using our cross compiler. To do that we have to set two environment variables, defining the C and CPP compiler to use. You can set them like so:

Note: There is currently a time out issue when running Theia on a slow machine like a Raspberry Pi. You can avoid this problem by appending –no-cluster to the yarn start command. With this option, everything will run in the same process rather than separate worker processes. The progress of this issue is being tracked here.

The Author

Maximilian & Jonas lead the EclipseSource office in Munich. They work as consultants and software engineers for Eclipse technologies.

Both are Eclipse experts with a focus in Eclipse Modeling, project leads and committers to various Eclipse projects including EMF Forms, EMFStore, Edapt, e4 and the EMF Client Platform and regular EclipseCon speakers on these topics.

Furthermore they are dedicated to teach Eclipse and open source technology not only to professionals but also to talented university students in an Eclipse lab course.