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

Fix rustc-cfg usage #135

Open
volks73 opened this issue Nov 27, 2020 · 3 comments
Open

Fix rustc-cfg usage #135

volks73 opened this issue Nov 27, 2020 · 3 comments
Assignees
Labels

Comments

@volks73
Copy link
Owner

volks73 commented Nov 27, 2020

The rustc-cfg crate uses the rustc --target <triple> --print cfg command, which works for determining toolchain/target information but it will not work for determining Cargo-based compiler configurations, such as features enabled or disabled via the RUSTFLAGS environment variable. The cargo rustc -- --print cfg and optionally the cargo rustc --target <triple> -- --print cfg commands should be used instead. The rustc-cfg crate does not appear to support the cargo rustc command. I am in the process of creating a new cargo-rustc-cfg crate inspired by the rustc-cfg crate that does use the cargo rustc commands. The rustc-cfg crate should then be replaced with this new one.

@volks73 volks73 added the bug label Nov 27, 2020
@volks73 volks73 self-assigned this Nov 27, 2020
@volks73
Copy link
Owner Author

volks73 commented Nov 28, 2020

I have created and published the cargo-rustc-cfg crate. The rustc-cfg crate will eventually be replaced with this one to address this issue.

@volks73
Copy link
Owner Author

volks73 commented Dec 9, 2020

There are a couple of issues popping up with the cargo-rustc-cfg crate. Cargo is building the project every time for every target because it does not abort the build process or "dry run" when the -- --print cfg arguments are used. There is also issues with Cargo targets and needing to add cargo-metadata as a dependency to select a single target. All of these can be worked around, but it is not great.

Really the Cargo Rust Compiler (rustc) configuration is just needed to detect the CRT feature (#115), and the rest might be obtained from just the rustc configuration (rustc-cfg crate) using the --target <TRIPLE> option. So, I think this is on-hold until the issues with the cargo rustc command are resolved.

@volks73
Copy link
Owner Author

volks73 commented Feb 27, 2021

A mechanism for obtaining the Cargo-based compiler configurations. It will take a while for it to reach stable for Cargo, but this will greatly unify resolution of this issue along with resolving #115. The cargo-rustc-cfg crate will also need to be updated, but that will eventually replace usage of the rustc-cfg crate here.

Once this issue is resolved and the crt-static issue is properly addressed, a new release seems appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant