Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [EAPI 7] Cross-compile improvements (BDEPEND, BROOT, sysroot)
Date: Thu, 03 Dec 2015 08:28:54
Message-Id: 20151203092837.4af2db4c@gentoo.org
In Reply to: Re: [gentoo-dev] [EAPI 7] Cross-compile improvements (BDEPEND, BROOT, sysroot) by James Le Cuirot
1 On Wed, 2 Dec 2015 23:20:05 +0000
2 James Le Cuirot <chewi@g.o> wrote:
3
4 > On Wed, 2 Dec 2015 12:40:08 +0100
5 > Alexis Ballier <aballier@g.o> wrote:
6 >
7 > > On Tue, 1 Dec 2015 22:58:55 +0000
8 > > James Le Cuirot <chewi@g.o> wrote:
9 > > [...]
10 > > >
11 > > > I raised one further point with mgorny that he feels could
12 > > > potentially go into EAPI 7 but I think could remain an
13 > > > implementation detail. In cases #3 and #4 (basically when
14 > > > ROOT != / and PORTAGE_CONFIGROOT != /), the toolchain needs to
15 > > > know how to source headers and libraries from ROOT instead of /.
16 > >
17 > > Use SYSROOT. ROOT has nothing to do with building. This should be
18 > > defined in PMS though.
19 >
20 > In case #2, ROOT != / but SYSROOT = / so I take your point that
21 > SYSROOT would negate the need to check which use case we're dealing
22 > with.
23 >
24 > I looked into SYSROOT while I was writing cross-boss. It's used in
25 > some crossdev scripts, most notably cross-pkg-config, but not by
26 > pkg-config itself. It's also used in a small handful of eclasses and
27 > other *-config scripts but that's all. Conversely, the aforementioned
28 > libtool patch uses ROOT and I suspect many other things do too. In
29 > practise, you need to set both.
30
31 The libtool patch has probably not been updated after SYSROOT
32 introduction. Feel free to file a bug about it.
33
34 > On reflection, I'm now thinking that we should call it something less
35 > generic. I also found that the Qt build uses SYSROOT for its own
36 > purposes so you cannot rely on it in toolchain wrappers. ROOT is
37 > probably just as unreliable. For that reason, I ended up using
38 > CB_SYSROOT in cross-boss.
39 >
40 > I forgot to mention earlier that if ROOT were used, PMS actually
41 > forbids it from being referenced in the src_* phases so this
42 > restriction would need to be lifted. Relying on the toolchain's
43 > internal sysroot is not sufficient.
44
45 And PMS is absolutely right.
46
47 Put simple:
48 SYSROOT is where "sources" are installed (headers, .so, etc); think
49 debian's -dev packages.
50 ROOT is where packages are merged.
51
52 Meaning:
53
54 RDEPEND are installed to ROOT
55 DEPEND are installed to SYSROOT
56 (BDEPEND are installed to /)
57
58 This implies that there is no guarantee at all that $ROOT is not
59 completely empty when executing any src_* phase since RDEPEND does not
60 need to be satisfied at that point.
61
62
63 (this also implies that for BDEPEND to make sense, you also need a
64 proper definition of SYSROOT in PMS)
65
66
67 [...]
68 > > [...]
69 > > > CMake supports a CMAKE_SYSROOT argument that you set in the
70 > > > toolchain file. We currently don't set this but it could easily be
71 > > > added to cmake-utils.eclass as well as (or instead of?) the
72 > > > similar variables that we already do set.
73 > >
74 > > iirc, CMAKE_SYSROOT is only for your case #4 and behaves more like
75 > > 'build as if I had chrooted in CMAKE_SYSROOT' and thus doesn't help
76 > > at all for cross-compilation
77 >
78 > Even without CMAKE_SYSROOT, since fixing the toolchain file stuff in
79 > cmake-utils.eclass a little while back, CMake has actually been doing
80 > a very good job of cross-compiling anyway. I doubt setting this would
81 > make it any worse.
82
83 Try it. My memories definitely tell otherwise.
84
85 [...]
86
87 Alexis.

Replies

Subject Author
Re: [gentoo-dev] [EAPI 7] Cross-compile improvements (BDEPEND, BROOT, sysroot) Joakim Tjernlund <Joakim.Tjernlund@××××××××.com>