Closed alex closed 4 years ago
It seems like cargo build -Z build-std=core,alloc
is roughly the equivalent to cargo xbuild
. I just tried it and it basically works, I just needed to add rlibc
as dependency (including extern crate
) because the mem
feature of compiler_builtins
is not activated.
I'm currently looking for a way to automatically pass the -Z build-std
argument through a configuration file, similar to build.rustflags
in .cargo/config
. Does anyone know if this is possible?
In addition to what @phil-opp wrote above there's also this comment FWIW.
Does anyone know if this is possible?
This is sort of tangentially covered by https://github.com/rust-lang/wg-cargo-std-aware/issues/5 to "only need" -Z build-std
instead of a list of crates, but then the actual final UX of enabling the build-std
logic hasn't been discussed too much, so I've opened https://github.com/rust-lang/wg-cargo-std-aware/issues/43 to track that.
Basically in short, it's not possible yet, you've got to pass -Z build-std
to everything. We know it's not great, but the ball's now rolling!
@alexcrichton Thanks! Something like the build.std
configuration key you proposed sounds like a good solution.
One workaround I found for now is to use cargo aliases, e.g. xbuild
for build -Z build-std
, which is slightly more ergonomic than typing out the full -Z
command.
Pointed out on https://github.com/rust-lang/wg-cargo-std-aware/issues/43, we forgot to add documentation to https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for this feature! Adding that should be sufficient for closing out this issue.
Based on https://github.com/fishinabarrel/linux-kernel-module-rust/pull/180, this seems to be working great based on the provided instruction so I'm considering this working!
Now that the pieces are starting to come together, having documentation so one can play with migrating to this would be a huge boon.