[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 " ">
|
---|
[4f9e45d9] | 9 | <!ENTITY rust-md5sum "f43af67a139ce21ff5f530bbd2f486aa">
|
---|
| 10 | <!ENTITY rust-size "145 MB">
|
---|
[25997c4a] | 11 | <!-- Gentle Reminder: buildsize is how much the user requires for the real
|
---|
| 12 | install, i.e. the source with its DESTDIR *plus* the DESTDIR. You
|
---|
| 13 | can 'mkdir /tmp/RUST ; cp -a install/* /tmp/RUST' and then run 'du -sch'
|
---|
| 14 | to measure it. -->
|
---|
| 15 |
|
---|
[4f9e45d9] | 16 | <!ENTITY rust-buildsize "5.6 GB (423 MB installed) including 407MB of ~/.cargo files for the user building this. Add 1.8 GB if running the tests">
|
---|
| 17 | <!ENTITY rust-time "24 SBU (add 15 SBU for tests, both with 4 processors)">
|
---|
[03d537cd] | 18 | ]>
|
---|
| 19 |
|
---|
| 20 | <sect1 id="rust" xreflabel="rustc-&rust-version;">
|
---|
| 21 | <?dbhtml filename="rust.html"?>
|
---|
| 22 |
|
---|
| 23 | <sect1info>
|
---|
| 24 | <othername>$LastChangedBy$</othername>
|
---|
| 25 | <date>$Date$</date>
|
---|
| 26 | </sect1info>
|
---|
| 27 |
|
---|
| 28 | <title>Rustc-&rust-version;</title>
|
---|
| 29 |
|
---|
| 30 | <indexterm zone="rust">
|
---|
| 31 | <primary sortas="a-rust">Rust</primary>
|
---|
| 32 | </indexterm>
|
---|
| 33 |
|
---|
| 34 | <sect2 role="package">
|
---|
| 35 | <title>Introduction to Rust</title>
|
---|
| 36 |
|
---|
| 37 | <para>
|
---|
| 38 | The <application>Rust</application> programming language is designed
|
---|
| 39 | to be a safe, concurrent, practical language.
|
---|
| 40 | </para>
|
---|
| 41 |
|
---|
[25997c4a] | 42 | <para>
|
---|
| 43 | This package is updated on a six-weekly release cycle. Because it is
|
---|
| 44 | such a large and slow package to build, and is at the moment only required
|
---|
[80720f4a] | 45 | by a few packages in this book, the BLFS editors take the view that it
|
---|
[25997c4a] | 46 | should only be updated when that is necessary (either to fix problems,
|
---|
| 47 | or to allow a new version of <application>firefox</application> to build).
|
---|
| 48 | </para>
|
---|
| 49 |
|
---|
[03d537cd] | 50 | <para>
|
---|
| 51 | As with many other programming languages, rustc (the rust compiler)
|
---|
[a7b1bddc] | 52 | needs a binary from which to bootstrap. It will download a stage0 binary
|
---|
| 53 | and many cargo crates (these are actually .tar.gz source archives) at
|
---|
[03d537cd] | 54 | the start of the build, so you cannot compile it without an internet
|
---|
| 55 | connection.
|
---|
| 56 | </para>
|
---|
| 57 |
|
---|
[25997c4a] | 58 | <para>
|
---|
| 59 | These crates will then remain in various forms (cache, directories of
|
---|
| 60 | extracted source), in <filename class="directory">~/.cargo</filename> for
|
---|
| 61 | ever more. It is common for large <application>rust</application> packages
|
---|
| 62 | to use multiple versions of some crates. If you purge the files before
|
---|
| 63 | updating this package, very few crates will need to be updated by the
|
---|
| 64 | packages in this book which use it (and they will be downloaded as
|
---|
| 65 | required). But if you retain an older version as a fallback option and
|
---|
[b05ea0b] | 66 | then use it (when <emphasis>not</emphasis> building in
|
---|
[25997c4a] | 67 | <filename class="directory">/usr</filename>), it is likely that it will
|
---|
[b05ea0b] | 68 | then have to re-download some crates. For a full download (i.e. starting
|
---|
[25997c4a] | 69 | with an empty or missing <filename class="directory">~/.cargo</filename>)
|
---|
| 70 | downloading the external cargo files for this version only takes a minute
|
---|
| 71 | or so on a fast network.
|
---|
| 72 | </para>
|
---|
| 73 |
|
---|
| 74 | <note>
|
---|
| 75 | <para>
|
---|
[d396c65] | 76 | Although BLFS usually installs in <filename
|
---|
| 77 | class="directory">/usr</filename>, when you later upgrade to a newer
|
---|
| 78 | version of <application>rust</application> the old libraries in <filename
|
---|
| 79 | class="directory">/usr/lib/rustlib</filename> will remain, with various
|
---|
| 80 | hashes in their names, but will not be usable and will waste space. The
|
---|
| 81 | editors recommend placing the files in the <filename
|
---|
| 82 | class="directory">/opt</filename> directory. In particular, if you
|
---|
| 83 | have reason to rebuild with a modified configuration (e.g. using the
|
---|
| 84 | shipped LLVM after building with shared LLVM, but perhaps also the
|
---|
| 85 | reverse situation) it it possible for the install to leave a broken
|
---|
| 86 | <command>cargo</command> program. In such a situation, either remove
|
---|
| 87 | the existing installation first, or use a different prefix such as
|
---|
| 88 | /opt/rustc-&rust-version;-build2.
|
---|
[25997c4a] | 89 | </para>
|
---|
[b05ea0b] | 90 |
|
---|
| 91 | <para>
|
---|
[d396c65] | 92 | If you prefer, you can of course change the prefix to <filename
|
---|
| 93 | class="directory">/usr</filename> and omit the
|
---|
| 94 | <command>ldconfig</command> and the actions to add rustc to the PATH.
|
---|
[b05ea0b] | 95 | </para>
|
---|
[25997c4a] | 96 | </note>
|
---|
| 97 |
|
---|
[03d537cd] | 98 | <para>
|
---|
| 99 | The current <application>rustbuild</application> build-system will use
|
---|
| 100 | all available processors, although it does not scale well and often falls
|
---|
| 101 | back to just using one core while waiting for a library to compile.
|
---|
| 102 | </para>
|
---|
| 103 |
|
---|
| 104 | <para>
|
---|
| 105 | At the moment <application>Rust</application> does not provide any
|
---|
[4c6edac] | 106 | guarantees of a stable ABI.
|
---|
[03d537cd] | 107 | </para>
|
---|
| 108 |
|
---|
[326f830] | 109 | <note>
|
---|
[7d259126] | 110 | <para>
|
---|
| 111 | Rustc defaults to building for ALL supported architectures, using a
|
---|
[4f8ca94] | 112 | shipped copy of LLVM. In BLFS the build is only for the X86
|
---|
| 113 | architecture. Rustc still claims to require Python 2, but that is only
|
---|
| 114 | really necessary when building some other architectures with the
|
---|
| 115 | shipped LLVM.
|
---|
[d396c65] | 116 | If you intend to develop rust crates, this build may not be good
|
---|
[b05ea0b] | 117 | enough for your purposes.
|
---|
[7d259126] | 118 | </para>
|
---|
[326f830] | 119 | <para>
|
---|
[4f9e45d9] | 120 | The build times of this version when repeated on the same machine are
|
---|
| 121 | often reasonably consistent, but as with all compilations using
|
---|
| 122 | <command>rustc</command> there can be some very slow outliers.
|
---|
[326f830] | 123 | </para>
|
---|
| 124 | <para>
|
---|
[bb0652ca] | 125 | Unusually, a DESTDIR-style method is being used to install this package.
|
---|
| 126 | This is because running the install as root not only downloads all of the
|
---|
[a7b1bddc] | 127 | cargo files again (to <filename>/root/.cargo</filename>), it then spends
|
---|
[7d259126] | 128 | a very long time recompiling. Using this method saves a lot of time, at
|
---|
| 129 | the cost of extra disk space.
|
---|
[326f830] | 130 | </para>
|
---|
| 131 | </note>
|
---|
| 132 |
|
---|
[ad112fd5] | 133 | &lfs90_checked;
|
---|
[03d537cd] | 134 |
|
---|
| 135 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 136 | <itemizedlist spacing="compact">
|
---|
| 137 | <listitem>
|
---|
| 138 | <para>
|
---|
| 139 | Download (HTTP): <ulink url="&rust-download-http;"/>
|
---|
| 140 | </para>
|
---|
| 141 | </listitem>
|
---|
| 142 | <listitem>
|
---|
| 143 | <para>
|
---|
| 144 | Download (FTP): <ulink url="&rust-download-ftp;"/>
|
---|
| 145 | </para>
|
---|
| 146 | </listitem>
|
---|
| 147 | <listitem>
|
---|
| 148 | <para>
|
---|
| 149 | Download MD5 sum: &rust-md5sum;
|
---|
| 150 | </para>
|
---|
| 151 | </listitem>
|
---|
| 152 | <listitem>
|
---|
| 153 | <para>
|
---|
| 154 | Download size: &rust-size;
|
---|
| 155 | </para>
|
---|
| 156 | </listitem>
|
---|
| 157 | <listitem>
|
---|
| 158 | <para>
|
---|
| 159 | Estimated disk space required: &rust-buildsize;
|
---|
| 160 | </para>
|
---|
| 161 | </listitem>
|
---|
| 162 | <listitem>
|
---|
| 163 | <para>
|
---|
| 164 | Estimated build time: &rust-time;
|
---|
| 165 | </para>
|
---|
| 166 | </listitem>
|
---|
| 167 | </itemizedlist>
|
---|
| 168 |
|
---|
| 169 | <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
|
---|
| 170 |
|
---|
| 171 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 172 | <para role="required">
|
---|
| 173 | <xref linkend="curl"/>,
|
---|
[4f8ca94] | 174 | <xref linkend="cmake"/>, and
|
---|
| 175 | <xref linkend="libssh2"/>
|
---|
[03d537cd] | 176 | </para>
|
---|
| 177 |
|
---|
[a7b1bddc] | 178 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 179 | <para role="recommended">
|
---|
| 180 | <package>clang</package> from <xref linkend="llvm"/>
|
---|
[4f9e45d9] | 181 | (built with -DLLVM_LINK_LLVM_DYLIB=ON so that rust can link to
|
---|
[741231d] | 182 | system LLVM instead of building its shipped version)
|
---|
[4f9e45d9] | 183 | </para>
|
---|
[a7b1bddc] | 184 |
|
---|
[03d537cd] | 185 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 186 | <para role="optional">
|
---|
[4f8ca94] | 187 | <xref linkend="gdb"/> (used by the testsuite if it is present) and
|
---|
[4f9e45d9] | 188 | <xref linkend="python2"/> (used by the testsuite)
|
---|
[03d537cd] | 189 | </para>
|
---|
| 190 |
|
---|
| 191 | <para condition="html" role="usernotes">
|
---|
| 192 | User Notes: <ulink url="&blfs-wiki;/rust"/>
|
---|
| 193 | </para>
|
---|
| 194 | </sect2>
|
---|
| 195 |
|
---|
| 196 | <sect2 role="installation">
|
---|
| 197 | <title>Installation of Rust</title>
|
---|
| 198 |
|
---|
| 199 | <para>
|
---|
[d396c65] | 200 | To install into the
|
---|
| 201 | <filename class="directory">/opt</filename> directory, remove the symlink
|
---|
| 202 | and create a new directory (i.e. with a different name if trying a
|
---|
| 203 | modified build).
|
---|
[4f9e45d9] | 204 | As the <systemitem class="username">root</systemitem>
|
---|
[b05ea0b] | 205 | user:
|
---|
| 206 | </para>
|
---|
| 207 |
|
---|
[d396c65] | 208 | <screen role="root"><userinput>mkdir /opt/rustc-&rust-version; &&
|
---|
| 209 | ln -svfin rustc-&rust-version; /opt/rustc</userinput></screen>
|
---|
[b05ea0b] | 210 |
|
---|
| 211 | <note>
|
---|
| 212 | <para>
|
---|
| 213 | If multiple versions of <application>Rust</application> are installed
|
---|
| 214 | in <filename class="directory">/opt</filename>, changing to another
|
---|
| 215 | version only requires changing the <filename> /opt/rustc</filename>
|
---|
| 216 | symbolic link and then running <command>ldconfig</command>.
|
---|
| 217 | </para>
|
---|
| 218 | </note>
|
---|
| 219 |
|
---|
| 220 | <para>
|
---|
| 221 | Create a suitable <filename>config.toml</filename> file which will
|
---|
[4f9e45d9] | 222 | configure the build.
|
---|
[4c6edac] | 223 | </para>
|
---|
| 224 |
|
---|
[272f28b] | 225 | <screen><userinput>cat << EOF > config.toml
|
---|
[51dfb3e] | 226 | <literal># see config.toml.example for more possible options
|
---|
[4f9e45d9] | 227 | # See the 8.4 book for an example using shipped LLVM
|
---|
[741231d] | 228 | # e.g. if not installing clang, or using a version before 8.0.
|
---|
[4c6edac] | 229 | [llvm]
|
---|
[4f9e45d9] | 230 | # by default, rust will build for a myriad of architectures
|
---|
[25997c4a] | 231 | targets = "X86"
|
---|
[4f9e45d9] | 232 |
|
---|
| 233 | # When using system llvm prefer shared libraries
|
---|
| 234 | link-shared = true
|
---|
[a7b1bddc] | 235 |
|
---|
[4c6edac] | 236 | [build]
|
---|
[4f9e45d9] | 237 | # omit docs to save time and space (default is to build them)
|
---|
[25997c4a] | 238 | docs = false
|
---|
| 239 |
|
---|
[4c6edac] | 240 | # install cargo as well as rust
|
---|
| 241 | extended = true
|
---|
| 242 |
|
---|
| 243 | [install]
|
---|
[8e99a05] | 244 | prefix = "/opt/rustc-1.35.0"
|
---|
[4f9e45d9] | 245 | docdir = "share/doc/rustc-1.35.0"
|
---|
[326f830] | 246 |
|
---|
| 247 | [rust]
|
---|
[4c6edac] | 248 | channel = "stable"
|
---|
[326f830] | 249 | rpath = false
|
---|
[a7b1bddc] | 250 |
|
---|
| 251 | # BLFS does not install the FileCheck executable from llvm,
|
---|
| 252 | # so disable codegen tests
|
---|
| 253 | codegen-tests = false
|
---|
| 254 |
|
---|
[4f9e45d9] | 255 | [target.x86_64-unknown-linux-gnu]
|
---|
| 256 | # NB the output of llvm-config (i.e. help options) may be
|
---|
| 257 | # dumped to the screen when config.toml is parsed.
|
---|
| 258 | llvm-config = "/usr/bin/llvm-config"
|
---|
[07f5c72] | 259 |
|
---|
| 260 | [target.i686-unknown-linux-gnu]
|
---|
| 261 | # NB the output of llvm-config (i.e. help options) may be
|
---|
| 262 | # dumped to the screen when config.toml is parsed.
|
---|
| 263 | llvm-config = "/usr/bin/llvm-config"
|
---|
| 264 |
|
---|
[51dfb3e] | 265 | </literal>
|
---|
[4c6edac] | 266 | EOF</userinput></screen>
|
---|
| 267 |
|
---|
| 268 | <para>
|
---|
[4f9e45d9] | 269 | Now compile <application>Rust</application> by running the following
|
---|
[03d537cd] | 270 | commands:
|
---|
| 271 | </para>
|
---|
| 272 |
|
---|
[bb0652ca] | 273 | <screen><userinput>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&
|
---|
[4f8ca94] | 274 | python3 ./x.py build --exclude src/tools/miri</userinput></screen>
|
---|
[a7b1bddc] | 275 |
|
---|
[6bcd464] | 276 | <note>
|
---|
[a7b1bddc] | 277 | <para>
|
---|
[6bcd464] | 278 | The testsuite will generate some messages in the
|
---|
[a7b1bddc] | 279 | <phrase revision="sysv">system log</phrase>
|
---|
| 280 | <phrase revision="systemd">systemd journal</phrase>
|
---|
[6bcd464] | 281 | for traps on invalid opcodes, and for segmentation faults.
|
---|
[25997c4a] | 282 | In themselves these are nothing to worry about, just a way for the
|
---|
[4f9e45d9] | 283 | test to be terminated.
|
---|
[a7b1bddc] | 284 | </para>
|
---|
[6bcd464] | 285 | </note>
|
---|
[a7b1bddc] | 286 |
|
---|
[03d537cd] | 287 | <para>
|
---|
[4f8ca94] | 288 | To run the tests issue <command>python3 ./x.py test --verbose
|
---|
| 289 | --no-fail-fast | tee rustc-testlog</command>: as with the build, that
|
---|
| 290 | will use all available CPUs.
|
---|
[03d537cd] | 291 | </para>
|
---|
| 292 |
|
---|
| 293 | <para>
|
---|
[25997c4a] | 294 | The instructions above do not build ARM compilers, so the testsuite
|
---|
| 295 | <emphasis>will</emphasis> fail and the tests will be reported to end in
|
---|
| 296 | error, with a backtrace of the last failing test. On a good run, 3 tests
|
---|
[4f8ca94] | 297 | which need Thumb (ARM) compilers will fail, all in <filename
|
---|
[25997c4a] | 298 | class="directory">ui/issues</filename> for issues 37131, 49851 and 50993.
|
---|
[4f9e45d9] | 299 | A fourth test,
|
---|
[4f8ca94] | 300 | <filename>run-make-fulldeps/sysroot-crates-are-unstable</filename>
|
---|
[4f9e45d9] | 301 | fails, presumably because we are using only stable features.
|
---|
| 302 | If gdb has been installed, in some circumstances tests in
|
---|
| 303 | <filename class="directory">debuginfo</filename> may fail. As with all
|
---|
[4f8ca94] | 304 | large testsuites, other tests might
|
---|
[4cc77fbd] | 305 | fail on some machines - if the number of failures is in the single digits,
|
---|
[4f9e45d9] | 306 | check the log for 'FAILED' and review lines above that, particularly the
|
---|
| 307 | 'stderr:' lines. Any mention of
|
---|
[4cc77fbd] | 308 | SIGSEGV or signal 11 in a failing test is a cause for concern.
|
---|
[25997c4a] | 309 | </para>
|
---|
| 310 |
|
---|
[b6ff745e] | 311 | <para>
|
---|
[25997c4a] | 312 | Therefore, you should determine the number of tests, failures, etc. The
|
---|
| 313 | total number of tests which were considered is found by running:
|
---|
[03d537cd] | 314 | </para>
|
---|
| 315 |
|
---|
[e7d4e823] | 316 | <screen remap="test"><userinput>grep 'running .* tests' rustc-testlog | awk '{ sum += $2 } END { print sum }'</userinput></screen>
|
---|
[4c6edac] | 317 |
|
---|
[03d537cd] | 318 | <para>
|
---|
[4f9e45d9] | 319 | That should report 16499 tests. Similarly, the total tests which failed can
|
---|
[4c6edac] | 320 | be found by running:
|
---|
[03d537cd] | 321 | </para>
|
---|
| 322 |
|
---|
[e7d4e823] | 323 | <screen remap="test"><userinput>grep '^test result:' rustc-testlog | awk '{ sum += $6 } END { print sum }'</userinput></screen>
|
---|
[03d537cd] | 324 |
|
---|
[4c6edac] | 325 | <para>
|
---|
| 326 | And similarly for the tests which passed use $4, for those which were ignored
|
---|
| 327 | (i.e. skipped) use $8 (and $10 for 'measured', $12 for 'filtered out' but both
|
---|
[25997c4a] | 328 | are probably zero). The breakdown does not quite match the overall total.
|
---|
[4c6edac] | 329 | </para>
|
---|
| 330 |
|
---|
| 331 | <para>
|
---|
[a7b1bddc] | 332 | Still as your normal user, do a DESTDIR install:
|
---|
[4c6edac] | 333 | </para>
|
---|
| 334 |
|
---|
[fb940713] | 335 | <screen><userinput>export LIBSSH2_SYS_USE_PKG_CONFIG=1 &&
|
---|
[4f8ca94] | 336 | DESTDIR=${PWD}/install python3 ./x.py install &&
|
---|
[fb940713] | 337 | unset LIBSSH2_SYS_USE_PKG_CONFIG</userinput></screen>
|
---|
[a7b1bddc] | 338 |
|
---|
| 339 | <para>
|
---|
| 340 | Now, as the <systemitem class="username">root</systemitem> user
|
---|
| 341 | install the files from the DESTDIR:
|
---|
| 342 | </para>
|
---|
| 343 |
|
---|
[bb0652ca] | 344 | <screen role="root"><userinput>chown -R root:root install &&
|
---|
| 345 | cp -a install/* /</userinput></screen>
|
---|
[a7b1bddc] | 346 |
|
---|
[03d537cd] | 347 | </sect2>
|
---|
| 348 |
|
---|
| 349 | <sect2 role="commands">
|
---|
| 350 | <title>Command Explanations</title>
|
---|
| 351 |
|
---|
| 352 | <para>
|
---|
[d396c65] | 353 | <command>ln -svfn rustc-&rust-version; /opt/rustc</command>: if this is
|
---|
| 354 | not the first use of the <filename class="directory">/opt/rustc</filename>
|
---|
| 355 | symlink, overwrite it by forcing, and use the '-n' flag to avoid getting
|
---|
| 356 | confusing results from e.g. <command>ls -l</command>.
|
---|
| 357 | </para>
|
---|
| 358 |
|
---|
| 359 | <para>
|
---|
[4c6edac] | 360 | <command>targets = "X86"</command>: this avoids building all the available
|
---|
[a7b1bddc] | 361 | linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc). Unfortunately,
|
---|
| 362 | rust insists on installing source files for these below
|
---|
[21699c7e] | 363 | <filename class="directory">/opt/rustc/lib/src</filename>.
|
---|
[03d537cd] | 364 | </para>
|
---|
| 365 |
|
---|
| 366 | <para>
|
---|
[4c6edac] | 367 | <command>extended = true</command>: this installs Cargo alongside Rust.
|
---|
[03d537cd] | 368 | </para>
|
---|
| 369 |
|
---|
| 370 | <para>
|
---|
[4c6edac] | 371 | <command>channel = "stable"</command>: this ensures only stable features
|
---|
| 372 | can be used, the default in <filename>config.toml</filename> is to use
|
---|
| 373 | development features, which is not appropriate for a released version.
|
---|
[03d537cd] | 374 | </para>
|
---|
| 375 |
|
---|
[326f830] | 376 | <para>
|
---|
| 377 | <command>rpath = false</command>: by default, <command>rust</command> can
|
---|
| 378 | be run from where it was built, without being installed. That adds DT_RPATH
|
---|
| 379 | entries to all of the ELF files, which produces very messy output from
|
---|
| 380 | <command>ldd</command>, showing the libraries in the place they were built,
|
---|
| 381 | even if they have been deleted from there after the install.
|
---|
| 382 | </para>
|
---|
| 383 |
|
---|
[25997c4a] | 384 | <!-- comment while using shipped LLVM
|
---|
[a7b1bddc] | 385 | <para>
|
---|
| 386 | <command>[target.x86_64-unknown-linux-gnu]</command>: the syntax of
|
---|
| 387 | <filename>config.toml</filename> requires an <literal>llvm-config</literal>
|
---|
| 388 | entry for each target for which system-llvm is to be used. Change the target
|
---|
| 389 | to <literal>[target.i686-unknown-linux-gnu]</literal> if you are building
|
---|
| 390 | on 32-bit x86. This whole section may be omitted if you wish to build
|
---|
| 391 | against the shipped llvm, or do not have clang, but the resulting build will
|
---|
[7d259126] | 392 | be larger and take longer.
|
---|
[25997c4a] | 393 | </para>-->
|
---|
[a7b1bddc] | 394 |
|
---|
[bb0652ca] | 395 | <para>
|
---|
| 396 | <command>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"</command>:
|
---|
| 397 | This adds a link to libffi to any RUSTFLAGS you may already be passing
|
---|
| 398 | to the build. On some systems, linking fails to include libffi unless
|
---|
| 399 | this is used. The reason why this is needed is not clear.
|
---|
| 400 | </para>
|
---|
| 401 |
|
---|
[25997c4a] | 402 | <para>
|
---|
| 403 | <command>--exclude src/tools/miri</command>: For a long time, the miri
|
---|
| 404 | crate (an interpreter for the Midlevel Intermediate Representation)
|
---|
| 405 | has failed to build on releases. It is optional, but the failure
|
---|
[4f9e45d9] | 406 | messages can persuade people that the whole build failed. However,
|
---|
| 407 | although it is not built in the main compile, with rustc-1.35.0 it
|
---|
| 408 | now gets compiled during the install, but it is broken in this version.
|
---|
| 409 | <!-- might be unbroken in 1.36.0, if so remove broken from description
|
---|
| 410 | of miri below. https://github.com/rust-lang/rust/issues/61830 -->
|
---|
[25997c4a] | 411 | </para>
|
---|
| 412 |
|
---|
[03d537cd] | 413 | <para>
|
---|
[4c6edac] | 414 | <command>--verbose</command>: this switch can sometimes provide more
|
---|
| 415 | information about a test which fails.
|
---|
[03d537cd] | 416 | </para>
|
---|
[4c6edac] | 417 |
|
---|
| 418 | <para>
|
---|
| 419 | <command>--no-fail-fast</command>: this switch ensures that the testsuite
|
---|
| 420 | will not stop at the first error.
|
---|
| 421 | </para>
|
---|
| 422 |
|
---|
[fb940713] | 423 | <para>
|
---|
| 424 | <command>export LIBSSH2_SYS_USE_PKG_CONFIG=1</command>: On some systems,
|
---|
| 425 | cairo fails to link during the install because it cannot find libssh2.
|
---|
| 426 | This seems to fix it, but again the reason why the problem occurs is not
|
---|
| 427 | understood.
|
---|
| 428 | </para>
|
---|
| 429 |
|
---|
[326f830] | 430 | <para>
|
---|
[4f8ca94] | 431 | <command>DESTDIR=${PWD}/install python3 ./x.py install</command>: This
|
---|
| 432 | effects a DESTDIR-style install in the source tree,creating an <filename
|
---|
[bb0652ca] | 433 | class="directory">install</filename> directory. Note that DESTDIR installs
|
---|
| 434 | need an absolute path, passing 'install' will not work.
|
---|
[a7b1bddc] | 435 | </para>
|
---|
| 436 |
|
---|
| 437 | <para>
|
---|
[bb0652ca] | 438 | <command>chown -R root:root install</command>: the DESTDIR install
|
---|
[a7b1bddc] | 439 | was run by a regular user, who owns the files. For security, change their
|
---|
| 440 | owner before doing a simple copy to install them.
|
---|
[326f830] | 441 | </para>
|
---|
| 442 |
|
---|
[03d537cd] | 443 | </sect2>
|
---|
| 444 |
|
---|
[b05ea0b] | 445 | <sect2 role="configuration">
|
---|
| 446 | <title>Configuring Rust</title>
|
---|
| 447 |
|
---|
| 448 | <sect3 id="rustc-config">
|
---|
| 449 | <title>Configuration Information</title>
|
---|
| 450 |
|
---|
| 451 | <para>
|
---|
| 452 | If you installed <application>rustc</application> in
|
---|
| 453 | <filename class="directory">/opt</filename>, you need to update the
|
---|
| 454 | following configuration files so that <application>rustc</application> is
|
---|
| 455 | correctly found by other packages and system processes.
|
---|
| 456 | </para>
|
---|
| 457 |
|
---|
| 458 | <para>
|
---|
| 459 | As the <systemitem class="username">root</systemitem> user, update
|
---|
| 460 | the <filename>/etc/ld.so.conf</filename> file and the dynamic linker's
|
---|
| 461 | run-time cache file:
|
---|
| 462 | </para>
|
---|
| 463 |
|
---|
| 464 | <screen role="root"><userinput>cat >> /etc/ld.so.conf << EOF
|
---|
| 465 | <literal># Begin rustc addition
|
---|
| 466 |
|
---|
| 467 | /opt/rustc/lib
|
---|
| 468 |
|
---|
| 469 | # End rustc addition</literal>
|
---|
| 470 | EOF
|
---|
| 471 |
|
---|
| 472 | ldconfig</userinput></screen>
|
---|
| 473 |
|
---|
| 474 | <indexterm zone="rustc rustc-config">
|
---|
| 475 | <primary sortas="e-etc-ld.so.conf">/etc/ld.so.conf</primary>
|
---|
| 476 | </indexterm>
|
---|
| 477 |
|
---|
| 478 | <para>
|
---|
| 479 | As the <systemitem class="username">root</systemitem> user, create
|
---|
| 480 | the <filename>/etc/profile.d/rustc.sh</filename> file:
|
---|
| 481 | </para>
|
---|
| 482 |
|
---|
| 483 | <screen role="root"><userinput>cat > /etc/profile.d/rustc.sh << "EOF"
|
---|
| 484 | <literal># Begin /etc/profile.d/rustc.sh
|
---|
| 485 |
|
---|
| 486 | pathprepend /opt/rustc/bin PATH
|
---|
| 487 |
|
---|
| 488 | # End /etc/profile.d/rustc.sh</literal>
|
---|
| 489 | EOF</userinput></screen>
|
---|
| 490 |
|
---|
| 491 | <para>Immediately after installation, update the current PATH
|
---|
| 492 | for your current shell as a normal user:</para>
|
---|
| 493 |
|
---|
| 494 | <screen><userinput>source /etc/profile.d/rustc.sh</userinput></screen>
|
---|
| 495 |
|
---|
| 496 | </sect3>
|
---|
| 497 | </sect2>
|
---|
| 498 |
|
---|
| 499 |
|
---|
[03d537cd] | 500 | <sect2 role="content">
|
---|
| 501 | <title>Contents</title>
|
---|
| 502 |
|
---|
| 503 | <segmentedlist>
|
---|
[78399edc] | 504 | <segtitle>Installed Programs</segtitle>
|
---|
| 505 | <segtitle>Installed Libraries</segtitle>
|
---|
| 506 | <segtitle>Installed Directories</segtitle>
|
---|
[03d537cd] | 507 |
|
---|
| 508 | <seglistitem>
|
---|
| 509 | <seg>
|
---|
[4f9e45d9] | 510 | cargo-clippy, cargo-fmt, cargo-miri, cargo, clippy-driver, miri, rls, rust-gdb, rust-lldb, rustc, rustdoc, rustfmt.
|
---|
[03d537cd] | 511 | </seg>
|
---|
| 512 | <seg>
|
---|
[4c6edac] | 513 | Many lib*<16-byte-hash>.so libraries.
|
---|
[03d537cd] | 514 | </seg>
|
---|
| 515 | <seg>
|
---|
| 516 | ~/.cargo,
|
---|
[21699c7e] | 517 | /opt/rustc/lib/rustlib,
|
---|
| 518 | /opt/rustc/share/doc/rustc-&rust-version;, and
|
---|
| 519 | /opt/rustc/share/zsh/site-functions
|
---|
[03d537cd] | 520 | </seg>
|
---|
| 521 | </seglistitem>
|
---|
| 522 | </segmentedlist>
|
---|
| 523 |
|
---|
| 524 | <variablelist>
|
---|
| 525 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 526 | <?dbfo list-presentation="list"?>
|
---|
| 527 | <?dbhtml list-presentation="table"?>
|
---|
| 528 |
|
---|
[7d259126] | 529 | <varlistentry id="cargo-clippy">
|
---|
| 530 | <term><command>cargo-clippy</command></term>
|
---|
| 531 | <listitem>
|
---|
| 532 | <para>
|
---|
| 533 | provides lint checks for a cargo package.
|
---|
| 534 | </para>
|
---|
| 535 | <indexterm zone="rust cargo-clippy">
|
---|
| 536 | <primary sortas="b-cargo-clippy">cargo-clippy</primary>
|
---|
| 537 | </indexterm>
|
---|
| 538 | </listitem>
|
---|
| 539 | </varlistentry>
|
---|
| 540 |
|
---|
[a7b1bddc] | 541 | <varlistentry id="cargo-fmt">
|
---|
| 542 | <term><command>cargo-fmt</command></term>
|
---|
| 543 | <listitem>
|
---|
| 544 | <para>
|
---|
| 545 | formats all bin and lib files of the current crate using
|
---|
| 546 | rustfmt.
|
---|
| 547 | </para>
|
---|
| 548 | <indexterm zone="rust cargo-fmt">
|
---|
| 549 | <primary sortas="b-cargo-fmt">cargo-fmt</primary>
|
---|
| 550 | </indexterm>
|
---|
| 551 | </listitem>
|
---|
| 552 | </varlistentry>
|
---|
| 553 |
|
---|
[4f9e45d9] | 554 | <varlistentry id="cargo-miri">
|
---|
| 555 | <term><command>cargo-miri</command></term>
|
---|
| 556 | <listitem>
|
---|
| 557 | <para>
|
---|
| 558 | <!-- FIXME reword to 'is used by' if Miri installed
|
---|
| 559 | AND works enough to report its \-\-help -->
|
---|
| 560 | is for use by Miri to interpret bin crates and tests
|
---|
| 561 | </para>
|
---|
| 562 | <indexterm zone="rust cargo-miri">
|
---|
| 563 | <primary sortas="b-cargo-miri">cargo-miri</primary>
|
---|
| 564 | </indexterm>
|
---|
| 565 | </listitem>
|
---|
| 566 | </varlistentry>
|
---|
| 567 |
|
---|
[4c6edac] | 568 | <varlistentry id="cargo">
|
---|
| 569 | <term><command>cargo</command></term>
|
---|
| 570 | <listitem>
|
---|
| 571 | <para>
|
---|
| 572 | is the Package Manager for Rust.
|
---|
| 573 | </para>
|
---|
| 574 | <indexterm zone="rust cargo">
|
---|
| 575 | <primary sortas="b-cargo">cargo</primary>
|
---|
| 576 | </indexterm>
|
---|
| 577 | </listitem>
|
---|
| 578 | </varlistentry>
|
---|
| 579 |
|
---|
[7d259126] | 580 | <varlistentry id="clippy-driver">
|
---|
| 581 | <term><command>clippy-driver</command></term>
|
---|
| 582 | <listitem>
|
---|
| 583 | <para>
|
---|
| 584 | provides lint checks for Rust.
|
---|
| 585 | </para>
|
---|
| 586 | <indexterm zone="rust clippy-driver">
|
---|
| 587 | <primary sortas="b-clippy-driver">clippy-driver</primary>
|
---|
| 588 | </indexterm>
|
---|
| 589 | </listitem>
|
---|
| 590 | </varlistentry>
|
---|
| 591 |
|
---|
[4f9e45d9] | 592 | <varlistentry id="miri">
|
---|
| 593 | <term><command>miri</command></term>
|
---|
| 594 | <listitem>
|
---|
| 595 | <para>
|
---|
| 596 | is an interpreter for Rust's mid-level intermediate representation
|
---|
| 597 | (MIR). It is broken in this version.
|
---|
| 598 | </para>
|
---|
| 599 | <indexterm zone="rust miri">
|
---|
| 600 | <primary sortas="b-miri">miri</primary>
|
---|
| 601 | </indexterm>
|
---|
| 602 | </listitem>
|
---|
| 603 | </varlistentry>
|
---|
| 604 |
|
---|
[326f830] | 605 | <varlistentry id="rls">
|
---|
| 606 | <term><command>rls</command></term>
|
---|
| 607 | <listitem>
|
---|
| 608 | <para>
|
---|
| 609 | is the Rust Language Server. This can run in the background to
|
---|
| 610 | provide IDEs, editors, and other tools with information about Rust
|
---|
| 611 | programs.
|
---|
| 612 | </para>
|
---|
| 613 | <indexterm zone="rust rls">
|
---|
| 614 | <primary sortas="b-rls">rls</primary>
|
---|
| 615 | </indexterm>
|
---|
| 616 | </listitem>
|
---|
| 617 | </varlistentry>
|
---|
| 618 |
|
---|
[03d537cd] | 619 | <varlistentry id="rust-gdb">
|
---|
| 620 | <term><command>rust-gdb</command></term>
|
---|
| 621 | <listitem>
|
---|
| 622 | <para>
|
---|
[a7b1bddc] | 623 | is a wrapper script for gdb, pulling in Python
|
---|
| 624 | pretty-printing modules installed in <filename
|
---|
| 625 | class="directory">/usr/lib/rustlib/etc</filename>.
|
---|
[03d537cd] | 626 | </para>
|
---|
| 627 | <indexterm zone="rust rust-gdb">
|
---|
| 628 | <primary sortas="b-rust-gdb">rust-gdb</primary>
|
---|
| 629 | </indexterm>
|
---|
| 630 | </listitem>
|
---|
| 631 | </varlistentry>
|
---|
| 632 |
|
---|
| 633 | <varlistentry id="rust-lldb">
|
---|
| 634 | <term><command>rust-lldb</command></term>
|
---|
| 635 | <listitem>
|
---|
| 636 | <para>
|
---|
[a7b1bddc] | 637 | is a wrapper script for LLDB (the LLVM debugger)
|
---|
| 638 | pulling in the Python pretty-printing modules.
|
---|
[03d537cd] | 639 | </para>
|
---|
| 640 | <indexterm zone="rust rust-lldb">
|
---|
| 641 | <primary sortas="b-rust-lldb">rust=lldb</primary>
|
---|
| 642 | </indexterm>
|
---|
| 643 | </listitem>
|
---|
| 644 | </varlistentry>
|
---|
| 645 |
|
---|
| 646 | <varlistentry id="rustc">
|
---|
| 647 | <term><command>rustc</command></term>
|
---|
| 648 | <listitem>
|
---|
| 649 | <para>
|
---|
| 650 | is the rust compiler.
|
---|
| 651 | </para>
|
---|
| 652 | <indexterm zone="rust rustc">
|
---|
| 653 | <primary sortas="b-rustc">rustc</primary>
|
---|
| 654 | </indexterm>
|
---|
| 655 | </listitem>
|
---|
| 656 | </varlistentry>
|
---|
| 657 |
|
---|
| 658 | <varlistentry id="rustdoc">
|
---|
| 659 | <term><command>rustdoc</command></term>
|
---|
| 660 | <listitem>
|
---|
| 661 | <para>
|
---|
| 662 | generates documentation from rust source code.
|
---|
| 663 | </para>
|
---|
| 664 | <indexterm zone="rust rustdoc">
|
---|
| 665 | <primary sortas="b-rustdoc">rustdoc</primary>
|
---|
| 666 | </indexterm>
|
---|
| 667 | </listitem>
|
---|
| 668 | </varlistentry>
|
---|
| 669 |
|
---|
[a7b1bddc] | 670 | <varlistentry id="rustfmt">
|
---|
| 671 | <term><command>rustfmt</command></term>
|
---|
| 672 | <listitem>
|
---|
| 673 | <para>
|
---|
| 674 | formats rust code.
|
---|
| 675 | </para>
|
---|
| 676 | <indexterm zone="rust rustfmt">
|
---|
| 677 | <primary sortas="b-rustfmt">rustfmt</primary>
|
---|
| 678 | </indexterm>
|
---|
| 679 | </listitem>
|
---|
| 680 | </varlistentry>
|
---|
| 681 |
|
---|
[03d537cd] | 682 | <varlistentry id="libstd">
|
---|
| 683 | <term><filename class="libraryfile">libstd-<16-byte-hash>.so</filename></term>
|
---|
| 684 | <listitem>
|
---|
| 685 | <para>
|
---|
| 686 | is the Rust Standard Library, the foundation of portable Rust software.
|
---|
| 687 | </para>
|
---|
| 688 | <indexterm zone="rust libstd">
|
---|
| 689 | <primary sortas="c-libstd">libstd-<16-byte-hash>.so</primary>
|
---|
| 690 | </indexterm>
|
---|
| 691 | </listitem>
|
---|
| 692 | </varlistentry>
|
---|
| 693 | </variablelist>
|
---|
| 694 | </sect2>
|
---|
| 695 | </sect1>
|
---|