On 10/16/2009 12:54 PM, walt wrote:
On 10/16/2009 04:37 AM, Neil Bothwick wrote:
On Fri, 16 Oct 2009 12:20:30 +0100, Peter Humphrey wrote:

I thought I'd have a play with swami, but the emerge fails with
"/bin/sed: can't read /usr/lib64/libogg.la: No such file or directory",
and indeed there is none such.

The elog message from the last libogg install explains this. Run
lafilefixer --justfixit.

There is no manpage for lafilefixer, but the --help flag prints:

       --justfixit       Choose some reasonable dirs, such as /usr/lib*, etc. ,
                         find all .la files and fix them to not use .la files
                         for linking

I can't make sense out of that -- one of the major uses of libtool (I thought)
is for linking.  Can anyone 'splain that to me?

One of the major problems with .la files (besides being mostly useless on Linux/FreeBSD/any other ELF-based OS) is when they refer to other .la files instead of linking directly to the binaries. This breaks things when they get removed from a ebuild for a library that other libraries depend on.

The only time that libtool archives provide a real benefit is when there's a need to link in static libraries that have external dependencies -- the libtool archive defines the dependency information that can't be stored in the static archive format. If you don't have any publicly-consumed static libraries, .la files are just pointless clutter, so package maintainers very often remove them. Any build system depending on libtool for its linking then breaks because the dependency chain is broken.

Take, for example, this very real example from my system. I have both hal and dbus installed; hal depends on dbus, and both packages install libtool archives. In /usr/lib/libhal.la, there is the following:

# Libraries that this one depends upon.
dependency_libs=' /usr/lib/libdbus-1.la -lcap -lpthread -lrt'

Thus, whenever a package that uses hal tells libtool to link to libhal.la, libtool recursively links to libdbus-1.la as well.

Now, say the dbus maintainer suddenly doesn't like .la files (perhaps a bad break-up in Los Angeles), and removes them from the ebuild. The next time I true to use libtool to link in hal, it will fail because the latest dbus does not include /usr/lib/libdbus-1.la.

The fix is to run lafilefixer, which changes the above line to say:

# Libraries that this one depends upon.
dependency_libs=' -L/usr/lib -ldbus-1 -lcap -lpthread -lrt'

So that hal no longer cares whether or not the dbus package installed its libtool archive, and all is well.

--Mike

Reply via email to