Search code examples
linuxpostgresqlshared-librariespostgresql-9.4alpine-linux

How to provide `__snprintf_chk` to a process in Alpine Linux


I have compiled a PostgreSQL plugin, wal2json, but when try to load it in PostgreSQL, it complains:

ERROR: could not load library "/usr/local/lib/postgresql/wal2json.so": Error relocating /usr/local/lib/postgresql/wal2json.so: __snprintf_chk: symbol not found

I found this documentation for __snprintf_chk.

Where it is and what should I do to provide it to the plugin?

My guess is that it's in some core library but not present in the version I have. Maybe I could link it statically?


Update: I figured out that this is an issue of Alpine Linux which uses musl instead of glibc. I have installed the Alpine packages for glibc, as done in https://github.com/jeanblanchard/docker-alpine-glibc/blob/master/Dockerfile . Didn't help, still the same error.


Solution

  • I switched to another base Docker image, Ubuntu. The result is a bit bigger image, but __snprintf_chk is available and works.

    Also, PostgreSQL has a Docker image that already has wal2json available, which I used in the end for the production.