Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build-std config option. #782

Merged
merged 1 commit into from
Jun 13, 2022
Merged

Add build-std config option. #782

merged 1 commit into from
Jun 13, 2022

Conversation

Alexhuszagh
Copy link
Contributor

@Alexhuszagh Alexhuszagh commented Jun 11, 2022

Detects if rust-std is not an available component for a target, and if build-std = true in Cross.toml under [build] or [target.(...)], then use the -Zbuild-std flag.

Closes #692.

@Alexhuszagh Alexhuszagh added enhancement A-config Area: cross-toml config labels Jun 11, 2022
@Alexhuszagh Alexhuszagh added this to the v0.2.2 milestone Jun 11, 2022
@Alexhuszagh Alexhuszagh requested a review from a team as a code owner June 11, 2022 02:51
@Emilgardis
Copy link
Member

what if we want to build std with our compiler options even if std is already provided?

@Alexhuszagh
Copy link
Contributor Author

what if we want to build std with our compiler options even if std is already provided?

Would it be a good idea then to make it always active when set to true? So remove the following checks and only allow it to be enabled on nightly in all cases? I'll have to confirm how it works for targets with pre-built standard libraries, if it still needs nightly to compile std from source.

https://github.com/cross-rs/cross/pull/782/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R361-R366

@Emilgardis
Copy link
Member

Emilgardis commented Jun 11, 2022

you need nightly, and that's probably always going to be true due to some features std uses. (unless you use RUSTC_BOOTSTRAP)

Detects if `rust-std` is not an available component for a target, and if `build-std = true` in `Cross.toml` under `[build]` or `[target.(...)]`, then use the `-Zbuild-std` flag. This has higher priority than `xargo`: `xargo` will only be used if a target is not a built-in.

A sample `Cross.toml` file is the following:

```toml
[target.x86_64-unknown-dragonfly]
build-std = true
```

Closes cross-rs#692.
@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Jun 11, 2022

I've updated it so build-std is always enabled if provided as a config option, and tested it on both x86_64-unknown-dragonfly and arm-unknown-linux-gnueabihf to ensure it builds the Rust standard library in both cases. The only other aspect is we use CROSS_BUILD_STD instead of CROSS_BUILD_BUILD_STD, so it differs slightly from CROSS_BUILD_XARGO, because I felt the latter was pretty cumbersome.

@Alexhuszagh Alexhuszagh requested a review from Emilgardis June 13, 2022 18:10
@Emilgardis
Copy link
Member

lgtm, please edit the pr description (as that's what bors uses for commit message)

@Alexhuszagh
Copy link
Contributor Author

bors r=Emilgardis

@bors
Copy link
Contributor

bors bot commented Jun 13, 2022

Build succeeded:

@bors bors bot merged commit e1676d2 into cross-rs:main Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-config Area: cross-toml config enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drop xargo in favor of build-std
2 participants