Snapcraft now auto-detects missing dependencies

by Igor Ljubuncic on 5 December 2019

When you build snaps, the process of composing a complete snapcraft.yaml file will usually revolve around three main activities: parts, build requirements and runtime components. Sometimes, you may discover that you’re missing certain libraries in the compilation stage, or that they are required for your application to run. In most cases, you will iterate on your build a few times, and perhaps use our faster development guide to quickly nail down the missing elements.

From snapcraft release 3.7 onward, things have become ever so easier. Now, it is possible to have snapcraft automatically detect and list missing runtime libraries, and allow you to complete your build with fewer errors and in less time.

Missing files detection

The core principle behind the change is that snapcraft will now generate a list of entries you need to include as your stage packages in snapcraft.yaml. This means you will not have to manually run your application, or use ldd to trace the dynamic dependencies, to figure out if any library is missing. This streamlines the user experience, and makes builds more elegant and faster.

For instance, on the command line, you will see something like the output below:

Staging dosbox-x
Priming desktop-glib-only
Priming fdk-aac
Priming nv-codec-headers
Priming ffmpeg
Priming dosbox-x
The 'dosbox-x' part is missing libraries that are not included in the snap or base. They can be satisfied by adding the following entries to the existing stage-packages for this part:

- libxkbfile1

Snapping 'dosbox-x'
Snapped dosbox-x_0.82.23_amd64.snap

Once the prime step of the build process runs, snapcraft checks for missing entries. The printed message is meaningful, and will be particularly useful to new snapcraft users.

Now, it is possible there might be assets that are not available in the standard repository archives, and you will have to manually download and satisfy the runtime requirements. You can achieve this by using the dump plugin, for instance.

Upcoming versions of snapcraft will have extended missing file detection functionality. Snapcraft will be able to take into account plugs using the content interface, allowing for an ever more streamlined experience.


Snapcraft has many useful features and options. Sometimes, it can take a little time and practice to discover them, and put them to good use into your snap development. Missing library detection is an essentially simple yet powerful functionality that should make the overall development experience fresher and more efficient.

We hope you appreciate the occasional tip and trick we share here, like the introduction of the KDE neon extension (and GNOME extension), or this guide. If you have any specific asks, or comments, please join our forum and let us know what you think.

Photo by William Bout on Unsplash.

Newsletter Signup

Related posts

Develop Uno Platform projects on Linux with Visual Studio

Uno Platform is bringing their support to Linux. Uno allows you to build native mobile, desktop, and WebAssembly apps with C# and XAML from a single code base. You can build Linux applications with Uno using Visual Studio and Ubuntu on WSL. In collaboration with Uno, we built a mock-up snap that measures and adjusts […]

Complex problems, clever solutions – unique containers and virtualization snaps

Snaps come in many shapes and forms: security tools, productivity apps, games, handy utilities, video editing software, and more. Often, most snap package a single application. But snaps can also include services, databases, as well as multiple binaries. How far can this concept scale, you ask? Quite far. There are also some rather unique […]

How to manage snap updates

Updates are an integral part of the software lifecycle. Quite often, they bring improvements, vital security patches – and sometimes, unfortunately, bugs, too. In mission-critical environments, it is important to assert a high degree of oversight and precision over updates. Snaps come with a built-in automatic update mechanism, whereby sn […]