On Unix-like systems dynamic shared libraries (.so files) have an SONAME
.
It can be extracted for example with:
readelf -a libfoo.so.0.3.2 | grep SONAME
-> libfoo.so.0
.
The last part is also called the SOVERSION
.
That version number marks versions of the library that are binary compatible (ABI).
So when a program links to one version of the library it can also use a later version if the SOVERSION
doesn't change.
Libtool has a -version-info
mechanism to decide such a SOVERSION
with current
, revision
and age
.
The clue is: current
is increased also on compatible changes and major = current - age
is used on most systems to set the SOVERSION
.
However, on BSD (FreeBSD, NetBSD, OpenBSD) the SOVERSION
is set to current
, which is mentioned in a couple of places like the
suse-wiki,
and I also tested this on the mentioned platforms.
The question is: Why is libtool doing this on BSD? Why is this considered to be "the way BSD does this"?
That means every compatible change for Linux/Darwin/SunOS is an incompatible change for the BSDs, because the SOVERSION
changes.
According to at least one developer who posted on the GNU mailing list, this could be considered a bug:
https://lists.gnu.org/archive/html/bug-libtool/2011-05/msg00007.html
That email is also full of useful references to the library versioning policies to various BSDs, which do appear to contradict libtool's behaviour