What makes a snap architecture dependent?

Provided snaps are just a squashfs file system, i was wondering why can’t I install a python snap built on x64 machine, on a raspberry pi running ubuntu mate?

snaps can be multi-architecture. For example the http snap is a python snap with architectures: [all]. The icdiff snap used to be, but then I needed to bundle git so now it’s per-architecture.

Any snap that is architectures: [i386] could instead be architectures: [i386, amd64] (and there might be a few that use this).

You could also have a single snap that shipped binaries for multiple architectures, if that makes sense to you. Everything supports it (even though it’s not the default). But having per-architecture snaps means smaller download sizes, so people prefer that.

2 Likes

Thanks for your explanation, Chipaca. Also somehow It slipped my mind that a snap using the python plugin would also bundle the python interpreter (executable) in the snap which would pretty much be architecture specific. It all makes sense now!

note that it doesn’t have to bundle python, but by default it does (and not bundling python requires some knowledge of and time investment into checking what’s in the selected core); bundling it is definitely more expedient.

I defined all architectures except i386 like this:

architectures: [s390x, ppc64el, arm64, armhf, amd64]

When I build the snap, it creates a snap called: gradle_6.5_multi.snap

However the snap includes Java packages and they’re distributed per arch. I’ve setup the GitHub integration with Snapcraft site. When I push to the repository, only one of the architectures is built but the filename is still gradle_6.5_multi.snap.

But I don’t think it embedded all JDK distros in my snap. Any ideas?

I don’t think snapcraft itself has explicit support for multi-architecture snaps; you need to do the legwork by hand for that. snapcraft supports, instead and almost equivalently, building multiple snaps, one per architecture. Try something like

architectures:
  - build-on: s390x
  - build-on: ppc64el
  - build-on: arm64
  - build-on: armhf
  - build-on: amd64

and then try snapcraft remote-build.

1 Like