Python plugin GLIBC error in Ubuntu 18.04

I’ve tried the snapcraft package from apt and also snapcraft standard and snapcraft --edge from snapd to create a simple web server in Python 3.6. When I do get to the part when I need to prime it (server), I keep getting this message about GLIBC which I don’t remember getting in Ubuntu 16.04:

The GLIBC version of the targeted core is 2.23. A newer libc will be required for the following files:

  • /home/teg/testserver/snaps/prime/usr/bin/python3.6m (requires GLIBC 2.25)
  • /home/teg/testserver/snaps/prime/usr/lib/x86_64-linux-gnu/libexpatw.so.1.6.7 (requires GLIBC 2.25)
  • /home/teg/testserver/snaps/prime/usr/bin/python3.6 (requires GLIBC 2.25)
  • /home/teg/testserver/snaps/prime/lib/x86_64-linux-gnu/libexpat.so.1.6.7 (requires GLIBC 2.25)
    ‘libc6’ is required inside the snap for this part to work properly.
    Add it as a stage-packages entry for this part.

It seems weird to have to manually add stage-packages: [libc6] to that Python part since this plugin is a base one with Snapcraft.

1 Like

You’re not running the snapcraft CLI on Xenial, and the core snap (which contains libc) is based on Xenial. As a result, the only way we can ensure your snap runs on all operating systems is for you to stage the version of libc you’re using (since what you built requires a version newer than that in the core snap).

You might consider using snapcraft cleanbuild instead, which will use a Xenial container for building.

Are there plans to bring snapcraft up to speed with 18.04 in the near future? Its probably a silly question, but cannot hurt to ask. :slight_smile:

1 Like

it’s not a silly question at all :slight_smile:

Coming in the pipeline is the ability to specify a base snap which you’re building against. Currently almost all snaps are built against the xenial-based base snap (16-series) but work is ongoing to introduce a bionic equivalent (18-series) which can be selected per build. Multiple base-snaps should be able to be installed in parallel when they’re ready so each application snap can choose whichever has the dependencies they need.

1 Like

I think the current implementation of snapcraft has no way to bundle your own libc. It will be overridden by the libc from the “core” package. The only way to use newer version is change to use core18 but it is missing several features than the “core” package.

1 Like

Are there situations where this issue can be addressed by doing as the error message suggests and adding libc6 to stage-packages? In my experience so far it causes segfaults.

Is the end result of this that Snaps generally shouldn’t be built on Ubuntu 18 until Snap core matches Ubuntu 18 libc?

I think you can bundle a different libc, but if you use anything from the core snap (such as core’s version of bash to run a launcher script) then that will segfault.