Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upCompiler command line customization #2112
Comments
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton and I discussed a potential scheme:
|
This comment has been minimized.
This comment has been minimized.
|
A downside here is that the complex rules about when to apply |
This comment has been minimized.
This comment has been minimized.
|
I'd like to tackle this this week. |
This comment has been minimized.
This comment has been minimized.
|
I'm having second thoughts about 'RUSTFLAGS applies applies to normal builds, not buildscripts and plugins'. I feel like this is going to be non-intuitive behavior. An alternative might be - when host != target, error when RUSTFLAGS is set. Thus RUSTFLAGS works in common cases where devs are just hacking at the command line. |
This comment has been minimized.
This comment has been minimized.
|
Why even have that host!=target error? Just let people shoot their foot already. :) On the distro side, we wouldn't be setting the environment everywhere, just within packaging scripts. This can be smart enough to set On the lone wolf developer side, a broad I would expect Cargo to use all that apply, from generic |
This comment has been minimized.
This comment has been minimized.
|
@brson I could envision a use case of using Cargo to cross-compile for ARM boards and wanting to test out various codegen options such as the SIMD options, and that use case would at least be easier if RUSTFLAGS "just worked". In general I feel that using RUSTFLAGS primarily means "use these flags in the output artifacts" and the fact that a bunch of other Rust code is compiled and run along the way could largely just be an implementation detail. |
This comment has been minimized.
This comment has been minimized.
|
An alternate proposal: Support just RUSTFLAGS, and only for target kinds. This covers the common use cases, including debian's I think, assuming people don't need to customize build scripts and plugins. Since cargo only builds one target per invocation you can change RUSTFLAGS between invocations if you are building multiple targets. Avoids settling on the non-standard and weird RUSTFLAGS-$target variables. In the future if it becomes important to support host kinds we add RUSTFLAGS_HOST. |
This comment has been minimized.
This comment has been minimized.
|
Sounds good to me |
brson
added a commit
to brson/cargo
that referenced
this issue
Dec 22, 2015
alexcrichton
referenced this issue
Jan 16, 2016
Closed
Passing target specific command line options to rustc #2284
Zoxc
added a commit
to AveryOS/cargo
that referenced
this issue
Jan 17, 2016
brson
added a commit
to brson/cargo
that referenced
this issue
Feb 17, 2016
brson
added a commit
to brson/cargo
that referenced
this issue
Feb 17, 2016
brson
added a commit
to brson/cargo
that referenced
this issue
Mar 4, 2016
This comment has been minimized.
This comment has been minimized.
|
There needs to be a way to specify target features that propagate to dependencies. For instance, the simd crate currently gates functionality with |
This comment has been minimized.
This comment has been minimized.
|
@ruud-v-a the intention of We haven't quite figure out a story for what that means yet, though. |
brson
added a commit
to brson/cargo
that referenced
this issue
Mar 16, 2016
bors
added a commit
that referenced
this issue
Mar 16, 2016
bors
added a commit
that referenced
this issue
Mar 17, 2016
bors
closed this
in
#2241
Mar 17, 2016
This comment has been minimized.
This comment has been minimized.
|
I wrote down some thoughts on how to handle the case of required target features on the internals forum. |
brson commentedNov 4, 2015
As with the Rust build itself, when distros build and package binaries of Cargo applications, they want to be able to customize all command lines to all compilers.
In the Cargo case this means at least customizing the rustc command line; it's not clear whether Cargo itself needs to provide facilities for customizing CFLAGS, etc. or if that's the responsibility of build scripts.
This requirement seems to be at odds with design goals of the Cargo developers. Design work is needed.
re https://internals.rust-lang.org/t/perfecting-rust-packaging-the-plan/2767