Skip to content

Commit

Permalink
RTS build: don't vendor Rust deps
Browse files Browse the repository at this point in the history
Vendoring dependencies is causing a lot of problems in #2761 and other
PRs, because `cargo vendor` currently has a bug and cannot vendor
standard dependencies (deps of alloc and std, see
rust-lang/wg-cargo-std-aware#23).

For a long time I thought vendoring is a necessity and tried to work
around this issue by vendoring dependencies manually, or using
https://github.com/nix-community/naersk.

However, it turns out vendoring is not necessary, and we can download
dependencies in build step just fine. I also don't see any advantages of
vendoring the dependencies. So in this PR we remove vendoring.

Unblocks #2761.
  • Loading branch information
osa1 committed Oct 6, 2021
1 parent bb14959 commit 22e38e1
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ let
wasmtime
rust-bindgen
rustfmt
cacert
];

llvmEnv = ''
Expand Down Expand Up @@ -176,23 +177,10 @@ rec {
export XARGO_HOME=$PWD/xargo-home
export CARGO_HOME=$PWD/cargo-home
# this replicates logic from nixpkgs’ pkgs/build-support/rust/default.nix
mkdir -p $CARGO_HOME
echo "Using vendored sources from ${rustDeps}"
unpackFile ${rustDeps}
cat > $CARGO_HOME/config <<__END__
[source."crates-io"]
"replace-with" = "vendored-sources"
[source."vendored-sources"]
"directory" = "$(stripHash ${rustDeps})"
__END__
${llvmEnv}
export TOMMATHSRC=${nixpkgs.sources.libtommath}
export MUSLSRC=${nixpkgs.sources.musl-wasi}/libc-top-half/musl
export MUSL_WASI_SYSROOT=${musl-wasi-sysroot}
'';

doCheck = true;
Expand Down

0 comments on commit 22e38e1

Please sign in to comment.