Cargo build fails in my distro, but succeeds in a Docker container

⚓ Rust    📅 2025-12-26    👤 surdeus    👁️ 1      

surdeus

I am trying to compile a rust project from github. I installed rust via curl https://sh.rustup.rs -sSf | sh (as user, not root) and have successfully used it to compile some other projects. The failure looks like this:

user@computer:~/src$ git clone https://github.com/playX18/capyscheme.git --depth=1
Cloning into 'capyscheme'...
...
user@computer:~/src$ cd capyscheme/
user@computer:~/src/capyscheme$ cargo --version
cargo 1.94.0-nightly (3861f60f6 2025-12-19)
user@computer:~/src/capyscheme$ cargo --color never build --profile release --target x86_64-unknown-linux-gnu -p capy --features portable,bootstrap
    Updating crates.io index
    Updating git repository `https://github.com/mmtk/mmtk-core`
    Updating git repository `https://github.com/6cdh/tree-sitter-scheme`
     Locking 338 packages to latest Rust 1.94.0-nightly compatible versions
      Adding bytemuck v1.23.1 (available: v1.24.0)
      ...
      Adding tree-sitter v0.25.10 (available: v0.26.3)
error: failed to download `anyhow v1.0.100`

Caused by:
  unable to get packages from source

Caused by:
  failed to unpack package `anyhow v1.0.100`

Caused by:
  failed to unpack entry at `anyhow-1.0.100/tests/ui/must-use.stderr`

Caused by:
  failed to unpack `/home/nate/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.100/tests/ui/must-use.stderr`

Caused by:
  failed to unpack `anyhow-1.0.100/tests/ui/must-use.stderr` into `/home/nate/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anyhow-1.0.100/tests/ui/must-use.stderr`

Caused by:
  unexpected end of file
user@computer:~/src/capyscheme$ 

If I try the build in a docker container (I use ubuntu:24.04, which is also my distro):

root@a55c062feff9:/# apt-get update && apt-get -y --no-install-recommends install git ca-certificates wget xz-utils make libffi-dev build-essential clang rsync
Get:1 http://archive.ubuntu.com/ubuntu noble InRelease [256 kB]
...
done.
root@a55c062feff9:/# wget -O rust.tar.xz https://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.xz
--2025-12-26 19:42:17--  https://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.xz
Resolving static.rust-lang.org (static.rust-lang.org)... 151.101.162.137, 2a04:4e42:26::649
Connecting to static.rust-lang.org (static.rust-lang.org)|151.101.162.137|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 198915228 (190M) [application/x-tar]
Saving to: 'rust.tar.xz'

rust.tar.xz                           100%[======================================================================>] 189.70M  2.00MB/s    in 1m 41s  

2025-12-26 19:43:58 (1.89 MB/s) - 'rust.tar.xz' saved [198915228/198915228]

root@a55c062feff9:/# mkdir rust && tar -C rust --strip-components 1 -xf rust.tar.xz && cd rust && bash install.sh
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
...
install: installing component 'llvm-bitcode-linker-preview'

    rust installed.

root@a55c062feff9:/rust# cd ..
root@a55c062feff9:/# git clone https://github.com/playX18/capyscheme.git --depth=1
Cloning into 'capyscheme'...
...
root@a55c062feff9:/# cd capyscheme/
root@a55c062feff9:/capyscheme# cargo --color never build --profile release --target x86_64-unknown-linux-gnu -p capy --features portable,bootstrap 
    Updating crates.io index
    Updating git repository `https://github.com/mmtk/mmtk-core`
    Updating git repository `https://github.com/6cdh/tree-sitter-scheme`                                                                           
  Downloaded adler2 
v2.0.1                                                                                                                         
...
   Compiling zstd v0.13.3============> ] 428/434: cranelift-codegen, zstd-safe, mmtk, capy(build)                                                  
    Finished `release` profile [optimized] target(s) in 3m 55s                                                                                     
root@a55c062feff9:/rust/capyscheme# # continue with build

I'm at a loss as to why the build fails in my distro but succeeds in the docker container. Please point me in the right direction. Thanks!

1 post - 1 participant

Read full topic

🏷️ Rust_feed