Some C libraries need you to build and run small C programs on the host as part of a prepare step. It would be nice if you could use cc for this, but the problem is a lot of build setups seem to use unsuffixed CC for the target's cross compiler - so setting .target(&env::var("HOST").unwrap()) means you'll get the wrong compiler.
Proposal:
impl Build {
fn build_for_host(host: bool) -> &mut Build;
}
If true, all other functions would ignore CC and TARGET_CC. There could be more checks as well like panicking if you try to set .target(...), though that doesn't seem necessary.
Basically I'd like this test to emit my-cc-only-for-aarch64 then cc, rather than my-cc-only-for-aarch64 both times https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=addf8301e9aa9181539c10fb17ff0804.
Some C libraries need you to build and run small C programs on the host as part of a prepare step. It would be nice if you could use
ccfor this, but the problem is a lot of build setups seem to use unsuffixedCCfor the target's cross compiler - so setting.target(&env::var("HOST").unwrap())means you'll get the wrong compiler.Proposal:
If
true, all other functions would ignoreCCandTARGET_CC. There could be more checks as well like panicking if you try to set.target(...), though that doesn't seem necessary.Basically I'd like this test to emit
my-cc-only-for-aarch64thencc, rather thanmy-cc-only-for-aarch64both times https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=addf8301e9aa9181539c10fb17ff0804.