Since I have been still fighting with the damned .la files and I’m pretty sure that even though I have explained some use cases most of my colleagues haven’t really applied them, I decided to go with a different approach this time: graphical guides.
Since the post about the tree size has gotten so much feedback, probably because the graphs impacted on people, this might actually prove useful.
Note: I first tried to draw the chart with Inkscape, but the connector available on its code only draws straight lines, which are unusable for stuff like this; I found no way to anchor lines to an arbitrary point of objects either, so I gave up; dia is tremendously bad to work with; kivio 2 is not in Portage nor available as binary package for either Windows or OSX; OpenOffice to the rescue, worked almost flawlessly, unfortunately I didn’t want to waste time to define customised colours so you get the bad and boring ones in the image.
As you can see from this graph, my idea is that, at the end, every .la file is removed. Of course this is not immediate and depends on a series of factors; this graph shows at least the basic question you got to ask yourself when you have to deal with shared libraries. Please note that this does not apply the same to plugins and for that I’ll post another, different flow chart.
- Does the package install internal libraries only? A lot of packages provide convenience libraries to share code between different executable programs (see this post for more information about it); this can be detected easily: there are no include files installed by default, the library is not in the ld path (such as
/usr/lib/packagename). In this case, the
.lafiles are not useful at all, and can be removed straight away.
Does the package only install shared objects? The
.lafiles are only meaningful for static libraries that have no dependency information; if a package is not installing static libraries (
.afiles) it needs not the
Do the libraries in the package need other libraries? If the libraries are standalone, and only depend on the C library (
libc.so), then there is no dependency information useful in the
.lafile, and can be dropped.
pkg-configthe official way to link to the libraries? When using
pkg-config, the dependency information is moved inside the
.pcfile, so the copy in the
.lafile is redundant, and thus unnecessary.
Is the package new? When adding a new package into Portage, there is no reason to keep the
.lafiles around when the conditions shown above apply. For packages that are already in portage, the removal of
.lafiles need to be considerate, or you’ll get the same kind of fire I got for trying to remove some (useless)
.lafiles out of the blue. Not a situation that I like, but so is life.
Based on a work at blog.flameeyes.eu.