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:
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…
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:
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?