Version `GLIBC_2.34' not found snapping influxdb

To start, it is worth noting that I am very new to snapcraft. I am trying to snapping an app that used influxdb 2.7 as a database. After struggling to get influxdb to build with snapcraft, I ended up building it locally and using the dump plugin to add the binary to my snap. Here is my snapcraft.yaml:

base: core20

confinement: devmode

parts:
  influxdb:
    plugin: dump
    source: .
    source-subdir: bin


apps:
  influxdb:
    command: influxd

The snap successfully builds and installs, but fails to run, giving the error message:

/snap/firmware/x1/influxd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /snap/firmware/x1/influxd)
/snap/firmware/x1/influxd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /snap/firmware/x1/influxd)
/snap/firmware/x1/influxd: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /snap/firmware/x1/influxd)

I’ll also note that app runs fine outside of the snap.

I am on Ubuntu 22.04. Running ldd --version in the command line outputs

ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35

I have also tried using core18 and core22. core18 gives a similar error (with slightly different paths), and core22 fails to build.

Any help solving this issue would be greatly appreciated. Thanks in advance for any advice.

That libc error indicates that your build system does not match the base snap, or that you use a pre-built binary that was built for a different libc version than the base snap you picked defines…

How exactly do you do your builds?

Use base: core22 or build on Ubuntu 20.04

Thank you for the quick response. I used Docker to build the source. Here is the Dockerfile that I used (in the root of the influxdb repo):

FROM golang:1.20

COPY . /app/

RUN apt update && apt install -y clang make pkg-config protobuf-compiler libprotobuf-dev build-essential curl bzr

RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y

ENV GO111MODULE=on

RUN apt install git-all -y

RUN apt install cargo -y

WORKDIR /app

I build by running

sudo docker run -it --rm -v ./bin:/app/bin influxdb_build sh

then calling make from within the container shell.

I then copy the binary (influxd) that is added to ./bin in the influxdb directory to my snap project. I am able to run influxdb on the host machine using this executable, but the snap that is build from it fails to run.

As an aside, I want to mention that I did find a workaround to successfully snap influxdb. This is the snapcraft.yaml:

base: core20

confinement: devmode

parts:

  influxdb:
    plugin: nil
    build-packages:
      - wget
      - curl
    override-stage: |
      wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.7.1-amd64.deb
      dpkg --extract influxdb2-2.7.1-amd64.deb .
      mv usr/bin/influxd .
    prime:
      - influxd


apps:
  influxdb:
    command: influxd

Though I would still like to learn how to fix the original issue, if for nothing other than education.

I tried again with core22 and this time it worked. I’m not sure what the difference was that allowed it to build when previously it failed (I wish I took down the error I was getting, but I did not). The snap produced does run on my machine.

What is the reason for core22 being successful while core20 is not? Shouldn’t the snap be agnostic to the version of linux?

The best way is to use https://snapcraft.io/docs/go-plugin for building or stage-packages https://packages.ubuntu.com/search?keywords=influxdb.
If you use the dump plugin you should be aware of build environment used.
20.04 is compatible with core20 and 22.04 is compatible with core22.