Cross-compiling with snapcraft: iota

Last week I snapped iota, a small editor with emacs and vi modes.

I decided I wanted to try it out on a Raspberry Pi before pushing it to the snappy store, for that I need to cross-compile. Conveniently I recently implemented support for that in snapcraft.

If you didn’t follow the previous step from my previous blog post, to try what I’m about to do, you’ll need a fresh clone of my iota branch.

git clone git@github.com:kalikiana/iota.git
cd iota
git checkout snapcraft

If on the other hand, like me, you built a snap for another architecture before, in my case amd64, I need to clean the build files.

snapcraft clean

Now on to the most difficult step:

snapcraft --target=arch=armhf

Time for a cup of coffee!

Once it’s done, you can use SSH (or whatever your preferred method is) to copy the snap to your Raspberry Pi 2 or 3 running Ubuntu Core.

snapcraft install --dangerous --classic iota_0+git.67643b3_armhf.snap

Now I can use iota as my editor on the Raspberry Pi!