Build c/c++ library / application

I’m a newbie here, and I want to build a library, and a c++ application using snap.
I’ve followed the dosbox tutorial (, but I’m not really sure this is what I need. My application is not yet committed into any repository, and it requires special make commands to build.

Moreover, it is a library and an application that uses that library; and I want to create a snap for both. I’m on uc20.

Can you advise how to create the yaml file to build the library? How can I specify then at the application to bring my library in? How can I specify like: “hey, here are the sources on disk” and “this is what you should do to build”, and “this is the artifact to pack”.

Can I deploy my snap without going through the snap-store?


Welcome aboard !!!

To make your app use a library you built from source (or in any other way, i.e. by downloading it pre-built from somewhere) you add a part for each of them and then make sure the app part builds after the lib part by defining the after: keyword …

as long as you use some default build system (make, autotools, cmake, ninja …) snapcraft will set the right variables (LD:LIBRARY_PATH, LIBRARY_PATH, includes, PKG_CONFIG_PATH etc) to point the part you build after the libs to the right places to find headers and source as needed …

this is about all the generic hints one can give you without actual build errors or issues … i’d propose you just start with a snapcraft.yaml, try to build your two bits by having two parts in it and then come to us with actual build errors …

for local testing you can always install a snap with using the --dangerous option to the snap install command, that will turn off the store related security and signature checks.

Dear Ogra,

I’m still struggling with my snap image.

I followed a procedure to init a snapcraft, and bild it, but I get this error.

ubuntu@ubuntu:~/snap$ mkdir anouther_snap
ubuntu@ubuntu:~/snap$ cd anouther_snap/
ubuntu@ubuntu:~/snap/anouther_snap$ snapcraft init
Created snap/snapcraft.yaml.
Go to for more information about the snapcraft.yaml format.
ubuntu@ubuntu:~/snap/anouther_snap$ snapcraft
Launching a VM.
launch failed: Unable to find an image matching "core18". Please use `multipass find` for supported remotes and images.
An error occurred with the instance when trying to launch with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.

Although I need core20 as base, but I get the same error.

I don’t really know what is going on.