Gentoo Archives: gentoo-dev

From: Luca Barbato <lu_zero@g.o>
To: djc@g.o, Gentoo Development <gentoo-dev@l.g.o>
Cc: cardoe@g.o, alicef@g.o
Subject: Re: [gentoo-dev] Add rust eclass to support multi-target compilation
Date: Tue, 31 Jul 2018 10:04:03
Message-Id: 12b2347f-367b-7940-a494-784298426320@gentoo.org
In Reply to: Re: [gentoo-dev] Add rust eclass to support multi-target compilation by Dirkjan Ochtman
1 On 31/07/2018 09:35, Dirkjan Ochtman wrote:
2 > On Mon, Jul 30, 2018 at 5:02 PM gibix <gibix@××××××.net> wrote:
3 >
4
5 > As far as I know, the Rust ecosystem is largely bimodal: stuff is either
6 > compatible with stable and later, or it works only on nightly. It seems
7 > very rare that code is actually tied to a particular Rust release and does
8 > not compile against latest Rust stable. (Upstream actually promises they
9 > won't break code except in case they need to fix a soundness issue in the
10 > compiler.) So instead of building this whole target infrastructure (which
11 > is definitely needed for something like Python or Ruby), we should be able
12 > to just work with stable and nightly slots, and ebuilds can depend on those.
13
14 This is true until you do not want to use libsyntax and other
15 compiler-specific libraries.
16
17 Because of the enforced ABI-randomness, what you built against stable
18 must be rebuilt on stable.1, making those libraries non-shared might be
19 a topic.
20
21 > Upstream is also very clearly packaging their core tooling as a single
22 > package made up of a number of components, and these are distributed and
23 > compiled together in common usage on other platforms (with the rustup
24 > tooling). That also means they are tightly coupled -- for example, rustfmt
25 > can change formats over time, and CI that checks formatting will need to
26 > align with whatever the current stable Rust version of rustfmt is.
27
28 Actually rustfmt is interesting since it does use libsyntax and
29 depending on which project you may have to use the nightly rustfmt while
30 targeting stable.
31
32 > Installing the latest (nightly or beta) version of rustfmt while you have a
33 > stable Rust toolchain installed is thus not a good idea. As another
34 > example, cargo is now tagged as 0.28, but when passing --version it will
35 > report as 1.27.0 -- actually the Rust toolchain version.
36
37 Well it might be surprising, but for at least one project is actually
38 required :)
39
40 > For these reasons, I think it would be better to align our Rust ebuilds
41 > with upstream and work with single ebuilds (dev-lang/rust and
42 > dev-lang/rust-bin) that install all the tools belonging to a particular
43 > version of the Rust toolchain.
44
45 > What tools are installed can be customized
46 > with USE flags, and the default install can be minimal (just rustc and
47 > cargo, which you need to build packages anyway).
48
49 So once you need bindgen you have to rebuild rustc and then you need
50 clippy you build again rustc?
51
52 And what happens once you have yet-another-tool using libsyntax, you add
53 it to the rustc ebuild and unleash a -r1 to the users?
54
55 Sorry, does not sound good.
56
57 lu

Replies