[03d537cd] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[614fc25f] | 7 | <!ENTITY rust-download-http "https://static.rust-lang.org/dist/rustc-&rust-version;-src.tar.gz">
|
---|
[d9bcc5f] | 8 | <!ENTITY rust-download-ftp " ">
|
---|
[4c6edac] | 9 | <!ENTITY rust-md5sum "75e779670ac79edf023497a9c37eb35d">
|
---|
| 10 | <!ENTITY rust-size "48 MB">
|
---|
| 11 | <!ENTITY rust-buildsize "4.2 GB (362 MB installed), (add 0.6GB for tests) plus 273MB for ~/.cargo files">
|
---|
| 12 | <!ENTITY rust-time "33 SBU (add 14 SBU for tests, both with 4 processors)">
|
---|
[03d537cd] | 13 | ]>
|
---|
| 14 |
|
---|
| 15 | <sect1 id="rust" xreflabel="rustc-&rust-version;">
|
---|
| 16 | <?dbhtml filename="rust.html"?>
|
---|
| 17 |
|
---|
| 18 | <sect1info>
|
---|
| 19 | <othername>$LastChangedBy$</othername>
|
---|
| 20 | <date>$Date$</date>
|
---|
| 21 | </sect1info>
|
---|
| 22 |
|
---|
| 23 | <title>Rustc-&rust-version;</title>
|
---|
| 24 |
|
---|
| 25 | <indexterm zone="rust">
|
---|
| 26 | <primary sortas="a-rust">Rust</primary>
|
---|
| 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <sect2 role="package">
|
---|
| 30 | <title>Introduction to Rust</title>
|
---|
| 31 |
|
---|
| 32 | <para>
|
---|
| 33 | The <application>Rust</application> programming language is designed
|
---|
| 34 | to be a safe, concurrent, practical language.
|
---|
| 35 | </para>
|
---|
| 36 |
|
---|
| 37 | <para>
|
---|
| 38 | As with many other programming languages, rustc (the rust compiler)
|
---|
| 39 | needs a binary from which to bootstrap. It will download a stage0 binary,
|
---|
| 40 | and several cargo files (these are actually .tar.gz source archives) at
|
---|
| 41 | the start of the build, so you cannot compile it without an internet
|
---|
| 42 | connection.
|
---|
| 43 | </para>
|
---|
| 44 |
|
---|
| 45 | <para>
|
---|
| 46 | The current <application>rustbuild</application> build-system will use
|
---|
| 47 | all available processors, although it does not scale well and often falls
|
---|
| 48 | back to just using one core while waiting for a library to compile.
|
---|
| 49 | </para>
|
---|
| 50 |
|
---|
| 51 | <para>
|
---|
| 52 | At the moment <application>Rust</application> does not provide any
|
---|
[4c6edac] | 53 | guarantees of a stable ABI.
|
---|
[03d537cd] | 54 | </para>
|
---|
| 55 |
|
---|
[4c6edac] | 56 | &lfs81_checked;
|
---|
[03d537cd] | 57 |
|
---|
| 58 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 59 | <itemizedlist spacing="compact">
|
---|
| 60 | <listitem>
|
---|
| 61 | <para>
|
---|
| 62 | Download (HTTP): <ulink url="&rust-download-http;"/>
|
---|
| 63 | </para>
|
---|
| 64 | </listitem>
|
---|
| 65 | <listitem>
|
---|
| 66 | <para>
|
---|
| 67 | Download (FTP): <ulink url="&rust-download-ftp;"/>
|
---|
| 68 | </para>
|
---|
| 69 | </listitem>
|
---|
| 70 | <listitem>
|
---|
| 71 | <para>
|
---|
| 72 | Download MD5 sum: &rust-md5sum;
|
---|
| 73 | </para>
|
---|
| 74 | </listitem>
|
---|
| 75 | <listitem>
|
---|
| 76 | <para>
|
---|
| 77 | Download size: &rust-size;
|
---|
| 78 | </para>
|
---|
| 79 | </listitem>
|
---|
| 80 | <listitem>
|
---|
| 81 | <para>
|
---|
| 82 | Estimated disk space required: &rust-buildsize;
|
---|
| 83 | </para>
|
---|
| 84 | </listitem>
|
---|
| 85 | <listitem>
|
---|
| 86 | <para>
|
---|
| 87 | Estimated build time: &rust-time;
|
---|
| 88 | </para>
|
---|
| 89 | </listitem>
|
---|
| 90 | </itemizedlist>
|
---|
| 91 |
|
---|
| 92 | <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
|
---|
| 93 |
|
---|
| 94 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 95 | <para role="required">
|
---|
| 96 | <xref linkend="curl"/>,
|
---|
[4c6edac] | 97 | <xref linkend="cmake"/>,
|
---|
[03d537cd] | 98 | <xref linkend="python2"/>
|
---|
| 99 | </para>
|
---|
| 100 |
|
---|
| 101 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 102 | <para role="optional">
|
---|
[60ddbaf] | 103 | <xref linkend="gdb"/> (used by debuginfo-gdb in the testsuite)
|
---|
[03d537cd] | 104 | </para>
|
---|
| 105 |
|
---|
| 106 | <para condition="html" role="usernotes">
|
---|
| 107 | User Notes: <ulink url="&blfs-wiki;/rust"/>
|
---|
| 108 | </para>
|
---|
| 109 | </sect2>
|
---|
| 110 |
|
---|
| 111 | <sect2 role="installation">
|
---|
| 112 | <title>Installation of Rust</title>
|
---|
| 113 |
|
---|
[4c6edac] | 114 | <note>
|
---|
| 115 | <para>
|
---|
| 116 | This package is updated on a six-weekly release cycle. Because it is
|
---|
| 117 | such a large and slow package to build, and is at the moment only used
|
---|
| 118 | by one package in this book, the BLFS editors take the view that it
|
---|
| 119 | should only be updated when that is necessary.
|
---|
| 120 | </para>
|
---|
| 121 | </note>
|
---|
| 122 |
|
---|
[03d537cd] | 123 | <para>
|
---|
[4c6edac] | 124 | First create a suitable <filename>config.toml</filename> file
|
---|
| 125 | which will configure the build :
|
---|
| 126 | </para>
|
---|
| 127 |
|
---|
| 128 | <screen><userinput>cat <<EOF > config.toml
|
---|
| 129 | # see src/bootstrap/config.toml.example for more possible options
|
---|
| 130 | [llvm]
|
---|
| 131 | targets = "X86"
|
---|
| 132 |
|
---|
| 133 | [build]
|
---|
| 134 | # install cargo as well as rust
|
---|
| 135 | extended = true
|
---|
| 136 |
|
---|
| 137 | [install]
|
---|
| 138 | prefix = "/usr"
|
---|
| 139 | docdir = "share/doc/rustc-1.19.0"
|
---|
| 140 | channel = "stable"
|
---|
| 141 | EOF</userinput></screen>
|
---|
| 142 |
|
---|
| 143 | <para>
|
---|
| 144 | Now install <application>Rust</application> by running the following
|
---|
[03d537cd] | 145 | commands:
|
---|
| 146 | </para>
|
---|
| 147 |
|
---|
[4c6edac] | 148 | <screen><userinput>./x.py build</userinput></screen>
|
---|
[03d537cd] | 149 |
|
---|
| 150 | <para>
|
---|
[4c6edac] | 151 | To run the tests issue
|
---|
| 152 | <command>./x.py test --verbose --no-fail-fast >../rustc-testlog</command>:
|
---|
[9dc2505] | 153 | as with the build, that will use all available CPUs. This runs many suites
|
---|
[4c6edac] | 154 | of tests (in an apparently random order), three may fail:
|
---|
| 155 | compile-fail/issue-37131.rs and run-make/target-without-atomics both try to
|
---|
| 156 | compile for the thumbv6m-none-eabi target, but the BLFS build does not cater for
|
---|
| 157 | that, and all 105 tests in debuginfo-gdb will fail if
|
---|
| 158 | <application>gdb</application> has not been installed.
|
---|
[03d537cd] | 159 | </para>
|
---|
| 160 |
|
---|
| 161 | <para>
|
---|
[4c6edac] | 162 | If you wish to look at the numbers for the results, you can find the total
|
---|
| 163 | number of tests which were considered by running:
|
---|
[03d537cd] | 164 | </para>
|
---|
| 165 |
|
---|
[4c6edac] | 166 | <screen><command>grep 'running .* tests' ../rustc-testlog | awk '{ sum += $2 } END { print sum }'</command></screen>
|
---|
| 167 |
|
---|
[03d537cd] | 168 | <para>
|
---|
[4c6edac] | 169 | That should report 14029 tests. Similarly, the total tests which failed can
|
---|
| 170 | be found by running:
|
---|
[03d537cd] | 171 | </para>
|
---|
| 172 |
|
---|
[4c6edac] | 173 | <screen><command>grep '^test result:' ../rustc-testlog | awk '{ sum += $6 } END { print sum }'</command></screen>
|
---|
[03d537cd] | 174 |
|
---|
[4c6edac] | 175 | <para>
|
---|
| 176 | And similarly for the tests which passed use $4, for those which were ignored
|
---|
| 177 | (i.e. skipped) use $8 (and $10 for 'measured', $12 for 'filtered out' but both
|
---|
| 178 | are probably zero). The breakdown does not match the overall total.
|
---|
| 179 | </para>
|
---|
| 180 |
|
---|
| 181 | <para>
|
---|
| 182 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 183 | </para>
|
---|
| 184 |
|
---|
[f329c3e] | 185 | <screen role="root"><userinput>./x.py install</userinput></screen>
|
---|
[03d537cd] | 186 | </sect2>
|
---|
| 187 |
|
---|
| 188 | <sect2 role="commands">
|
---|
| 189 | <title>Command Explanations</title>
|
---|
| 190 |
|
---|
| 191 | <para>
|
---|
[4c6edac] | 192 | <command>targets = "X86"</command>: this avoids building all the available
|
---|
| 193 | linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc).
|
---|
[03d537cd] | 194 | </para>
|
---|
| 195 |
|
---|
| 196 | <para>
|
---|
[4c6edac] | 197 | <command>extended = true</command>: this installs Cargo alongside Rust.
|
---|
[03d537cd] | 198 | </para>
|
---|
| 199 |
|
---|
| 200 | <para>
|
---|
[4c6edac] | 201 | <command>channel = "stable"</command>: this ensures only stable features
|
---|
| 202 | can be used, the default in <filename>config.toml</filename> is to use
|
---|
| 203 | development features, which is not appropriate for a released version.
|
---|
[03d537cd] | 204 | </para>
|
---|
| 205 |
|
---|
| 206 | <para>
|
---|
[4c6edac] | 207 | <command>--verbose</command>: this switch can sometimes provide more
|
---|
| 208 | information about a test which fails.
|
---|
[03d537cd] | 209 | </para>
|
---|
[4c6edac] | 210 |
|
---|
| 211 | <para>
|
---|
| 212 | <command>--no-fail-fast</command>: this switch ensures that the testsuite
|
---|
| 213 | will not stop at the first error.
|
---|
| 214 | </para>
|
---|
| 215 |
|
---|
[03d537cd] | 216 | </sect2>
|
---|
| 217 |
|
---|
| 218 | <sect2 role="content">
|
---|
| 219 | <title>Contents</title>
|
---|
| 220 |
|
---|
| 221 | <segmentedlist>
|
---|
[78399edc] | 222 | <segtitle>Installed Programs</segtitle>
|
---|
| 223 | <segtitle>Installed Libraries</segtitle>
|
---|
| 224 | <segtitle>Installed Directories</segtitle>
|
---|
[03d537cd] | 225 |
|
---|
| 226 | <seglistitem>
|
---|
| 227 | <seg>
|
---|
[4c6edac] | 228 | cargo, rust-gdb, rust-lldb, rustc, rustdoc.
|
---|
[03d537cd] | 229 | </seg>
|
---|
| 230 | <seg>
|
---|
[4c6edac] | 231 | Many lib*<16-byte-hash>.so libraries.
|
---|
[03d537cd] | 232 | </seg>
|
---|
| 233 | <seg>
|
---|
| 234 | ~/.cargo,
|
---|
[4c6edac] | 235 | /usr/lib/rustlib,
|
---|
| 236 | /usr/share/doc/rustc-&rust-version;, and
|
---|
| 237 | /usr/share/zsh/site-functions/
|
---|
[03d537cd] | 238 | </seg>
|
---|
| 239 | </seglistitem>
|
---|
| 240 | </segmentedlist>
|
---|
| 241 |
|
---|
| 242 | <variablelist>
|
---|
| 243 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 244 | <?dbfo list-presentation="list"?>
|
---|
| 245 | <?dbhtml list-presentation="table"?>
|
---|
| 246 |
|
---|
[4c6edac] | 247 | <varlistentry id="cargo">
|
---|
| 248 | <term><command>cargo</command></term>
|
---|
| 249 | <listitem>
|
---|
| 250 | <para>
|
---|
| 251 | is the Package Manager for Rust.
|
---|
| 252 | </para>
|
---|
| 253 | <indexterm zone="rust cargo">
|
---|
| 254 | <primary sortas="b-cargo">cargo</primary>
|
---|
| 255 | </indexterm>
|
---|
| 256 | </listitem>
|
---|
| 257 | </varlistentry>
|
---|
| 258 |
|
---|
[03d537cd] | 259 | <varlistentry id="rust-gdb">
|
---|
| 260 | <term><command>rust-gdb</command></term>
|
---|
| 261 | <listitem>
|
---|
| 262 | <para>
|
---|
| 263 | is a Python wrapper script for gdb.
|
---|
| 264 | </para>
|
---|
| 265 | <indexterm zone="rust rust-gdb">
|
---|
| 266 | <primary sortas="b-rust-gdb">rust-gdb</primary>
|
---|
| 267 | </indexterm>
|
---|
| 268 | </listitem>
|
---|
| 269 | </varlistentry>
|
---|
| 270 |
|
---|
| 271 | <varlistentry id="rust-lldb">
|
---|
| 272 | <term><command>rust-lldb</command></term>
|
---|
| 273 | <listitem>
|
---|
| 274 | <para>
|
---|
| 275 | is a Python wrapper script for LLDB (the LLVM debugger).
|
---|
| 276 | </para>
|
---|
| 277 | <indexterm zone="rust rust-lldb">
|
---|
| 278 | <primary sortas="b-rust-lldb">rust=lldb</primary>
|
---|
| 279 | </indexterm>
|
---|
| 280 | </listitem>
|
---|
| 281 | </varlistentry>
|
---|
| 282 |
|
---|
| 283 | <varlistentry id="rustc">
|
---|
| 284 | <term><command>rustc</command></term>
|
---|
| 285 | <listitem>
|
---|
| 286 | <para>
|
---|
| 287 | is the rust compiler.
|
---|
| 288 | </para>
|
---|
| 289 | <indexterm zone="rust rustc">
|
---|
| 290 | <primary sortas="b-rustc">rustc</primary>
|
---|
| 291 | </indexterm>
|
---|
| 292 | </listitem>
|
---|
| 293 | </varlistentry>
|
---|
| 294 |
|
---|
| 295 | <varlistentry id="rustdoc">
|
---|
| 296 | <term><command>rustdoc</command></term>
|
---|
| 297 | <listitem>
|
---|
| 298 | <para>
|
---|
| 299 | generates documentation from rust source code.
|
---|
| 300 | </para>
|
---|
| 301 | <indexterm zone="rust rustdoc">
|
---|
| 302 | <primary sortas="b-rustdoc">rustdoc</primary>
|
---|
| 303 | </indexterm>
|
---|
| 304 | </listitem>
|
---|
| 305 | </varlistentry>
|
---|
| 306 |
|
---|
| 307 | <varlistentry id="libstd">
|
---|
| 308 | <term><filename class="libraryfile">libstd-<16-byte-hash>.so</filename></term>
|
---|
| 309 | <listitem>
|
---|
| 310 | <para>
|
---|
| 311 | is the Rust Standard Library, the foundation of portable Rust software.
|
---|
| 312 | </para>
|
---|
| 313 | <indexterm zone="rust libstd">
|
---|
| 314 | <primary sortas="c-libstd">libstd-<16-byte-hash>.so</primary>
|
---|
| 315 | </indexterm>
|
---|
| 316 | </listitem>
|
---|
| 317 | </varlistentry>
|
---|
| 318 | </variablelist>
|
---|
| 319 | </sect2>
|
---|
| 320 | </sect1>
|
---|