Gentoo Archives: gentoo-user

From: "François-Xavier Carton" <fx.carton@×××××.fr>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Building packages in different prefix without rebuilding system packages
Date: Thu, 14 May 2020 08:37:41
Message-Id: 20200514083712.GA20188@pc-fx
In Reply to: Re: [gentoo-user] Building packages in different prefix without rebuilding system packages by Michael
1 On Thu, May 14, 2020 at 09:07:43AM +0100, Michael wrote:
2 > On Thursday, 14 May 2020 06:13:33 BST Dale wrote:
3 > > François-Xavier Carton wrote:
4 > > > Hi,
5 > > >
6 > > > Is there a way of installing packages in a different prefix while still
7 > > > using system packages? I've tried setting EPREFIX, however doing that
8 > > > will install all dependencies in the prefix, even if there are already
9 > > > installed in the system.
10 > > >
11 > > > I was hoping to install some packages in user directories, but I also
12 > > > don't want to duplicate the packages installed globally. For example,
13 > > > most packages eventually depend on gcc, which I definitely don't want to
14 > > > compile twice. So ideally, only dependencies that are not installed
15 > > > globally should be pulled in.
16 > > >
17 > > > I was not able to find a way of doing that, but I feel like it shouldn't
18 > > > be too hard, because EPREFIX almost does what I want. Does someone know
19 > > > if it's possible without too much tweaking?
20 > > >
21 > > > Thanks,
22 > > > -François-Xavier
23 > >
24 > > I'm clueless on EPREFIX but if you want to avoid compiling a package
25 > > twice, would the -k option help? If you have portage set to save the
26 > > binaries you compiled before, it would install from that instead of
27 > > compiling things twice.
28 > >
29 > > Just thought I'd mention just in case it would help.
30 > >
31 > > Dale
32 > >
33 > > :-) :-)
34 >
35 > The whole concept of EPREFIX is predicated on installing a Gentoo system
36 > within a different path/filesystem than the / of the host installation and
37 > being able to run it as a non-root user. As I understand it, using libraries
38 > from the main system and potentially altering them in the process is not going
39 > to work without changing Gentoo's eprefix intended design.
40 >
41 > It should be possible to change the prefix paths selectively, in particular
42 > the LD_LIBRARY_PATH to link binaries from within the prefix to libraries in
43 > the host system, but I'm not sure what privileges are needed to install/run
44 > such a hybrid linkage and how an update of the host system will break
45 > installed packages within the EPREFIX and vice versa. We're talking of a
46 > Frankenstein build here with the potential of install operations on one system
47 > would be breaking the other, including portage itself.
48 >
49 > With containerisation of applications there may be easier ways to achieve what
50 > François-Xavier is looking for. I am thinking of running sandboxed
51 > applications in the likes of flatpack, snap, zero-install, appimage and
52 > whatever else may have been devised lately. However, with these systems you
53 > end up using what's already been developed and any static libraries their devs
54 > considered desirable. If you want a bespoke installation optimised for your
55 > hardware and chosen compilation flags, then you are probably looking to
56 > develop a containerised application for your own use.
57 >
58 > Someone more knowledgeable in both Gentoo's EPREFIX project and containerised
59 > apps should chime in soon to offer more helpful advice.
60
61 I wouldn't try to install different versions of the same package, just
62 add new packages to the base system. But I can see your point about
63 updates; since the base system is not aware of the prefixed one, it
64 cannot rebuild the packages in the prefix automatically when needed.
65 It's indeed more complex than what I hoped :(