Rustc-1.19.0

Introduction to Rust

The Rust programming language is designed to be a safe, concurrent, practical language.

As with many other programming languages, rustc (the rust compiler) needs a binary from which to bootstrap. It will download a stage0 binary, and several cargo files (these are actually .tar.gz source archives) at the start of the build, so you cannot compile it without an internet connection.

The current rustbuild build-system will use all available processors, although it does not scale well and often falls back to just using one core while waiting for a library to compile.

At the moment Rust does not provide any guarantees of a stable ABI.

This package is known to build and work properly using an LFS-8.1 platform.

Package Information

  • Download (HTTP): https://static.rust-lang.org/dist/rustc-1.19.0-src.tar.gz

  • Download MD5 sum: 75e779670ac79edf023497a9c37eb35d

  • Download size: 48 MB

  • Estimated disk space required: 4.2 GB (362 MB installed), (add 0.6GB for tests) plus 273MB for ~/.cargo files

  • Estimated build time: 33 SBU (add 14 SBU for tests, both with 4 processors)

Rust Dependencies

Required

cURL-7.57.0, CMake-3.10.1, Python-2.7.14

Optional

GDB-8.0.1 (used by debuginfo-gdb in the testsuite)

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/rust

Installation of Rust

[Note]

Note

This package is updated on a six-weekly release cycle. Because it is such a large and slow package to build, and is at the moment only used by one package in this book, the BLFS editors take the view that it should only be updated when that is necessary.

First create a suitable config.toml file which will configure the build :

cat <<EOF > config.toml
# see src/bootstrap/config.toml.example for more possible options
[llvm]
targets = "X86"

[build]
# install cargo as well as rust
extended = true

[install]
prefix = "/usr"
docdir = "share/doc/rustc-1.19.0"
channel = "stable"
EOF

Now install Rust by running the following commands:

./x.py build

To run the tests issue ./x.py test --verbose --no-fail-fast >../rustc-testlog: as with the build, that will use all available CPUs. This runs many suites of tests (in an apparently random order), three may fail: compile-fail/issue-37131.rs and run-make/target-without-atomics both try to compile for the thumbv6m-none-eabi target, but the BLFS build does not cater for that, and all 105 tests in debuginfo-gdb will fail if gdb has not been installed.

If you wish to look at the numbers for the results, you can find the total number of tests which were considered by running:

grep 'running .* tests' ../rustc-testlog | awk '{ sum += $2 } END { print sum }'

That should report 14029 tests. Similarly, the total tests which failed can be found by running:

grep '^test result:' ../rustc-testlog | awk  '{ sum += $6 } END { print sum }'

And similarly for the tests which passed use $4, for those which were ignored (i.e. skipped) use $8 (and $10 for 'measured', $12 for 'filtered out' but both are probably zero). The breakdown does not match the overall total.

Now, as the root user:

./x.py install

Command Explanations

targets = "X86": this avoids building all the available linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc).

extended = true: this installs Cargo alongside Rust.

channel = "stable": this ensures only stable features can be used, the default in config.toml is to use development features, which is not appropriate for a released version.

--verbose: this switch can sometimes provide more information about a test which fails.

--no-fail-fast: this switch ensures that the testsuite will not stop at the first error.

Contents

Installed Programs: cargo, rust-gdb, rust-lldb, rustc, rustdoc.
Installed Libraries: Many lib*<16-byte-hash>.so libraries.
Installed Directories: ~/.cargo, /usr/lib/rustlib, /usr/share/doc/rustc-1.19.0, and /usr/share/zsh/site-functions/

Short Descriptions

cargo

is the Package Manager for Rust.

rust-gdb

is a Python wrapper script for gdb.

rust-lldb

is a Python wrapper script for LLDB (the LLVM debugger).

rustc

is the rust compiler.

rustdoc

generates documentation from rust source code.

libstd-<16-byte-hash>.so

is the Rust Standard Library, the foundation of portable Rust software.

Last updated on 2017-10-15 13:23:25 -0500