View previous topic :: View next topic |
Author |
Message |
paluszak Apprentice
Joined: 28 Jun 2004 Posts: 265 Location: Warsaw, Poland
|
Posted: Wed Feb 13, 2019 2:12 pm Post subject: rust CFLAGS |
|
|
Hi,
Is there a way to add CPU-specific flags for rust ebuilds to make.conf? For instance something along the lines '-C target-cpu=native' to generate CPU optimized code? Or possibly other codegen options (https://doc.rust-lang.org/rustc/codegen-options/index.html)?
J. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54220 Location: 56N 3W
|
Posted: Wed Feb 13, 2019 7:31 pm Post subject: |
|
|
paluszak,
Yes and no.
Yes you can have per package CFLAGS. No, you don't do it in make.conf.
The process is documented in Per-package environment variables
The worked example is for debugging but you will be able to adapt it.
-- edit --
EXTRA_ECONF= lets you pass additional options to some build systems.
This may be useful too. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
paluszak Apprentice
Joined: 28 Jun 2004 Posts: 265 Location: Warsaw, Poland
|
Posted: Wed Feb 13, 2019 7:41 pm Post subject: |
|
|
I know how to set up per-package CFLAGS, but what I'm asking about is if there's an equivalent of CFLAGS for rust packages. For istance, I'd like my rust packages to be built with '-C target-cpu=native' option added to command line. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54220 Location: 56N 3W
|
Posted: Wed Feb 13, 2019 8:41 pm Post subject: |
|
|
paluszak,
Sorry, I misunderstood your question. I can delete my posts and your response to get your opening post back into the unanswered post search if you like. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
paluszak Apprentice
Joined: 28 Jun 2004 Posts: 265 Location: Warsaw, Poland
|
Posted: Wed Feb 13, 2019 8:59 pm Post subject: |
|
|
No, that's fine. I'll try to delve into the rust eclass. For now I found only that setting RUSTFLAGS env value adds given options to cargo builds, but that's what I found in the cargo man page. So it's kind of solved, but only kind of - afaik you can use rustc directly and not exclusively via cargo build system. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Mar 30, 2019 7:58 am Post subject: |
|
|
Putting RUSTFLAGS="-C target-cpu=native" into make.conf seems to have an effect - tested by putting an invalid option in there and watching emerge fail.
Unlike CFLAGS it's probably safe to use native there for the foreseeable future because rust has no distcc support. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54220 Location: 56N 3W
|
Posted: Sat Mar 30, 2019 10:47 am Post subject: |
|
|
Ant P.
For a long time now using -march=native in CFLAGS has been 'safe' with distcc.
distcc won't distribute when it sees that.
You no longer gent a mix of arches back, depending on what built on what arch. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
paluszak Apprentice
Joined: 28 Jun 2004 Posts: 265 Location: Warsaw, Poland
|
Posted: Sat Mar 30, 2019 10:51 am Post subject: [SOLVED] rust CFLAGS |
|
|
Ant P. wrote: | Putting RUSTFLAGS="-C target-cpu=native" into make.conf seems to have an effect - tested by putting an invalid option in there and watching emerge fail.
Unlike CFLAGS it's probably safe to use native there for the foreseeable future because rust has no distcc support. |
Yep, I noticed that. Seems to work perfectly fine. There are some build that fail with lto, mostly those linking against external C code, like Firefox. |
|
Back to top |
|
|
|