Skip to content

Using build.rustflags is awkward right now #3052

Closed
@CamJN

Description

@CamJN

Based on #2535 and rust-lang/rust#23238 and rust-lang/rust#13841. I thought I could add

[build]
rustflags = ["-C target-cpu=native"]

to my ~/.cargo/config file to pass that flag to my builds. But that breaks everything. Turns out I have to use ["-C", "target-cpu=native"] which is weird but it works, so w/e. However when I run cargo build --verbose I noticed that the -C target-cpu=native flag gets passed to rustc twice in immediate succession. ie: rustc src/main.rs --crate-name min --crate-type bin -g --out-dir /Users/camdennarzt/Developer/Rust/min/target/debug --emit=dep-info,link -L dependency=/Users/camdennarzt/Developer/Rust/min/target/debug -L dependency=/Users/camdennarzt/Developer/Rust/min/target/debug/deps -C target-cpu=native -C target-cpu=native

rustc: 1.11.0
cargo: 0.11.0 (259324c 2016-05-20)
uname -a: Darwin SECUR-T.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions