Gentoo Archives: gentoo-dev

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Rust flags
Date: Tue, 14 May 2019 23:58:30
Message-Id: 2946555.rRUN4FKPzz@ws
In Reply to: Re: [gentoo-dev] Re: Rust flags by Andrew Savchenko
1 On Tuesday, May 14, 2019 3:01:48 PM PDT Andrew Savchenko wrote:
2 > On Tue, 14 May 2019 11:47:04 -0700 Georgy Yakovlev wrote:
3 > > On Tuesday, May 14, 2019 9:15:52 AM PDT Andrew Savchenko wrote:
4 > > > Hi all!
5 > > >
6 > > > Looks like rustc supports target CPU and optlevel options, e.g.
7 > > >
8 > > > rustc -C target-cpu=skylake -C opt-level=3
9 > > >
10 > > > as well as more fine-grade optimizations.
11 > > >
12 > > > But I see no way to specify them when building rust software.
13 > > > Am I missing something? Is there any reason for not providing
14 > > > something like RUSTFLAGS?
15 > > >
16 > > > Best regards,
17 > > > Andrew Savchenko
18 > >
19 > > Hi,
20 > >
21 > > I have this in make.conf for quite some time.
22 > >
23 > > RUSTFLAGS="-Ctarget-cpu=native -v"
24 > >
25 > > it just works(tm) as you expect it to.
26 >
27 > Well, it does not, at least for me. Right now I'm building
28 > torbrowser from mozilla overlay and content of RUSTFLAGS from
29 > make.conf doesn't show up in rustc arguments.
30 >
31 That's something about mozbuild, not the variable itself.
32 check about:buildconfig page of torbrowser.
33
34 RUSTFLAGS show up for me on that page, not 100% sure if they actually get
35 applied.
36
37 I have no idea how it calls rustc. if it's cargo then to see verbose
38 invocations you need to find where the build system calls it and add "-vv"
39
40 btw, be careful with -C opt-level=3 for ff or derivatives, it was known to
41 cause segfaults some time ago.
42
43 for regular packages this variable works fine.
44
45 > Moreover there is no mention of RUSTFLAGS in either man rustc or
46 > rust/cargo eclasses.
47
48 because it's a variable used by cargo to call rustc with given params, not by
49 rustc itself.
50
51 This has nothing to do with eclass, it's cargo setting supposed to be set by
52 user.
53
54 CARGO-RUSTC(1) page does mention it
55
56 more details here:
57 https://github.com/rust-lang/cargo/blob/master/src/doc/src/reference/
58 environment-variables.md
59
60
61 >
62 > > I remember earlier rustc/cargo were failing if same options specified
63 > > twice, for example once in toml files and second time via RUSTFLAGS, but
64 > > I can't reproduce anymore.
65 > > Maybe it got smarter and RUSTFLAGS actually override whatever is set in
66 > > toml files.
67 > >
68 > >
69 > > -
70 > > Regards, Georgy
71 >
72 > Best regards,
73 > Andrew Savchenko

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] Re: Rust flags Andrew Savchenko <bircoph@g.o>