Running Eclipse RCP applications on a Raspberry Pi

My previous Raspberry Pi related blog post was about running the Eclipse Orion server. This time I wanted to run a more demanding Eclipse RCP (Rich Client Platform) application and decided to use the better performing hard float “Wheezy” distribution of Raspbian.

As Java 7 is not available in the required flavour I also have to use the early access version of Java 8. The procedure of installing both of these is pretty identical to what I described in my previous post, so I’m not wasting time on documenting it. You’re probably able to figure it out.

Now, Eclipse RCP applications are, as I think you already know; Java GUI applications with native widgets, OSGi and what not. So JNI binaries for the platform have to be present. In this case binaries for 32-bit ARM (v6 little endian) Linux using the GTK windowing system. The crux of this experiment is that these binaries are not readily available. The source code must possibly be ported and at least compiled for the architecture in question before it can be used in an RCP application. Also, for the sake of sanity, it would be better if everything was available in a Equinox p2 repository to use as target platform.

Building SWT native libraries

This part describes how to build the native libraries for Raspberry Pi. However there is no real reason why everyone should have to do this – so you may just jump to the last section if you want to get started on writing applications.

Now, the Common Build Infrastructure (CBI) does offer an option to build natives on preconfigured hosts – I did not explore that option. I suspect that it should be fairly straightforward once one figure out where to do the configuration. Meanwhile this part is done manually.

Follow the instructions for using SWT from Git. Import the org.eclipse.swt project, make sure you change the .classpath_gtk to .classpath and built it. This should result in a new bin folder which contains source code for the SWT native libraries.

I grasped from the SWT documentation that the SWT JNI libraries are not simply cross compiled, so we would probably be better off just building them on the Raspberry Pi. Easy does it. In order to do so we must install a few required development packages:

This will just give you the minimum of SWT libraries – there are more that can be built.

Now, copy the entire org.eclipse.swt project from your host to the Raspberry Pi. Then on the Pi execute:

This will compile the SWT JNI libraries for the ARM v6 little endian architecture. After a while we should have a few static libraries available:

These are the files that are used by Java to render Gtk widgets when running SWT on a Raspberry Pi. You could create a new fragment bundle in eclipse.platform.swt.binaries named org.eclipse.swt.gtk.linux.armv6l, place the binaries in there and rig it all up.

Building the Equinox launcher

The Equinox launcher is not really required for this experiment. However it does make launching Eclipse based applications much easier as we get a proper native executable to use. The problem is that CBI appears to expect a launcher to be present for all architectures when building. So let’s indulge it.

Like the SWT there appears to be some rigging in place to do the native building on preconfigured hosts. However this part is even more straightforward than for SWT.

I’ve already done the work with adding the armv6l bundle so the only thing that must be done is to build the native code.

You should now have one eclipse executable and one eclipse_1504.so that must be placed in certain locations in the rt.equinox.binaries project. Again – I’ve already done that. You’ll find everything over at GitHub.

Building Eclipse

Now we need to build the Eclipse Platform in order to get a p2 repository to use as target repository. You’ll also get the Eclipse SDK product builds for various platforms. I’ve written a script that will do just that. It uses a customized version of eclipse.platform.releng.aggregator, with the addition of a few other bundles with the ARMv6 support. (The wonders of git submodule is at play here).

Execute this script and after a few hours you should now have an Eclipse SDK in eclipse.platform.releng.aggregator/eclipse.platform.releng.tychoeclipsebuilder/sdk/target/products you should now find org.eclipse.sdk.ide-linux.gtk.armv6l.tar.gz. The target platform is at eclipse.platform.releng.aggregator/eclipse.platform.releng.tychoeclipsebuilder/rcp.sdk/target/repository.

I decided to try it all out by running the one RCP application I have ready, the Eclipse SDK. It is actually barely usable – but you could do small projects. I would not recommend doing your development in this way though, but a far less demanding RCP application would probably work OK. That’s what the target platform repository is for.

Have fun!

9 Comments

  1. After installing the EA java 8 sdk, the command to build the equinox executables should be:

    sh rt.equinox.framework/bundles/org.eclipse.equinox.executable/library/gtk/build.sh -java /opt/jdk1.8.0

    As the JDK is placed not in standard location

    1. Hi Franz. No, it appears to be broken now that the base repositories have changed. I’ve been working on a new version that patches the cloned repos instead of forking them. It should be easier to keep up with changes that way. However it’s not quite ready yet. Meanwhile you may want to take a look at the PiPlug project: http://genuitec.github.io/piplug/

  2. Okay I see, I am extremely interested in a “sometimes usefull new version” you may provide in the future 🙂

    Thanks for the link, it is one option I am going to try.

Leave a Reply