Specify different linux version on snapcraft.yaml

Hi guys, I want to build my own application on snapcraft but I can’t build it on Ubuntu 16.04

Can I specify a different Linux version in snapcraft.yaml?

Thanks

While it isn’t possible to specify a different base distribution currently (it’s coming though), you can instead bundle everything needed for your application all the way down to libc. By doing that you’ll mask the libraries in the core snap and so will be running entirely on the things you shipped.

How can I do that? Sorry, but I’m a newbie of snapcraft.

Thanks :slight_smile:

You need to specify a separate part for every dependency all the way down to libc with appropriate after: clauses to ensure correct order of operations:

Contrived example:

parts:
  libc:
    plugin: autotools
    source: http://some-libc-source.example.com/libc.tgz

  dependency-library:
    after:
    - libc
    plugin: autotools
    source: http://some-upstream-source.example.com/example.tgz

  actual-application:
    after:
    - dependency-library
    - libc
    plugin: cmake
    source: your-project-files-dir

Of course I’m wondering why you believe you cannot build it on 16.04…

Thank you, I’ll try…

I can’t build it on 16.04 because the principal library used in the program (libtorrent-rasterbar-dev) is outdated and misses a lot of functions called in my application. I use another library stored in an external repository and I can’t call that library as well. I’ll try to compile both of them as you told me.

You could build on 18.04 (which presumably will have a library that’s up-to-date enough for you?) using this guide, the downside is that you won’t be able (yet) to use build.snapcraft.io, but you could still use Launchpad.