Preventing dependencies from a base snap from being included


#1

I’m working on a new snap for network-manager for Ubuntu Core 18 (which uses base: core18), and have been trying to cleanup snapcraft warning as I hit them. I recently tackled this one:

Files from the build host were migrated into the snap to satisfy dependencies that would otherwise not be met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure that the following are either satisfied by a stage-packages entry or through a part…

I made sure all the libraries listed were included via stage-packages, as suggested, however noticed that two of the libraries mentioned should be provided by the core18 base snap:

  • lib/x86_64-linux-gnu/libsystemd.so.0
  • lib/x86_64-linux-gnu/libudev.so.1

When I asked @niemeyer about preventing these dependencies from automatically being staged, he asked that I create a post on the forum.

For reference, I’m using snapcraft version 2.42.1.


#2

Hi there, I want to start by saying that targeting different bases is a somewhat experimental feature and subject to behavioral changes in snapcraft.

We have been shifting on the concept, my hope was that this information be encoded in the build-environment related to the target base, but we have down scoped on that. For this to work as it currently does for core, what we have is a file listing of items that belong to the core inside snapcraft itself. I’ll bring this topic up for discussion in one of our following forward looking brainstorming meetings to come out with the appropriate path forwards.


#3

@sergiusens Thanks for the reply. So you must be black-listing the fully qualified library filenames (e.g. libudev.so.1.6.4).

FYI, we’re going to need to have a few snaps that build against the core18 base snap ready by mid-summer for an early customer preview. Until this gets sorted out, could we stage the snap, then manually remove the unwanted dependencies, then snap it?


#4

Yes, you can also use the no-system-libraries for the part that is doing this, more on that here https://docs.snapcraft.io/build-snaps/syntax#build-attributes