Library versioning is used when the API and ABI changes. An example of a problem is:

/libexec/ .../.libs/run_unittests: Undefined symbol "_ZNK3isc3dns5rdata7generic4NSEC11getNextNameEv"

This is because the tool linked with as found in the default library path. It did not define isc::dns::rdata::generic::NSEC::getNextName() const.

Libtool's -version-info argument can be used to set the library versioning, for example:

libfoo___la_LDFLAGS = -no-undefined -version-info 1:0:0

The installed libraries (on FreeBSD) would be named like: lib/, lib/ (symlink to, lib/, and lib/libfoo.a.

The colon-delimited fields are interface:revision:age.

interface is the current interface number.

revision is the implementation of that interface. The runtime loader uses the highest revision.

age is the number of previous compatible interfaces. The age must be less or equal to interface. This can be updated immediately before public release.

On source code changes, increment revision.

On interface (API) changes (add, remove, changed), set revision to 0 and increment interface.

When a new interface is added since previous release, increment the age.

If an interface is removed or changed since last release, set age to 0.

Changing revision only means it is backwards compatible.

When adding a new interface, but the rest is compatible, then set revision to 0, and increment the age and interface.

If an incompatible library, then increment interface and set age and revision to 0.

We only increase the interface number once per software release.

The -no-undefined libtool switch is used to make sure shared libraries are made on all architectures that support it. (It allows building a shared library even on architectures that require that all symbols are resolved at run-time.)

(The old libtool naming was: major, minor, revision.)

Note that the software release version numbering does not correspond to any library version numbering.

Last modified 4 years ago Last modified on Jul 2, 2015, 12:04:21 PM