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
On Tuesday, May 14, 2019 3:01:48 PM PDT Andrew Savchenko wrote:
> On Tue, 14 May 2019 11:47:04 -0700 Georgy Yakovlev wrote: > > On Tuesday, May 14, 2019 9:15:52 AM PDT Andrew Savchenko wrote: > > > Hi all! > > > > > > Looks like rustc supports target CPU and optlevel options, e.g. > > > > > > rustc -C target-cpu=skylake -C opt-level=3 > > > > > > as well as more fine-grade optimizations. > > > > > > But I see no way to specify them when building rust software. > > > Am I missing something? Is there any reason for not providing > > > something like RUSTFLAGS? > > > > > > Best regards, > > > Andrew Savchenko > > > > Hi, > > > > I have this in make.conf for quite some time. > > > > RUSTFLAGS="-Ctarget-cpu=native -v" > > > > it just works(tm) as you expect it to. > > Well, it does not, at least for me. Right now I'm building > torbrowser from mozilla overlay and content of RUSTFLAGS from > make.conf doesn't show up in rustc arguments. >
That's something about mozbuild, not the variable itself. check about:buildconfig page of torbrowser. RUSTFLAGS show up for me on that page, not 100% sure if they actually get applied. I have no idea how it calls rustc. if it's cargo then to see verbose invocations you need to find where the build system calls it and add "-vv" btw, be careful with -C opt-level=3 for ff or derivatives, it was known to cause segfaults some time ago. for regular packages this variable works fine.
> Moreover there is no mention of RUSTFLAGS in either man rustc or > rust/cargo eclasses.
because it's a variable used by cargo to call rustc with given params, not by rustc itself. This has nothing to do with eclass, it's cargo setting supposed to be set by user. CARGO-RUSTC(1) page does mention it more details here: https://github.com/rust-lang/cargo/blob/master/src/doc/src/reference/ environment-variables.md
> > > I remember earlier rustc/cargo were failing if same options specified > > twice, for example once in toml files and second time via RUSTFLAGS, but > > I can't reproduce anymore. > > Maybe it got smarter and RUSTFLAGS actually override whatever is set in > > toml files. > > > > > > - > > Regards, Georgy > > Best regards, > 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>