Common questions about cross-distribution building

Is cleanbuild required?

No, it’s not, although it’s recommended because it tends to work without thinking much about the problem and it tends to reproduce similar builds every time.

Can I build a snap in Linux distribution X version Y?

Yes, of course. The key point to keep in mind is that there are some libraries in whatever platform snap is being used as a base, so the application inside a shipped snap needs to either:

  1. link with compatible libraries, or
  2. be statically linked, or
  3. ship its own libraries.

So why is Ubuntu 16.04 frequently mentioned?

The initial implementation of snapd supported a single “core” base snap and this snap was created out of libraries that shipped in Ubuntu 16.04. So specifically when using alternative (1) above, and specifically when using the default “core” snap, that’s the context.

What other base snaps are available?

Not many right now, because we only managed to finish support for arbitrary base snaps late last year (2017). We are working on core18 right now that will be built after libraries shipping in Ubuntu 18.04.

Can other Linux distributions have their own base?

They are welcome to have their own base snaps too, of course. It’s just that somebody has to do the work, and then hopefully maintain it over time too.

How snapcraft builds for a particular base?

It’s not yet doing a great job of that. The point we want to reach is that snapcraft will know how to pull an image and build something that will work well for a particular base snap, and that should work on any Linux distribution that has snapcraft and its dependencies.

I’ll expand this list as I observe similar questions on the topic for which having an answer here would be helpful.

1 Like