New comment by tranzystorek-io on void-packages repository https://github.com/void-linux/void-packages/issues/34889#issuecomment-1046310587 Comment: Did a bit of analysis on a test repo where I added some debug printouts to `autocfg`, and I seem to have found the problem. When autocfg probes for the std crate, it runs a custom `rustc` command with arguments that try to mimic the settings of the crate that is being built. In our case, that should include a custom `--sysroot=/usr` argument, pointing to the rust-std install for the cross target. Unfortunately, we pass this as the RUSTFLAGS environment variable, and the build.rs script run, being a subprocess in a new shell context, doesn't see any RUSTFLAGS in its environment. In the end the `rustc` probe is run with almost all the needed arguments, except for the `--sysroot`. EDIT 1: There also seems to be a general issue with passing RUSTFLAGS to build scripts: https://github.com/rust-lang/cargo/issues/4423 EDIT 2: The issue seems to be mitigated in `autocfg` 1.1.0, where it also tries to read `CARGO_ENCODED_RUSTFLAGS`, which as I checked is set by cargo in general when crossing in xbps-src