"version `GLIBCXX_3.4.30' not found" but found in /usr/lib/x86_64-linux-gnu/libstdc++.so.6

1k Views Asked by At
    $ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.30
GLIBCXX_3.4.30

Yet, when running another application on the same docker container:

org.postgresql.util.PSQLException: ERROR: could not load library "/usr/lib/postgresql/13/lib/llvmjit.so": /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libz3.so.4)

The llvvjit.so file is also present:

# ls /usr/lib/postgresql/13/lib/llvmjit.so
/usr/lib/postgresql/13/lib/llvmjit.so

I'm using the following Dockerfile:

FROM alpine

RUN apk upgrade --no-cache
RUN apk add libstdc++ postgresql-client leiningen

WORKDIR /ui-service
COPY . .
CMD ["lein", "ring", "server-headless", "3000"]
EXPOSE 3000

What am I missing for postgresql driver to load the shared library, or how can I further debug this?

2

There are 2 best solutions below

0
Employed Russian On BEST ANSWER

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.30
GLIBCXX_3.4.30

Yet when running another application on the same docker container: org.postgresql.util.PSQLException: ERROR: could not load library "/usr/lib/postgresql/13/lib/llvmjit.so": /lib/x86_64-linux-gnu/libstdc++.so.6: version 'GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libz3.so.4)

Note that /usr/lib/x86_64-linux-gnu/libstdc++.so.6 and /lib/x86_64-linux-gnu/libstdc++.so.6 are not the same.

You likely have two versions of libstdc++.so.6 installed (never a good idea), one of them is older than the other.

P.S. Using string is the wrong way to look for versions. Use readelf -V /lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.30 instead.

P.P.S. You tagged this question with the glibc tag, but this has nothing to do with GLIBC. See this answer.

0
ealfonso On

The breakage in this case, including this failure to find a shared library, had nothing to do with the postgresql client.

The problem happened after a debian bullseye -> bookworm migration and was resolved by restarting the postgresql server.