[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">
|
---|
[4c6edac] | 103 | <xref linkend="gdb"/> (used by debuginfo-gdb in the testsuite),
|
---|
[03d537cd] | 104 | <xref linkend="ninja"/>
|
---|
| 105 | </para>
|
---|
| 106 |
|
---|
| 107 | <para condition="html" role="usernotes">
|
---|
| 108 | User Notes: <ulink url="&blfs-wiki;/rust"/>
|
---|
| 109 | </para>
|
---|
| 110 | </sect2>
|
---|
| 111 |
|
---|
| 112 | <sect2 role="installation">
|
---|
| 113 | <title>Installation of Rust</title>
|
---|
| 114 |
|
---|
[4c6edac] | 115 | <note>
|
---|
| 116 | <para>
|
---|
| 117 | This package is updated on a six-weekly release cycle. Because it is
|
---|
| 118 | such a large and slow package to build, and is at the moment only used
|
---|
| 119 | by one package in this book, the BLFS editors take the view that it
|
---|
| 120 | should only be updated when that is necessary.
|
---|
| 121 | </para>
|
---|
| 122 | </note>
|
---|
| 123 |
|
---|
[03d537cd] | 124 | <para>
|
---|
[4c6edac] | 125 | First create a suitable <filename>config.toml</filename> file
|
---|
| 126 | which will configure the build :
|
---|
| 127 | </para>
|
---|
| 128 |
|
---|
| 129 | <screen><userinput>cat <<EOF > config.toml
|
---|
| 130 | # see src/bootstrap/config.toml.example for more possible options
|
---|
| 131 | [llvm]
|
---|
| 132 | targets = "X86"
|
---|
| 133 |
|
---|
| 134 | [build]
|
---|
| 135 | # install cargo as well as rust
|
---|
| 136 | extended = true
|
---|
| 137 |
|
---|
| 138 | [install]
|
---|
| 139 | prefix = "/usr"
|
---|
| 140 | docdir = "share/doc/rustc-1.19.0"
|
---|
| 141 | channel = "stable"
|
---|
| 142 | EOF</userinput></screen>
|
---|
| 143 |
|
---|
| 144 | <para>
|
---|
| 145 | Now install <application>Rust</application> by running the following
|
---|
[03d537cd] | 146 | commands:
|
---|
| 147 | </para>
|
---|
| 148 |
|
---|
[4c6edac] | 149 | <screen><userinput>./x.py build</userinput></screen>
|
---|
[03d537cd] | 150 |
|
---|
| 151 | <para>
|
---|
[4c6edac] | 152 | To run the tests issue
|
---|
| 153 | <command>./x.py test --verbose --no-fail-fast >../rustc-testlog</command>:
|
---|
[9dc2505] | 154 | as with the build, that will use all available CPUs. This runs many suites
|
---|
[4c6edac] | 155 | of tests (in an apparently random order), three may fail:
|
---|
| 156 | compile-fail/issue-37131.rs and run-make/target-without-atomics both try to
|
---|
| 157 | compile for the thumbv6m-none-eabi target, but the BLFS build does not cater for
|
---|
| 158 | that, and all 105 tests in debuginfo-gdb will fail if
|
---|
| 159 | <application>gdb</application> has not been installed.
|
---|
[03d537cd] | 160 | </para>
|
---|
| 161 |
|
---|
| 162 | <para>
|
---|
[4c6edac] | 163 | If you wish to look at the numbers for the results, you can find the total
|
---|
| 164 | number of tests which were considered by running:
|
---|
[03d537cd] | 165 | </para>
|
---|
| 166 |
|
---|
[4c6edac] | 167 | <screen><command>grep 'running .* tests' ../rustc-testlog | awk '{ sum += $2 } END { print sum }'</command></screen>
|
---|
| 168 |
|
---|
[03d537cd] | 169 | <para>
|
---|
[4c6edac] | 170 | That should report 14029 tests. Similarly, the total tests which failed can
|
---|
| 171 | be found by running:
|
---|
[03d537cd] | 172 | </para>
|
---|
| 173 |
|
---|
[4c6edac] | 174 | <screen><command>grep '^test result:' ../rustc-testlog | awk '{ sum += $6 } END { print sum }'</command></screen>
|
---|
[03d537cd] | 175 |
|
---|
[4c6edac] | 176 | <para>
|
---|
| 177 | And similarly for the tests which passed use $4, for those which were ignored
|
---|
| 178 | (i.e. skipped) use $8 (and $10 for 'measured', $12 for 'filtered out' but both
|
---|
| 179 | are probably zero). The breakdown does not match the overall total.
|
---|
| 180 | </para>
|
---|
| 181 |
|
---|
| 182 | <para>
|
---|
| 183 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 184 | </para>
|
---|
| 185 |
|
---|
[f329c3e] | 186 | <screen role="root"><userinput>./x.py install</userinput></screen>
|
---|
[03d537cd] | 187 | </sect2>
|
---|
| 188 |
|
---|
| 189 | <sect2 role="commands">
|
---|
| 190 | <title>Command Explanations</title>
|
---|
| 191 |
|
---|
| 192 | <para>
|
---|
[4c6edac] | 193 | <command>targets = "X86"</command>: this avoids building all the available
|
---|
| 194 | linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc).
|
---|
[03d537cd] | 195 | </para>
|
---|
| 196 |
|
---|
| 197 | <para>
|
---|
[4c6edac] | 198 | <command>extended = true</command>: this installs Cargo alongside Rust.
|
---|
[03d537cd] | 199 | </para>
|
---|
| 200 |
|
---|
| 201 | <para>
|
---|
[4c6edac] | 202 | <command>channel = "stable"</command>: this ensures only stable features
|
---|
| 203 | can be used, the default in <filename>config.toml</filename> is to use
|
---|
| 204 | development features, which is not appropriate for a released version.
|
---|
[03d537cd] | 205 | </para>
|
---|
| 206 |
|
---|
| 207 | <para>
|
---|
[4c6edac] | 208 | <command>--verbose</command>: this switch can sometimes provide more
|
---|
| 209 | information about a test which fails.
|
---|
[03d537cd] | 210 | </para>
|
---|
[4c6edac] | 211 |
|
---|
| 212 | <para>
|
---|
| 213 | <command>--no-fail-fast</command>: this switch ensures that the testsuite
|
---|
| 214 | will not stop at the first error.
|
---|
| 215 | </para>
|
---|
| 216 |
|
---|
[03d537cd] | 217 | </sect2>
|
---|
| 218 |
|
---|
| 219 | <sect2 role="content">
|
---|
| 220 | <title>Contents</title>
|
---|
| 221 |
|
---|
| 222 | <segmentedlist>
|
---|
[78399edc] | 223 | <segtitle>Installed Programs</segtitle>
|
---|
| 224 | <segtitle>Installed Libraries</segtitle>
|
---|
| 225 | <segtitle>Installed Directories</segtitle>
|
---|
[03d537cd] | 226 |
|
---|
| 227 | <seglistitem>
|
---|
| 228 | <seg>
|
---|
[4c6edac] | 229 | cargo, rust-gdb, rust-lldb, rustc, rustdoc.
|
---|
[03d537cd] | 230 | </seg>
|
---|
| 231 | <seg>
|
---|
[4c6edac] | 232 | Many lib*<16-byte-hash>.so libraries.
|
---|
[03d537cd] | 233 | </seg>
|
---|
| 234 | <seg>
|
---|
| 235 | ~/.cargo,
|
---|
[4c6edac] | 236 | /usr/lib/rustlib,
|
---|
| 237 | /usr/share/doc/rustc-&rust-version;, and
|
---|
| 238 | /usr/share/zsh/site-functions/
|
---|
[03d537cd] | 239 | </seg>
|
---|
| 240 | </seglistitem>
|
---|
| 241 | </segmentedlist>
|
---|
| 242 |
|
---|
| 243 | <variablelist>
|
---|
| 244 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 245 | <?dbfo list-presentation="list"?>
|
---|
| 246 | <?dbhtml list-presentation="table"?>
|
---|
| 247 |
|
---|
[4c6edac] | 248 | <varlistentry id="cargo">
|
---|
| 249 | <term><command>cargo</command></term>
|
---|
| 250 | <listitem>
|
---|
| 251 | <para>
|
---|
| 252 | is the Package Manager for Rust.
|
---|
| 253 | </para>
|
---|
| 254 | <indexterm zone="rust cargo">
|
---|
| 255 | <primary sortas="b-cargo">cargo</primary>
|
---|
| 256 | </indexterm>
|
---|
| 257 | </listitem>
|
---|
| 258 | </varlistentry>
|
---|
| 259 |
|
---|
[03d537cd] | 260 | <varlistentry id="rust-gdb">
|
---|
| 261 | <term><command>rust-gdb</command></term>
|
---|
| 262 | <listitem>
|
---|
| 263 | <para>
|
---|
| 264 | is a Python wrapper script for gdb.
|
---|
| 265 | </para>
|
---|
| 266 | <indexterm zone="rust rust-gdb">
|
---|
| 267 | <primary sortas="b-rust-gdb">rust-gdb</primary>
|
---|
| 268 | </indexterm>
|
---|
| 269 | </listitem>
|
---|
| 270 | </varlistentry>
|
---|
| 271 |
|
---|
| 272 | <varlistentry id="rust-lldb">
|
---|
| 273 | <term><command>rust-lldb</command></term>
|
---|
| 274 | <listitem>
|
---|
| 275 | <para>
|
---|
| 276 | is a Python wrapper script for LLDB (the LLVM debugger).
|
---|
| 277 | </para>
|
---|
| 278 | <indexterm zone="rust rust-lldb">
|
---|
| 279 | <primary sortas="b-rust-lldb">rust=lldb</primary>
|
---|
| 280 | </indexterm>
|
---|
| 281 | </listitem>
|
---|
| 282 | </varlistentry>
|
---|
| 283 |
|
---|
| 284 | <varlistentry id="rustc">
|
---|
| 285 | <term><command>rustc</command></term>
|
---|
| 286 | <listitem>
|
---|
| 287 | <para>
|
---|
| 288 | is the rust compiler.
|
---|
| 289 | </para>
|
---|
| 290 | <indexterm zone="rust rustc">
|
---|
| 291 | <primary sortas="b-rustc">rustc</primary>
|
---|
| 292 | </indexterm>
|
---|
| 293 | </listitem>
|
---|
| 294 | </varlistentry>
|
---|
| 295 |
|
---|
| 296 | <varlistentry id="rustdoc">
|
---|
| 297 | <term><command>rustdoc</command></term>
|
---|
| 298 | <listitem>
|
---|
| 299 | <para>
|
---|
| 300 | generates documentation from rust source code.
|
---|
| 301 | </para>
|
---|
| 302 | <indexterm zone="rust rustdoc">
|
---|
| 303 | <primary sortas="b-rustdoc">rustdoc</primary>
|
---|
| 304 | </indexterm>
|
---|
| 305 | </listitem>
|
---|
| 306 | </varlistentry>
|
---|
| 307 |
|
---|
| 308 | <varlistentry id="libstd">
|
---|
| 309 | <term><filename class="libraryfile">libstd-<16-byte-hash>.so</filename></term>
|
---|
| 310 | <listitem>
|
---|
| 311 | <para>
|
---|
| 312 | is the Rust Standard Library, the foundation of portable Rust software.
|
---|
| 313 | </para>
|
---|
| 314 | <indexterm zone="rust libstd">
|
---|
| 315 | <primary sortas="c-libstd">libstd-<16-byte-hash>.so</primary>
|
---|
| 316 | </indexterm>
|
---|
| 317 | </listitem>
|
---|
| 318 | </varlistentry>
|
---|
| 319 | </variablelist>
|
---|
| 320 | </sect2>
|
---|
| 321 | </sect1>
|
---|