I have a crate that only depends on libc
and core
(no std
or alloc
). Cargo.lock looks like this:
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "libc"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
[[package]]
name = <my package>
version = "0.1.0"
dependencies = [
"libc",
]
I need to build this crate without downloading any crates. This is currently possible using a rustc with the "src" component, cargo vendor
, and Xargo.
However I'm currently trying to ditch Xargo for -Zbuild-std
, and I'm unable to make it work. I'm not sure what exactly is the problem, but there are a few things that I think may be a part of the problem:
-
cargo vendor
doesn't seem to support-Zbuild-std
. I tried:cargo vendor -Zbuild-std
, which doesn't create core/alloc/std dependencies,cargo vendor -- -Zbuild-std
creates the crate in "-Zbuild-std" directory. So it seems like there is no way to include core/alloc/std dependencies in the vendor directory. -
cargo build -Z build-std=core
seems to look for crates that are not really a dependency for core. For example, I'm gettingerror: no matching package named `getopts` found
error even thoughgetopts
doesn't seem to be a dependency ofcore
: rust/Cargo.toml at master · rust-lang/rust · GitHub
Is there a way to make this work? Basically I want cargo vendor
to also unpack dependencies of core/std/alloc depending on which one of those I need. Currently in my case I only care about core
.