Options for distributing a c program with library-dependencies under linux

Viewed 430

I developed a C program requiring some dynamic libraries, most notably libmysqlclient.so, which I intent to run on some remote-hosts. It seems like I have the following Options for distribution:

  1. Compile the program static.
  2. Install the required dependencies on the remote host
  3. Distribute the dependencies with the program.

The first option is problematic as I need glibc-version at runtime anyway (since I use glibc and libnss for now).

I'm not sure about the second option: Is there a mechanism which checks if a installed library-version is sufficient for a program to run (beside libxyz.so.VERSION). Can I somehow check ABI-compatibility at startup?

Regarding the last Option: would I distribute ALL shared-libraries with the binary, or just the one which are presumably not installed (e.g libmysqlclient, but not libm).

Apart form this, am I likely to encounter ABI-compatibility problems if I use a different compiler for the binary then the one the dependencies were build with (e.g binary clang, libraries gcc)?

1 Answers
Related