allow build-std to be configured per-target in .cargo/config.toml#15670
allow build-std to be configured per-target in .cargo/config.toml#15670fee1-dead wants to merge 2 commits intorust-lang:masterfrom
build-std to be configured per-target in .cargo/config.toml#15670Conversation
26a4ca4 to
95724a1
Compare
95724a1 to
a867d8e
Compare
|
cc @phil-opp if you want to do some testing/review :) |
|
Thanks for the PR! However, I don't think this is something we want to move forward with at this time. We are currently working on the build-std design, and the design is in flux and may not go in this direction. We probably want to hold off on making design changes at this time. Also, generally we prefer to have designs approved before moving to the implementation. I'm going to go ahead and close this for now. After we have made more progress on getting agreement on the direction for build-std, we may revisit exactly how this may work. |
|
In that case, could you please keep this open in case this is the direction to go in? cc @adamgemmell and @davidtwco |
|
Note that also it doesn't look like there was active design work in the area. Nor does it appear that there is a solution emerging from the previous discussions. I'm going to comment on the Zulip thread. |
What does this PR try to resolve?
-Zbuild-stdhas some issues with per-pkg-target and bindeps, as seen with #10444 and #9451.At the same time, since these features essentially enable builds where crates with different targets can co-exist, some people may want to use build-std for one target (in my own project:
amdgcn-amd-amdhsa, for OS dev people:x86_64-unknown-none) but not for another target where std is already shipped: #8733This PR overhauls the way build-std interacts with targets and we're able to fix the issues described above by introducing an additional per-target config in
.cargo/config.tomlforbuild-std. Note that these configs co-exist with the global-Zbuild-stdflag, and has different behavior whether or not the two are used together: if the global flag is enabled, then all targets will attempt to build their std crates, with per-target config as an override. If the global flag is not used, then only targets that are configured via per-target config will try to build std crates.This supercedes my two previous attempts at resolving the same issue: #10330 and #11969
How to test and review this PR?
Use
.cargo/config.toml:I've already included some essential tests in
tests/testsuite/standard_lib.rssuch as intersection with per-pkg-target and bindeps. Feel free to suggest additional test cases.I haven't run the cross compile test locally as I don't know how to get an environment for it on NixOS, will (ab)use the CI for this I guess.
Some unresolved questions:
[target.TARGET.unstable]instead?-Zbuild-stdway of usage?target.TARGET.build-std = 'xxx'whenTARGETisn't being built? (thus not parsed in the current state)