%general-entities; ]> Rustc &rustc-version;
&rustc-url;
Rustc-&rustc-version; Rustc tools <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-tmp-sbu;</seg> <seg>&rustc-tmp-du;</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Rustc Tell Rustc how to support $LFS_TGT triplet: cp -v compiler/rustc_target/src/spec/x86_64_{unknown,lfs}_linux_gnu.rs cp -v compiler/rustc_target/src/spec/i686_{unknown,lfs}_linux_gnu.rs cp -v compiler/rustc_target/src/spec/i586_{unknown,lfs}_linux_gnu.rs sed -i.orig compiler/rustc_target/src/spec/mod.rs \ -e '/targets!/a\ ("x86_64-lfs-linux-gnu", x86_64_lfs_linux_gnu),' \ -e '/targets!/a\ ("i686-lfs-linux-gnu", i686_lfs_linux_gnu),' \ -e '/targets!/a\ ("i586-lfs-linux-gnu", i586_lfs_linux_gnu),' In the first pass, build Rustc as a cross compiler for $LFS_TGT. Create a suitable configuration: install -vm755 src/llvm-project/llvm/cmake/config.guess config.guess cat > pass1.toml << EOF [llvm] link-shared = true [build] # omit docs to save time and space (default is to build them) docs = false # install cargo as well as rustc, but skip other tools as they are # not necessary for temporary installation extended = true tools = ["cargo"] # don't download crates during build locked-deps = true vendor = true # build both the native compiler and the cross compiler # native compiler is necessary because Rust heavily uses meta-programming target = [ "$(./config.guess)", "$LFS_TGT" ] [rust] channel = "stable" # LFS does not install the FileCheck executable from llvm, # so disable codegen tests codegen-tests = false [target.$(./config.guess)] # link Rustc to LLVM pass 1 llvm-config = "$LFS/tools/bin/llvm-config" [target.$LFS_TGT] cc = "$LFS/tools/bin/$LFS_TGT-gcc" cxx = "$LFS/tools/bin/$LFS_TGT-g++" ar = "$LFS/tools/bin/$LFS_TGT-ar" ranlib = "$LFS/tools/bin/$LFS_TGT-ranlib" # not ld: on Linux platforms Rustc uses GCC driver for linking linker = "$LFS/tools/bin/$LFS_TGT-gcc" EOF Build the cross compiler and target libraries: python3 x.py build --stage 1 library --config pass1.toml In the second pass, build Rustc as a native compiler on $LFS_TGT: cat > pass2.toml << EOF [llvm] link-shared = true [build] docs = false extended = true tools = ["cargo"] locked-deps = true vendor = true # build the native compiler for this triplet host = [ "$LFS_TGT" ] [install] prefix = "/opt/rustc-&rustc-version;" docdir = "share/doc/rustc-&rustc-version;" [rust] channel = "stable" rpath = false # BLFS does not install the FileCheck executable from llvm, # so disable codegen tests codegen-tests = false [target.$(./config.guess)] llvm-config = "$LFS/tools/bin/llvm-config" [target.$LFS_TGT] cc = "$LFS/tools/bin/$LFS_TGT-gcc" cxx = "$LFS/tools/bin/$LFS_TGT-g++" ar = "$LFS/tools/bin/$LFS_TGT-ar" ranlib = "$LFS/tools/bin/$LFS_TGT-ranlib" linker = "$LFS/tools/bin/$LFS_TGT-gcc" # link Rustc to LLVM pass 2 llvm-config = "$LFS/tools/$LFS_TGT/bin/llvm-config" EOF Build the native compiler: env {X86_64,I{5,6}86}_LFS_LINUX_GNU_OPENSSL_DIR=$LFS/usr \ python3 x.py build --keep-stage 0 \ --keep-stage-std 1 \ --stage 2 \ --config pass2.toml Install the package: env {X86_64,I{5,6}86}_LFS_LINUX_GNU_OPENSSL_DIR=$LFS/usr \ DESTDIR=$LFS \ python3 x.py install --keep-stage 0 \ --keep-stage-std 1 \ --stage 2 \ --config pass2.toml ln -sv rustc-&rustc-version; $LFS/opt/rustc <para>Details on this package are located in <xref linkend="contents-rustc" role="."/></para> </sect2> </sect1>