Gentoo Archives: gentoo-user

From: walt <w41ter@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Library file formats
Date: Fri, 16 Oct 2009 18:52:16
Message-Id: hbafbh$6jk$1@ger.gmane.org
In Reply to: Re: [gentoo-user] Re: Library file formats by Mike Edenfield
1 On 10/16/2009 11:06 AM, Mike Edenfield wrote:
2 > On 10/16/2009 12:54 PM, walt wrote:
3 >> On 10/16/2009 04:37 AM, Neil Bothwick wrote:
4 >>> On Fri, 16 Oct 2009 12:20:30 +0100, Peter Humphrey wrote:
5 >>>
6 >>>> I thought I'd have a play with swami, but the emerge fails with
7 >>>> "/bin/sed: can't read /usr/lib64/libogg.la: No such file or directory",
8 >>>> and indeed there is none such.
9 >>>
10 >>> The elog message from the last libogg install explains this. Run
11 >>> lafilefixer --justfixit.
12 >>
13 >> There is no manpage for lafilefixer, but the --help flag prints:
14 >>
15 >> --justfixit Choose some reasonable dirs, such as
16 >> /usr/lib*, etc. ,
17 >> find all .la files and fix them to not use
18 >> .la files
19 >> for linking
20 >>
21 >> I can't make sense out of that -- one of the major uses of libtool (I
22 >> thought)
23 >> is for linking. Can anyone 'splain that to me?
24 >
25 > One of the major problems with .la files (besides being mostly useless
26 > on Linux/FreeBSD/any other ELF-based OS) is when they refer to other .la
27 > files instead of linking directly to the binaries. This breaks things
28 > when they get removed from a ebuild for a library that other libraries
29 > depend on.
30 >
31 > The only time that libtool archives provide a real benefit is when
32 > there's a need to link in static libraries that have external
33 > dependencies -- the libtool archive defines the dependency information
34 > that can't be stored in the static archive format. If you don't have
35 > any publicly-consumed static libraries, .la files are just pointless
36 > clutter, so package maintainers very often remove them. Any build
37 > system depending on libtool for its linking then breaks because the
38 > dependency chain is broken.
39 >
40 > Take, for example, this very real example from my system. I have both
41 > hal and dbus installed; hal depends on dbus, and both packages install
42 > libtool archives. In /usr/lib/libhal.la, there is the following:
43 >
44 > # Libraries that this one depends upon.
45 > dependency_libs=' /usr/lib/libdbus-1.la -lcap -lpthread -lrt'
46 >
47 > Thus, whenever a package that uses hal tells libtool to link to
48 > libhal.la, libtool recursively links to libdbus-1.la as well.
49 >
50 > Now, say the dbus maintainer suddenly doesn't like .la files (perhaps a
51 > bad break-up in Los Angeles), and removes them from the ebuild.
52
53 I think .la files are an adequate reason to dislike .la files :o)
54 They have certainly wasted many frustrated hours for me.
55
56 > The
57 > next time I true to use libtool to link in hal, it will fail because the
58 > latest dbus does not include /usr/lib/libdbus-1.la.
59 >
60 > The fix is to run lafilefixer, which changes the above line to say:
61 >
62 > # Libraries that this one depends upon.
63 > dependency_libs=' -L/usr/lib -ldbus-1 -lcap -lpthread -lrt'
64 >
65 > So that hal no longer cares whether or not the dbus package installed
66 > its libtool archive, and all is well.
67
68 An excellent 'splain, thank you very much :o) Thanks also to Volker for
69 the links to Diego's blogs. I'm about halfway through them now.