libtool rocks! (except when dealing with rpm packaging)

Rex's rant on shared-lib libtool archives (.la files), original excerpt from a recent bugzilla thread... http://bugzilla.redhat.com/193134

Disclaimer: Don't get me wrong, I'm not denigrading .la files in any way. They're great and have invaluable usefulness in building and maintaining software. And, I hope, that no-one is advocating the universal killing-off of .la files. I'm only speaking in the context of rpm packaging and including .la files assocated with shared libraries.


In the context of software *packaging*, shared-lib .la files, in general, just plain suck. When/if using systems with good shared libraries (and avoiding the static lib/linking cases), .la files are generally unnessessary and lead to needless dependancies (e.g, are viral).

Here's a crazy-but-not-too-far-from-reality example: Build shared-lib pkg 'b' which links against 'a'. b's .la files now include references to 'liba.la' (so now depends on it). Build shared-lib pkg 'c' which links against 'b', whose own libc.la file includes references(+dependancy) on libb.la. Rinse, lather, repeat. You'll end up with a pkg z, and a libz.la, which, when all is said and done,

When, generally, *none* of these are really required nor desired. Discussions on this topic have been raised on the libtool mailing lists:

The fix for this is easy too. At each stage, simply omit %%_libdir/lib*.la from packaging. You end up with a nice, clean libz, which may or may not depend on liby, and which almost certainly doesn't depend on liba, ..., libx. Now, if, for whatever reason, you absolutely cannot exclude %%_libdir/lib*.la from packaging, you still can prudently prune it's contents of extraneous bits (usually all or most references to other libraries or libtool archives).

This is, as I understand it, the basis for the campaign to remove shared-lib .la files from Fedora Core.