FoundationDB

FoundationDB clients on Alpine Linux


#1

Anyone tried to link with FoundationDB client library (libfdb_c.so) on Alpine Linux?

Alpine Linux is a default choice when using docker containers but it doesn’t use glibc, so existing libfdb_c.so does not work (missing symbols are reported).


(Markus Pilman) #2

Generating an archive instead of a shared object should be pretty straight forward. But this archive will still depend on glibc. Statically linking glibc is virtually impossible as glibc depends on many shared libraries that are linked in at runtime using dlopen. To some degree this might also be true for libstdc++.

I think you have two possibilities here:

  1. Ship a container that contains all dependencies
  2. Rewrite the fdbclient in go (this would be a major project, but it should be doable).

You can try to build a fdbc archive and link against uclibc and link statically against libstdc++ (which also has to be linked against uclibc). But I never did this so I can’t say how much work that would be.

Also: where are you planning to run these docker containers? Are a few hundred megabytes on disk really an issue for you? Also keep in mind that FDB is not tested with uclibc. So the performance characteristics might be very different and changing the C library might unearth new bugs.


#3

I managed to make it work by installing glibc package on Alpine Linux. It worked for scenarios I tried so far.
Target is to use it on OpenWhisk FaaS platform, so containers should be as small as possible since larger containers have longer cold-start times.

Alpine Linux has switched to musl instead of uclibc, but neither is supported by FoundationDB as-is, so adding support would be a continuous task (works until new FoundationDB gets released) unless it gets supported by FoundationDB maintaners.

AFAIK, all bindings use libfdb_c.so C client library, so just replacing it with a newer version it could talk using a newer wire protocol used by some new version of FoundationDB.
It could be rewritten in Go, but has the same problem as support for musl.