Gentoo Archives: gentoo-alt

From: Johan Hattne <johan.hattne@××××××××××××××.edu>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] Binary-only distributions on linux
Date: Fri, 23 Apr 2010 17:18:06
Message-Id: 4BD1D640.5040002@utsouthwestern.edu
In Reply to: Re: [gentoo-alt] Binary-only distributions on linux by Fabian Groffen
1 On 04/23/10 03:02, Fabian Groffen wrote:
2 > On 22-04-2010 20:55:58 -0500, Johan Hattne wrote:
3 >> As far as I can see, setting the rpath is one way to solve the problem,
4 >> and I've been toying around with patchelf to accomplish that (chrpath
5 >> won't work, because it doesn't allow rpaths to grow). To my mind, the
6 >
7 > I'd like to add it to the tree when I've got time to make an ebuild for
8 > it.
9
10 Here's a start (lines broken courtesy of mailer). "ebuild test" works
11 for me.
12
13 EAPI="3"
14
15 DESCRIPTION="A small utility to modify the dynamic linker and RPATH of
16 ELF executables"
17 HOMEPAGE="http://nixos.org/patchelf.html"
18 SRC_URI="http://hydra.nixos.org/build/114505/download/2/${PN}-${PV}.tar.bz2"
19
20 KEYWORDS="~x86-linux"
21 LICENSE="GPL-3"
22 SLOT="0"
23
24 src_configure() {
25 econf --docdir="${EROOT}/usr/share/doc/${PN}-${PV}" \
26 || die "configure failed"
27 }
28
29 src_install() {
30 emake install DESTDIR="${D}" || die "make install failed"
31 }
32
33 From what I understand, it doesn't work on Solaris (why?), so Linux only.
34
35 >> process is conceptually similar to the "shebang prefixing" that happens
36 >> for shell scripts, so I'm wondering whether it would make sense to
37 >> implement it in a similar fashion, e.g.
38 >>
39 >> for each ELF file {
40 >> prepend ${EPREFIX} to each rpath element
41 >> prepend ${EPREFIX}/lib:${EPREFIX}/usr/lib to rpath
42 >> }
43 >>
44 >> somewhere in portage. At least this allowed me to use icc to compile a
45 >> 32 bit helloworld using an x86-prefix on both x86 and amd64.
46 >
47 > Do you have an idea how to automagically select the correct ELF files?
48 > Most already contain the required paths of course. I don't quickly see
49 > how we can pick the right ones out there to "fix", but perhaps that's
50 > possible. Otherwise, maybe a function in prefix.eclass that does the
51 > job somehow?
52
53 Not sure which "correct" ELF files you mean: for now I just scanned the
54 whole image-directory for ELF files and fixed all of them up in a ad hoc
55 sort of way. The assumption is that if there's no rpath, then
56 "${EPREFIX}/lib:${EPREFIX}/usr/lib" is probably reasonable. If there is
57 an rpath "/A:/B", then
58 "${EPREFIX}/lib:${EPREFIX}/usr/lib:${EPREFIX}/A:${EPREFIX}/B" may be OK.
59 But no, I didn't actually check whether the fixed rpaths can be used to
60 resolve dynamic linking. And I haven't even thought about the
61 possibility that there may be ELF files which shouldn't have their rpath
62 "fixed".
63
64 This may very well be stupid in ways I haven't yet realised--I'm still
65 playing around with it. But since I think that the binary-only ebuilds
66 should make it into prefix sooner (or later), I figure this is the place
67 to bring it up.
68
69 // Cheers; Johan