Table of Contents
It turns out that it's quite hard to make a binary which will work reliably on different distros and even versions of the same distro. However, in order for your package to work correctly on all Linux distros this is a subject that must be tackled. Ignore this section at your peril!
The first problem is glibc symbol versions. The GNU C library is a rather
special package. All programs use it, either directly or indirectly, as it
interfaces programs to the kernel and provides functions for services like file
system access, DNS lookup, arithmetic and so on. It also deals with shared
library support. Normally, when a library breaks binary compatability, the
maintainer increases the major number in the soname, effectively renaming the
library (but in a standard way). This means several versions can be present on
the system at once. glibc does not do this, for a variety of reasons I won't go
into here. Instead, it renames each individual function, meaning there can be
several different versions of the same function. The ELF interpreter glibc
provides is capable of dealing with this transparently. To see them, run
nm /lib/libc.so.6 | grep chown
.
When a program is compiled, it's linked against the latest versions of the symbols. If those symbol versions are not present on a system when the program is run, the link process will fail and the program won't start. This problem, and variants of it, have plagued UNIX-like systems for a very long time now. Because users cannot usefully upgrade glibc, the application must be compiled to use a reasonably old set of symbol versions - the versions used bracket the range of distros your binary can run on. Luckily, there is at least a partial solution in the form of apbuild . It is a drop-in replacement for gcc that controls the symbol versions used by the program. If any version that are too new, the build will fail. It will automatically select old versions of the symbols - by default, the binary will be portable (at least for glibc) back to glibc 2.2 - that's before Debian Stable and RH 7.2!