Snap dependency with incompatible base

I have a core18-based snap which pulls in the nmap snap as a dependency. This has generally worked fine, but recently the nmap snap was updated to one that’s based on core22. I’m still able to pull in the dependency seemingly without issue, but trying to actually run the nmap binary naturally leads to a number of GLIBC_2.XX not found errors.

What options do I have, apart from rebasing my own snap to core22? The nmap snap doesn’t appear to have a “legacy” `core18 version or channel currently available. And given that I’m not the owner of that snap, I don’t believe that I have a way to “access” older versions of it.

Either way, it does seem a bit odd that snapcraft allows me to pull in a snap dependency with a mismatched base in this way.

I presume you’re adding nmap as a stage snap when building your snap. Instead, you can get it from the archive matching your base using stage-packages, or if you need an up-to-date version, you can build it from sources in a separate part.

Right, that makes sense. I went with the older version (from the archive) as a quick solution for now, though that has some bugs so I’m going to switch to building from source.

Still weird that there isn’t a better solution. Also the fact that having an upstream snap switch base can silently lead to a failure like this (instead of e.g. an “incompatible base” error at build time).