Introduction to cargo

Cargo is the Package Manager for Rust. Like that, during the build it uses curl to download cargo files which are actually .tar.gz source archives.

This package requires internet access to build and at runtime (when rust is compiling another package). It will use all available cores. It also needs the current or previous version to compile itself, so here a binary of the previous version is used to bootstrap.

本パッケージは LFS-8.0 において正しくビルドでき動作することが確認されています。

Package Information

Additional Downloads

Cargo Dependencies


CMake-3.9.1, rustc-1.16.0


git-2.14.1, OpenSSL-1.1.0f

User Notes:

Installation of cargo

Install cargo by running the following commands:

tar -xf ../rust-installer-20161004.tar.xz \
    --strip-components=1 --directory src/rust-installer &&

case $(uname -m) in
    x86_64) tar -xf ../cargo-0.16.0-x86_64-unknown-linux-gnu.tar.gz
    i686) tar -xf ../cargo-0.16.0-i686-unknown-linux-gnu.tar.gz
esac                                                 &&

./configure --prefix=/usr                        \
            --sysconfdir=/etc                    \
            --docdir=/usr/share/doc/cargo-0.17.0 \
            --cargo=./cargo-nightly*/cargo/bin/cargo &&

To test the results, issue: CFG_DISABLE_CROSS_TESTS=1 ./target/*-unknown-linux-gnu/release/cargo test.

Now, as the root user:

make install &&
mv -v /usr/etc/bash_completion.d/cargo /etc/bash_completion.d

Command Explanations

tar -xf ../rust-installer-20161004.tar.xz ...: The rust-installer is needed, but not shipped with cargo, so BLFS provides a repackaged git snapshot.

--cargo=: This points to the binary of the previous version, so that the package can be bootstrapped. When upgrading, or if rebuilding, it is possible to use the current installed version without this switch, but that takes longer and uses more space.

CFG_DISABLE_CROSS_TESTS=1 ...: By default the tests will try to cover cross-builds for other architectures, but BLFS only installs rust for the host architecture. This switch also points to where cargo has been created, using a wildcard to match the one target-triple directory which has been created.

mv -v /usr/etc/bash_completion.d/cargo ...: Cargo accepts the sysconfdir switch but does not respect it. This fixes up the misplaced file.


Installed Program(s): cargo
Installed Librar(y,ies): None
Installed Director(y,ies): /usr/share/doc/cargo-0.17.0 and /usr/share/zsh/site-functions.

Short Descriptions


is the Package Manager for Rust.

最終更新日: 2017-08-16 03:49:48 +0900