Gentoo Archives: gentoo-alt

From: Fabian Groffen <grobian@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] revdep-rebuild and install_name
Date: Tue, 08 May 2007 20:01:43
Message-Id: 20070508200118.GE450@gentoo.org
In Reply to: Re: [gentoo-alt] revdep-rebuild and install_name by Johan Hattne
1 On 08-05-2007 14:48:15 +0200, Johan Hattne wrote:
2 >>>> b) I've been killing darwinistic specialties in ncurses and readline
3 >>>> recently, on purpose
4 >>> :)
5 >>>
6 >>> Anyway, here's what I had in mind.
7 >
8 > Going out on a limb here, but this is how I understand the problem.
9 >
10 > (1) When linking against a shared/dynamic library the recorded dependency
11 > is taken from the -install_name option used when the library was built, or
12 > -o if -install_name was not supplied. I guess the point is that if an
13 > executable is linked against a not-yet-installed library, it'll work once
14 > the library is installed. So libraries can't just be moved from their
15 > install location, because everything that is and, interestingly, will be,
16 > linked against them will look for the libraries in their old place.
17
18 Ehm, yeah. I think you got that right. In general:
19 On all platforms we sort of record the location where a dynamic lib is
20 supposed to be in the binary that looks for it. On Darwin this is a
21 path to the library itself, on Linux and Solaris (ELF systems) this is a
22 path to the directory where the library is, stored in the RPATH record.
23
24 > (2) In non-prefix, libraries typically end up in /usr/lib*. If /usr isn't
25 > on the the same partition as /, there may be problems if something during
26 > boot needs /usr/lib to resolve its symbols. Hence, some libraries need to
27 > be in /lib, and symlinks won't do.
28
29 The compiler, linker and runtime linker all default to /usr/local/lib,
30 /usr/lib, /lib to search for libraries. This means, (also on Darwin in
31 a way) that if there is no path given for a dynamic library, it is
32 searched for in those three paths. You can influence that by setting a
33 special variable, but that's in general considered to be a bad
34 practise.
35
36 The reason why stuff is in /lib and not in /usr/lib has to do with the
37 function the location. /lib should always be available, /usr/lib can
38 get mounted (e.g. over NFS) only later, and hence can also become
39 unavailable. Same for /bin and /usr/bin. Hence, /bin/sh and
40 /usr/bin/bash on Solaris, as root uses /bin/sh, so /usr/bin/bash can
41 become unavailable safely to still rescue the system. So for the
42 libraries.
43
44 In Gentoo the libraries are never copied, but on GNU/ELF systems,
45 LD-wrapper scripts are made. Because Darwin (and more systems) don't
46 grok those scripts, we create symlinks for those systems. The reason
47 why this is done, is because in some cases GCC decides to make a static
48 binary instead of a dynamic one if it doesn't see a dynamic library in
49 /usr/lib. I don't know the details of this, it's what I know from the
50 eclass that does this creating of the wrapper or symlink.
51
52 >> ncurses patch: no way, the main tree does it like that, so not going to
53 >> change that.
54 >
55 > ncurses is configured with --libdir=/lib. Then, whatever parts aren't
56 > needed in /lib are moved to /usr/lib, with the effect that moved items
57 > would no longer be found in /lib. What I tried to do was to configure with
58 > --libdir=/usr/lib, move necessary things to /lib and create links where the
59 > moved things used to be.
60
61 That was an error. Just recompile those things that now generate a
62 kernel trap. It's a pain maybe, but it's really better to just get
63 through this. I only had to recompile three packages or so, thusfar.
64
65 >> readline patch: I don't understand it
66 >
67 > readline is configured with --libdir=/usr/lib. Then all libraries are
68 > moved to /lib. I wanted to create symlinks for all libraries moved. I
69 > guess the intention would have been clearer if I had configured with
70 > --libdir=/lib and skipped the move altogether (not tested).
71 >
72 > That was the idea and sorry for any confusion caused.
73
74 It's good to put it on the table. I was a bit in a hurry when I
75 replied, so I forgot to say that I like the feedback. I think there is
76 no better way than keeping all platforms aligned wherever this is
77 possible. And this library location problem seems to be not a problem
78 on Darwin, but it does affect existing users, unfortunately. However,
79 it is a one-time pain, and a risk of running the highly experimental
80 Gentoo Alt/Prefix project ;)
81
82 Thanks!
83
84 --
85 Fabian Groffen
86 Gentoo on a different level
87
88 --
89 gentoo-alt@g.o mailing list

Replies

Subject Author
Re: [gentoo-alt] revdep-rebuild and install_name Johan Hattne <johan.hattne@××××××××××××.de>