I feel like binary portability isn't really a concern, and so something like -march=native may always be the default behavior. I can't find anything saying one way or the other though.
Asked
Active
Viewed 2,773 times
12
Peter Cordes
- 286,368
- 41
- 520
- 731
Josh
- 2,005
- 1
- 16
- 21
-
1`rustc -C target-cpu=native ...` – ildjarn Oct 16 '17 at 22:41
1 Answers
11
As mentioned in the comments, pass the -C target-cpu option to rustc:
rustc -C target-cpu=native
For more options:
$ rustc -C help
...
-C target-cpu=val -- select target processor (rustc --print target-cpus for details)
...
See How to pass rustc flags to cargo? for more methods of passing the option.
I feel like binary portability isn't really a concern
I'm pretty sure that the Firefox developers that rely on Rust would disagree with you, as well as plenty of others.
Shepmaster
- 326,504
- 69
- 892
- 1,159
-
That's absolutely true... I knew I was missing something. I was thinking that crates are installed locally through cargo install - which compiles from source. Dependencies are also source-based. Thanks! – Josh Oct 17 '17 at 14:19