How to crossbuild apps for ubuntu core with snapcraft

I develop an Ubuntu Core app on a x86 system for an arm target with snapcraft.

The snapcraft.yaml contains architectures: [armhf] and snapcraft generated a .armhf.snap file. That seems to be OK.

But if a part contains an Ubuntu dependency using stage-packages, the resulting snap contains only x86_64 libs.

How can it fix this?


Unfortunately Snapcraft doesn't yet support cross-building. In order to build a snap for x86 it needs to be run on an x86 host; for arm, an arm host.

Indeed, as mentioned by didrocks, you can run Snapcraft directly on the Snappy device by using the Classic Dimension on Ubuntu Core 16.04.