Ubuntu – How to create an architecture independent snap

packagingsnap

I've created a small snap package that contains no compiled architecture dependent code. When I build the package it ends up named like ..._amd64.snap, but there is no reason why the program within the snap couldn't run on any other architecture.

So is there a way I can build the snap so it can be installed on any architecture?

Best Answer

Searching around a bit, I found the solution in the packaging for the classic snap. Edit the snapcraft.yaml file, and add the following at the top level:

architectures: [ all ]

Now when building the snap, the resulting file name will be ..._all.snap, and the architecture in prime/meta/snap.yaml will also be set to all rather than the build system's architecture.

The resulting snap can be installed on any system regardless of its architecture.

Related Question