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

autocfg does not work in the presence of -Z build-std #34

Open
jdm opened this issue Feb 25, 2021 · 8 comments
Open

autocfg does not work in the presence of -Z build-std #34

jdm opened this issue Feb 25, 2021 · 8 comments

Comments

@jdm
Copy link

jdm commented Feb 25, 2021

build.rs:

fn main() {
  assert!(autocfg::new().probe_sysroot_crate("std"));
}

cargo build works fine for any target where libstd is already distributed. cargo build --target x86_64-uwp-windows-msvc -Z build-std panics even though the sysroot is being built correctly.

@cuviper
Copy link
Owner

cuviper commented Feb 25, 2021

Does cargo communicate this in any way? Maybe an environment variable?

@jdm
Copy link
Author

jdm commented Feb 25, 2021

bors-servo added a commit to servo/servo that referenced this issue Feb 25, 2021
Use build-std instead of xargo.

The changes to num-integer and indexmap are to work around cuviper/autocfg#34.
bors-servo added a commit to servo/servo that referenced this issue Feb 25, 2021
Use build-std instead of xargo.

The changes to num-integer and indexmap are to work around cuviper/autocfg#34.
jplatte pushed a commit to ruma/ruma that referenced this issue Jan 3, 2023
Otherwise, it fails to build with -Z build-std, see
cuviper/autocfg#34
@melvyn2
Copy link

melvyn2 commented Apr 20, 2023

This breaks the bigint crate for certain targets like i686-apple-darwin. Any idea for when this might be fixed?

@cuviper
Copy link
Owner

cuviper commented Apr 20, 2023

There's no plan how to fix it yet...

Assuming you mean num-bigint, it should degrade ok without it, no?

@melvyn2
Copy link

melvyn2 commented Apr 20, 2023

Some dependent crates rely on features which get deactivated because of this, even though bigint builds successfully... I'll try to build the stdlib by hand in the meantime. Hopefully -Z build-std will be stabilized eventually.

@jyn514
Copy link

jyn514 commented Apr 20, 2023

Why does autocfg care if the crate is loaded from the sysroot or passed with --extern? Shouldn't extern crate std work in both cases?

@jyn514
Copy link

jyn514 commented Apr 20, 2023

Oh, is the problem that cargo only passes --extern std=... to the final crate, not to build scripts? I wonder if it should set some environment variable with a list of the std crates built from source ... in general I think it would be nice for cargo to expose a way for build scripts to invoke rustc the same way cargo would in the current build.

@jyn514
Copy link

jyn514 commented Apr 20, 2023

Ah, that already exists and it's called CARGO_ENCODED_RUSTFLAGS 😄 I think we should open an upstream issue for cargo to include the --extern std flags in CARGO_ENCODED_RUSTFLAGS.

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

No branches or pull requests

4 participants