%general-entities; ]> Rustc &rustc-version;
&rustc-url;
Rustc-&rustc-version; Rustc <para>The Rust programming language is designed to be a safe, concurrent, practical language.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> <seg>&rustc-final-sbu;</seg> <seg>&rustc-final-du;</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Rustc We will build Rustc as a native compiler for the canonical triplet. But the building process still refers to the host triplet of the temporary Rustc installed in &ch-tmp-cross;. So we need to tell Rustc how to support the LFS-specific triplet again. However this time we don't want to hard code the LFS-specific triplet in the final Rustc, so create a JSON file to describe the target instead of modifying the source code: mkdir target RUSTC_BOOTSTRAP=1 rustc -Z unstable-options \ --print target-spec-json \ > target/$(uname -m)-lfs-linux-gnu.json sed '/is-builtin/d' -i target/$(uname -m)-lfs-linux-gnu.json Create a suitable config.toml file for building Rustc for the final LFS system: cat > config.toml << EOF [llvm] link-shared = true [build] docs = false locked-deps = true vendor = true # install cargo, clippy, etc. as well as rustc extended = true # build the native compiler for this triplet host = [ "$(uname -m)-unknown-linux-gnu" ] # use temporary Rustc as the bootstrapping compiler cargo = "/opt/rustc/bin/cargo" rustc = "/opt/rustc/bin/rustc" [install] prefix = "/opt/rustc-&rustc-version;" docdir = "share/doc/rustc-&rustc-version;" [rust] channel = "stable" rpath = false codegen-tests = false [target.$(uname -m)-lfs-linux-gnu] # during bootstrap the native compiler for host is rebuilt # so we need to specify this again llvm-config = "/usr/bin/llvm-config" [target.$(uname -m)-unknown-linux-gnu] cc = "gcc" cxx = "g++" ar = "ar" ranlib = "ranlib" linker = "gcc" llvm-config = "/usr/bin/llvm-config" EOF Compile Rustc by running: RUST_TARGET_PATH=$PWD/target \ PKG_CONFIG_ALLOW_CROSS=1 \ python3 x.py build --stage 2 Install the package: RUST_TARGET_PATH=$PWD/target \ PKG_CONFIG_ALLOW_CROSS=1 \ DESTDIR=$PWD/dest \ python3 x.py install --stage 2 mv -v /opt/rustc-&rustc-version;{,.old} cp -av dest/* / ldconfig Perform a sanity check: echo 'fn main() { println!("hello"); }' > hello.rs rustc --target=$(uname -m)-unknown-linux-gnu hello.rs ./hello There should be no error messages, and the output should be hello. Once the sanity check passed, remove the temporary Rustc installation: rm -rf /opt/rustc-&rustc-version;.old Contents of Rustc Installed Programs Installed Libraries Installed Directories cargo-clippy, cargo-fmt, cargo, clippy-driver, rls, rust-analyzer, rust-demangler, rust-gdb, rust-gdbgui, rust-lldb, rustc, rustdoc, and rustfmt librustc-driver-<16-byte-hash>.so, libstd-<16-byte-hash>.so, and libtest-<16-byte-hash>.so ~/.cargo, /opt/rustc, symbolic link to /opt/rustc-&rustc-version; Short Descriptions cargo-clippy provides lint checks for a cargo package cargo-clippy cargo-fmt formats all bin and lib files of the current crate using rustfmt cargo-fmt cargo is the Package Manager for Rust cargo clippy-driver provides lint checks for Rust clippy-driver rls is the Rust Language Server. This can run in the background to provide IDEs, editors, and other tools with information about Rust programs rls rust-analyzer is an implementation of Language Server Protocol for the Rust programming language. rust-analyzer rust-demangler converts a list of Rust mangled symbols into a corresponding list of demangled symbols rust-demangler rust-gdb is a wrapper script for gdb, pulling in Python pretty-printing modules installed in /opt/rustc-&rustc-version;/lib/rustlib/etc rust-gdb rust-gdbgui is a wrapper script for a graphical front end to gdb that runs in a browser rust-gdbgui rust-lldb is a wrapper script for LLDB (the LLVM debugger) pulling in the Python pretty-printing modules rust=lldb rustc is the rust compiler rustc rustdoc generates documentation from rust source code rustdoc rustfmt formats rust code rustfmt libstd-<16-byte-hash>.so is the Rust Standard Library, the foundation of portable Rust software libstd-<16-byte-hash>.so