-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
A-build-scriptsArea: build.rs scriptsArea: build.rs scriptsA-cross-compilingArea: using --target flag for other platformsArea: using --target flag for other platformsA-rustflagsArea: rustflagsArea: rustflagsC-enhancementCategory: enhancementCategory: enhancementS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Description
The cargo documentation environment-variables.md
says
RUSTFLAGS - A space-separated list of custom flags to pass to all compiler invocations that Cargo performs. In contrast with cargo rustc, this is useful for passing a flag to all compiler instances.
This is wrong, unfortunately. The flag is not passed to all compiler instances: When cross-compiling (i.e., when --target
is set), the flag is not passed to build scripts. It seems there is currently no way to pass anything to build scripts when --target
is set, which clearly is a feature gap. Cargo should provide a way to set flags for build scripts even when cross-compiling.
One may be tempted to set CARGO_TARGET_<target>_RUSTFLAGS
or target.<target>.rustflags
, but that does not work either.
GameKyuubi, LunNova, rbalicki2, behnam, aymericbeaumet and 26 moremo8it
Metadata
Metadata
Assignees
Labels
A-build-scriptsArea: build.rs scriptsArea: build.rs scriptsA-cross-compilingArea: using --target flag for other platformsArea: using --target flag for other platformsA-rustflagsArea: rustflagsArea: rustflagsC-enhancementCategory: enhancementCategory: enhancementS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.