How do I compile a snap for armhf/arm64?


#1

I’m trying to compile an Electron app using electron-builder. My problem is that there doesn’t seem to be any clear way to build a snap for any of the arm varieties at the moment.

I can’t cross compile for armhf or arm64 from my amd64 machine, as cross compilation isn’t working with the current snapcraft+multipass versions. The snap builds fine if I’m targeting my amd64 machine, but throws errors otherwise.

I then decided to try to build an arm64 snap on my raspberry pi with an Ubuntu Server arm64 installation. That didn’t work either because qemu doesn’t launch on the raspi2 kernel (virtualization is disabled I think). Same with the standard armhf version…

Long story short, I’m not understanding how one actually goes about generating an armhf or arm64 snap at the moment.

More of my struggles can be seen here:


#2

you could try to create an lxd container for armhf or arm64 on your machine, then inside the container you can export

SNAPCRAFT_BUILD_ENVIRONMENT=host

to make snapcraft not use multipass inside the container …


#3

Thanks! This ended up working. I didn’t bother using LXD and just set that environment variable and it built my electron app locally on the Pi without using multipass.