[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 " ">
|
---|
[f7dd8651] | 9 | <!ENTITY rust-md5sum "e67432b37150f13e186ebfb67e5192fb">
|
---|
| 10 | <!ENTITY rust-size "147 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 |
|
---|
[f7dd8651] | 16 | <!ENTITY rust-buildsize "5.3GB (375 MB installed) including 429MB of ~/.cargo files for the user building this. Add 1.7 GB if running the tests">
|
---|
| 17 | <!ENTITY rust-time "24 SBU (add 13 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 |
|
---|
[d7e8f67] | 169 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 170 | <itemizedlist spacing="compact">
|
---|
| 171 | <listitem>
|
---|
| 172 | <para>
|
---|
| 173 | Required patch:
|
---|
| 174 | <ulink url="&patch-root;/rustc-&rust-version;-llvm9_fixes-1.patch"/>
|
---|
| 175 | </para>
|
---|
| 176 | </listitem>
|
---|
| 177 | </itemizedlist>
|
---|
| 178 |
|
---|
[03d537cd] | 179 | <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
|
---|
| 180 |
|
---|
| 181 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 182 | <para role="required">
|
---|
| 183 | <xref linkend="curl"/>,
|
---|
[4f8ca94] | 184 | <xref linkend="cmake"/>, and
|
---|
| 185 | <xref linkend="libssh2"/>
|
---|
[03d537cd] | 186 | </para>
|
---|
| 187 |
|
---|
[a7b1bddc] | 188 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 189 | <para role="recommended">
|
---|
| 190 | <package>clang</package> from <xref linkend="llvm"/>
|
---|
[4f9e45d9] | 191 | (built with -DLLVM_LINK_LLVM_DYLIB=ON so that rust can link to
|
---|
[741231d] | 192 | system LLVM instead of building its shipped version)
|
---|
[4f9e45d9] | 193 | </para>
|
---|
[a7b1bddc] | 194 |
|
---|
[03d537cd] | 195 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 196 | <para role="optional">
|
---|
[4f8ca94] | 197 | <xref linkend="gdb"/> (used by the testsuite if it is present) and
|
---|
[4f9e45d9] | 198 | <xref linkend="python2"/> (used by the testsuite)
|
---|
[03d537cd] | 199 | </para>
|
---|
| 200 |
|
---|
| 201 | <para condition="html" role="usernotes">
|
---|
| 202 | User Notes: <ulink url="&blfs-wiki;/rust"/>
|
---|
| 203 | </para>
|
---|
| 204 | </sect2>
|
---|
| 205 |
|
---|
| 206 | <sect2 role="installation">
|
---|
| 207 | <title>Installation of Rust</title>
|
---|
| 208 |
|
---|
| 209 | <para>
|
---|
[d396c65] | 210 | To install into the
|
---|
| 211 | <filename class="directory">/opt</filename> directory, remove the symlink
|
---|
| 212 | and create a new directory (i.e. with a different name if trying a
|
---|
| 213 | modified build).
|
---|
[4f9e45d9] | 214 | As the <systemitem class="username">root</systemitem>
|
---|
[b05ea0b] | 215 | user:
|
---|
| 216 | </para>
|
---|
| 217 |
|
---|
[d396c65] | 218 | <screen role="root"><userinput>mkdir /opt/rustc-&rust-version; &&
|
---|
| 219 | ln -svfin rustc-&rust-version; /opt/rustc</userinput></screen>
|
---|
[b05ea0b] | 220 |
|
---|
| 221 | <note>
|
---|
| 222 | <para>
|
---|
| 223 | If multiple versions of <application>Rust</application> are installed
|
---|
| 224 | in <filename class="directory">/opt</filename>, changing to another
|
---|
| 225 | version only requires changing the <filename> /opt/rustc</filename>
|
---|
| 226 | symbolic link and then running <command>ldconfig</command>.
|
---|
| 227 | </para>
|
---|
| 228 | </note>
|
---|
| 229 |
|
---|
| 230 | <para>
|
---|
| 231 | Create a suitable <filename>config.toml</filename> file which will
|
---|
[4f9e45d9] | 232 | configure the build.
|
---|
[4c6edac] | 233 | </para>
|
---|
| 234 |
|
---|
[272f28b] | 235 | <screen><userinput>cat << EOF > config.toml
|
---|
[51dfb3e] | 236 | <literal># see config.toml.example for more possible options
|
---|
[4f9e45d9] | 237 | # See the 8.4 book for an example using shipped LLVM
|
---|
[741231d] | 238 | # e.g. if not installing clang, or using a version before 8.0.
|
---|
[4c6edac] | 239 | [llvm]
|
---|
[4f9e45d9] | 240 | # by default, rust will build for a myriad of architectures
|
---|
[25997c4a] | 241 | targets = "X86"
|
---|
[4f9e45d9] | 242 |
|
---|
| 243 | # When using system llvm prefer shared libraries
|
---|
| 244 | link-shared = true
|
---|
[a7b1bddc] | 245 |
|
---|
[4c6edac] | 246 | [build]
|
---|
[4f9e45d9] | 247 | # omit docs to save time and space (default is to build them)
|
---|
[25997c4a] | 248 | docs = false
|
---|
| 249 |
|
---|
[4c6edac] | 250 | # install cargo as well as rust
|
---|
| 251 | extended = true
|
---|
| 252 |
|
---|
| 253 | [install]
|
---|
[ff803c4] | 254 | prefix = "/opt/rustc-&rust-version;"
|
---|
| 255 | docdir = "share/doc/rustc-&rust-version;"
|
---|
[326f830] | 256 |
|
---|
| 257 | [rust]
|
---|
[4c6edac] | 258 | channel = "stable"
|
---|
[326f830] | 259 | rpath = false
|
---|
[a7b1bddc] | 260 |
|
---|
| 261 | # BLFS does not install the FileCheck executable from llvm,
|
---|
| 262 | # so disable codegen tests
|
---|
| 263 | codegen-tests = false
|
---|
| 264 |
|
---|
[4f9e45d9] | 265 | [target.x86_64-unknown-linux-gnu]
|
---|
| 266 | # NB the output of llvm-config (i.e. help options) may be
|
---|
| 267 | # dumped to the screen when config.toml is parsed.
|
---|
| 268 | llvm-config = "/usr/bin/llvm-config"
|
---|
[07f5c72] | 269 |
|
---|
| 270 | [target.i686-unknown-linux-gnu]
|
---|
| 271 | # NB the output of llvm-config (i.e. help options) may be
|
---|
| 272 | # dumped to the screen when config.toml is parsed.
|
---|
| 273 | llvm-config = "/usr/bin/llvm-config"
|
---|
| 274 |
|
---|
[51dfb3e] | 275 | </literal>
|
---|
[4c6edac] | 276 | EOF</userinput></screen>
|
---|
| 277 |
|
---|
[d7e8f67] | 278 | <para>
|
---|
| 279 | Adapt rustc to allow it to build and function with the changes in LLVM-9:
|
---|
| 280 | </para>
|
---|
| 281 |
|
---|
| 282 | <screen><userinput remap="pre">patch -Np1 -i ../rustc-&rust-version;-llvm9_fixes-1.patch</userinput></screen>
|
---|
| 283 |
|
---|
[4c6edac] | 284 | <para>
|
---|
[4f9e45d9] | 285 | Now compile <application>Rust</application> by running the following
|
---|
[03d537cd] | 286 | commands:
|
---|
| 287 | </para>
|
---|
| 288 |
|
---|
[bb0652ca] | 289 | <screen><userinput>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&
|
---|
[4f8ca94] | 290 | python3 ./x.py build --exclude src/tools/miri</userinput></screen>
|
---|
[a7b1bddc] | 291 |
|
---|
[6bcd464] | 292 | <note>
|
---|
[a7b1bddc] | 293 | <para>
|
---|
[6bcd464] | 294 | The testsuite will generate some messages in the
|
---|
[a7b1bddc] | 295 | <phrase revision="sysv">system log</phrase>
|
---|
| 296 | <phrase revision="systemd">systemd journal</phrase>
|
---|
[6bcd464] | 297 | for traps on invalid opcodes, and for segmentation faults.
|
---|
[25997c4a] | 298 | In themselves these are nothing to worry about, just a way for the
|
---|
[4f9e45d9] | 299 | test to be terminated.
|
---|
[a7b1bddc] | 300 | </para>
|
---|
[6bcd464] | 301 | </note>
|
---|
[a7b1bddc] | 302 |
|
---|
[03d537cd] | 303 | <para>
|
---|
[4f8ca94] | 304 | To run the tests issue <command>python3 ./x.py test --verbose
|
---|
| 305 | --no-fail-fast | tee rustc-testlog</command>: as with the build, that
|
---|
| 306 | will use all available CPUs.
|
---|
[03d537cd] | 307 | </para>
|
---|
| 308 |
|
---|
| 309 | <para>
|
---|
[25997c4a] | 310 | The instructions above do not build ARM compilers, so the testsuite
|
---|
| 311 | <emphasis>will</emphasis> fail and the tests will be reported to end in
|
---|
| 312 | error, with a backtrace of the last failing test. On a good run, 3 tests
|
---|
[4f8ca94] | 313 | which need Thumb (ARM) compilers will fail, all in <filename
|
---|
[25997c4a] | 314 | class="directory">ui/issues</filename> for issues 37131, 49851 and 50993.
|
---|
[4f9e45d9] | 315 | A fourth test,
|
---|
[4f8ca94] | 316 | <filename>run-make-fulldeps/sysroot-crates-are-unstable</filename>
|
---|
[4f9e45d9] | 317 | fails, presumably because we are using only stable features.
|
---|
[f7dd8651] | 318 | <!-- appears to be fixed now
|
---|
[4f9e45d9] | 319 | If gdb has been installed, in some circumstances tests in
|
---|
[f7dd8651] | 320 | <filename class="directory">debuginfo</filename> may fail.--> As with all
|
---|
[4f8ca94] | 321 | large testsuites, other tests might
|
---|
[4cc77fbd] | 322 | fail on some machines - if the number of failures is in the single digits,
|
---|
[4f9e45d9] | 323 | check the log for 'FAILED' and review lines above that, particularly the
|
---|
| 324 | 'stderr:' lines. Any mention of
|
---|
[4cc77fbd] | 325 | SIGSEGV or signal 11 in a failing test is a cause for concern.
|
---|
[f7dd8651] | 326 | A fifth test, run-make-fulldeps/linker-output-non-utf8, is known to fail.
|
---|
[25997c4a] | 327 | </para>
|
---|
| 328 |
|
---|
[b6ff745e] | 329 | <para>
|
---|
[25997c4a] | 330 | Therefore, you should determine the number of tests, failures, etc. The
|
---|
| 331 | total number of tests which were considered is found by running:
|
---|
[03d537cd] | 332 | </para>
|
---|
| 333 |
|
---|
[e7d4e823] | 334 | <screen remap="test"><userinput>grep 'running .* tests' rustc-testlog | awk '{ sum += $2 } END { print sum }'</userinput></screen>
|
---|
[4c6edac] | 335 |
|
---|
[03d537cd] | 336 | <para>
|
---|
[4f9e45d9] | 337 | That should report 16499 tests. Similarly, the total tests which failed can
|
---|
[4c6edac] | 338 | be found by running:
|
---|
[03d537cd] | 339 | </para>
|
---|
| 340 |
|
---|
[e7d4e823] | 341 | <screen remap="test"><userinput>grep '^test result:' rustc-testlog | awk '{ sum += $6 } END { print sum }'</userinput></screen>
|
---|
[03d537cd] | 342 |
|
---|
[4c6edac] | 343 | <para>
|
---|
| 344 | And similarly for the tests which passed use $4, for those which were ignored
|
---|
| 345 | (i.e. skipped) use $8 (and $10 for 'measured', $12 for 'filtered out' but both
|
---|
[25997c4a] | 346 | are probably zero). The breakdown does not quite match the overall total.
|
---|
[4c6edac] | 347 | </para>
|
---|
| 348 |
|
---|
| 349 | <para>
|
---|
[a7b1bddc] | 350 | Still as your normal user, do a DESTDIR install:
|
---|
[4c6edac] | 351 | </para>
|
---|
| 352 |
|
---|
[fb940713] | 353 | <screen><userinput>export LIBSSH2_SYS_USE_PKG_CONFIG=1 &&
|
---|
[4f8ca94] | 354 | DESTDIR=${PWD}/install python3 ./x.py install &&
|
---|
[fb940713] | 355 | unset LIBSSH2_SYS_USE_PKG_CONFIG</userinput></screen>
|
---|
[a7b1bddc] | 356 |
|
---|
| 357 | <para>
|
---|
| 358 | Now, as the <systemitem class="username">root</systemitem> user
|
---|
| 359 | install the files from the DESTDIR:
|
---|
| 360 | </para>
|
---|
| 361 |
|
---|
[bb0652ca] | 362 | <screen role="root"><userinput>chown -R root:root install &&
|
---|
| 363 | cp -a install/* /</userinput></screen>
|
---|
[a7b1bddc] | 364 |
|
---|
[03d537cd] | 365 | </sect2>
|
---|
| 366 |
|
---|
| 367 | <sect2 role="commands">
|
---|
| 368 | <title>Command Explanations</title>
|
---|
| 369 |
|
---|
| 370 | <para>
|
---|
[d396c65] | 371 | <command>ln -svfn rustc-&rust-version; /opt/rustc</command>: if this is
|
---|
| 372 | not the first use of the <filename class="directory">/opt/rustc</filename>
|
---|
| 373 | symlink, overwrite it by forcing, and use the '-n' flag to avoid getting
|
---|
| 374 | confusing results from e.g. <command>ls -l</command>.
|
---|
| 375 | </para>
|
---|
| 376 |
|
---|
| 377 | <para>
|
---|
[4c6edac] | 378 | <command>targets = "X86"</command>: this avoids building all the available
|
---|
[a7b1bddc] | 379 | linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc). Unfortunately,
|
---|
| 380 | rust insists on installing source files for these below
|
---|
[21699c7e] | 381 | <filename class="directory">/opt/rustc/lib/src</filename>.
|
---|
[03d537cd] | 382 | </para>
|
---|
| 383 |
|
---|
| 384 | <para>
|
---|
[4c6edac] | 385 | <command>extended = true</command>: this installs Cargo alongside Rust.
|
---|
[03d537cd] | 386 | </para>
|
---|
| 387 |
|
---|
| 388 | <para>
|
---|
[4c6edac] | 389 | <command>channel = "stable"</command>: this ensures only stable features
|
---|
| 390 | can be used, the default in <filename>config.toml</filename> is to use
|
---|
| 391 | development features, which is not appropriate for a released version.
|
---|
[03d537cd] | 392 | </para>
|
---|
| 393 |
|
---|
[326f830] | 394 | <para>
|
---|
| 395 | <command>rpath = false</command>: by default, <command>rust</command> can
|
---|
| 396 | be run from where it was built, without being installed. That adds DT_RPATH
|
---|
| 397 | entries to all of the ELF files, which produces very messy output from
|
---|
| 398 | <command>ldd</command>, showing the libraries in the place they were built,
|
---|
| 399 | even if they have been deleted from there after the install.
|
---|
| 400 | </para>
|
---|
| 401 |
|
---|
[25997c4a] | 402 | <!-- comment while using shipped LLVM
|
---|
[a7b1bddc] | 403 | <para>
|
---|
| 404 | <command>[target.x86_64-unknown-linux-gnu]</command>: the syntax of
|
---|
| 405 | <filename>config.toml</filename> requires an <literal>llvm-config</literal>
|
---|
| 406 | entry for each target for which system-llvm is to be used. Change the target
|
---|
| 407 | to <literal>[target.i686-unknown-linux-gnu]</literal> if you are building
|
---|
| 408 | on 32-bit x86. This whole section may be omitted if you wish to build
|
---|
| 409 | against the shipped llvm, or do not have clang, but the resulting build will
|
---|
[7d259126] | 410 | be larger and take longer.
|
---|
[25997c4a] | 411 | </para>-->
|
---|
[a7b1bddc] | 412 |
|
---|
[bb0652ca] | 413 | <para>
|
---|
| 414 | <command>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"</command>:
|
---|
| 415 | This adds a link to libffi to any RUSTFLAGS you may already be passing
|
---|
| 416 | to the build. On some systems, linking fails to include libffi unless
|
---|
| 417 | this is used. The reason why this is needed is not clear.
|
---|
| 418 | </para>
|
---|
| 419 |
|
---|
[25997c4a] | 420 | <para>
|
---|
| 421 | <command>--exclude src/tools/miri</command>: For a long time, the miri
|
---|
| 422 | crate (an interpreter for the Midlevel Intermediate Representation)
|
---|
| 423 | has failed to build on releases. It is optional, but the failure
|
---|
[4f9e45d9] | 424 | messages can persuade people that the whole build failed. However,
|
---|
| 425 | although it is not built in the main compile, with rustc-1.35.0 it
|
---|
| 426 | now gets compiled during the install, but it is broken in this version.
|
---|
| 427 | <!-- might be unbroken in 1.36.0, if so remove broken from description
|
---|
| 428 | of miri below. https://github.com/rust-lang/rust/issues/61830 -->
|
---|
[25997c4a] | 429 | </para>
|
---|
| 430 |
|
---|
[03d537cd] | 431 | <para>
|
---|
[4c6edac] | 432 | <command>--verbose</command>: this switch can sometimes provide more
|
---|
| 433 | information about a test which fails.
|
---|
[03d537cd] | 434 | </para>
|
---|
[4c6edac] | 435 |
|
---|
| 436 | <para>
|
---|
| 437 | <command>--no-fail-fast</command>: this switch ensures that the testsuite
|
---|
| 438 | will not stop at the first error.
|
---|
| 439 | </para>
|
---|
| 440 |
|
---|
[fb940713] | 441 | <para>
|
---|
| 442 | <command>export LIBSSH2_SYS_USE_PKG_CONFIG=1</command>: On some systems,
|
---|
| 443 | cairo fails to link during the install because it cannot find libssh2.
|
---|
| 444 | This seems to fix it, but again the reason why the problem occurs is not
|
---|
| 445 | understood.
|
---|
| 446 | </para>
|
---|
| 447 |
|
---|
[326f830] | 448 | <para>
|
---|
[4f8ca94] | 449 | <command>DESTDIR=${PWD}/install python3 ./x.py install</command>: This
|
---|
| 450 | effects a DESTDIR-style install in the source tree,creating an <filename
|
---|
[bb0652ca] | 451 | class="directory">install</filename> directory. Note that DESTDIR installs
|
---|
| 452 | need an absolute path, passing 'install' will not work.
|
---|
[a7b1bddc] | 453 | </para>
|
---|
| 454 |
|
---|
| 455 | <para>
|
---|
[bb0652ca] | 456 | <command>chown -R root:root install</command>: the DESTDIR install
|
---|
[a7b1bddc] | 457 | was run by a regular user, who owns the files. For security, change their
|
---|
| 458 | owner before doing a simple copy to install them.
|
---|
[326f830] | 459 | </para>
|
---|
| 460 |
|
---|
[03d537cd] | 461 | </sect2>
|
---|
| 462 |
|
---|
[b05ea0b] | 463 | <sect2 role="configuration">
|
---|
| 464 | <title>Configuring Rust</title>
|
---|
| 465 |
|
---|
| 466 | <sect3 id="rustc-config">
|
---|
| 467 | <title>Configuration Information</title>
|
---|
| 468 |
|
---|
| 469 | <para>
|
---|
| 470 | If you installed <application>rustc</application> in
|
---|
| 471 | <filename class="directory">/opt</filename>, you need to update the
|
---|
| 472 | following configuration files so that <application>rustc</application> is
|
---|
| 473 | correctly found by other packages and system processes.
|
---|
| 474 | </para>
|
---|
| 475 |
|
---|
| 476 | <para>
|
---|
| 477 | As the <systemitem class="username">root</systemitem> user, update
|
---|
| 478 | the <filename>/etc/ld.so.conf</filename> file and the dynamic linker's
|
---|
| 479 | run-time cache file:
|
---|
| 480 | </para>
|
---|
| 481 |
|
---|
| 482 | <screen role="root"><userinput>cat >> /etc/ld.so.conf << EOF
|
---|
| 483 | <literal># Begin rustc addition
|
---|
| 484 |
|
---|
| 485 | /opt/rustc/lib
|
---|
| 486 |
|
---|
| 487 | # End rustc addition</literal>
|
---|
| 488 | EOF
|
---|
| 489 |
|
---|
| 490 | ldconfig</userinput></screen>
|
---|
| 491 |
|
---|
| 492 | <indexterm zone="rustc rustc-config">
|
---|
| 493 | <primary sortas="e-etc-ld.so.conf">/etc/ld.so.conf</primary>
|
---|
| 494 | </indexterm>
|
---|
| 495 |
|
---|
| 496 | <para>
|
---|
| 497 | As the <systemitem class="username">root</systemitem> user, create
|
---|
| 498 | the <filename>/etc/profile.d/rustc.sh</filename> file:
|
---|
| 499 | </para>
|
---|
| 500 |
|
---|
| 501 | <screen role="root"><userinput>cat > /etc/profile.d/rustc.sh << "EOF"
|
---|
| 502 | <literal># Begin /etc/profile.d/rustc.sh
|
---|
| 503 |
|
---|
| 504 | pathprepend /opt/rustc/bin PATH
|
---|
| 505 |
|
---|
| 506 | # End /etc/profile.d/rustc.sh</literal>
|
---|
| 507 | EOF</userinput></screen>
|
---|
| 508 |
|
---|
| 509 | <para>Immediately after installation, update the current PATH
|
---|
| 510 | for your current shell as a normal user:</para>
|
---|
| 511 |
|
---|
| 512 | <screen><userinput>source /etc/profile.d/rustc.sh</userinput></screen>
|
---|
| 513 |
|
---|
| 514 | </sect3>
|
---|
| 515 | </sect2>
|
---|
| 516 |
|
---|
| 517 |
|
---|
[03d537cd] | 518 | <sect2 role="content">
|
---|
| 519 | <title>Contents</title>
|
---|
| 520 |
|
---|
| 521 | <segmentedlist>
|
---|
[78399edc] | 522 | <segtitle>Installed Programs</segtitle>
|
---|
| 523 | <segtitle>Installed Libraries</segtitle>
|
---|
| 524 | <segtitle>Installed Directories</segtitle>
|
---|
[03d537cd] | 525 |
|
---|
| 526 | <seglistitem>
|
---|
| 527 | <seg>
|
---|
[4f9e45d9] | 528 | cargo-clippy, cargo-fmt, cargo-miri, cargo, clippy-driver, miri, rls, rust-gdb, rust-lldb, rustc, rustdoc, rustfmt.
|
---|
[03d537cd] | 529 | </seg>
|
---|
| 530 | <seg>
|
---|
[4c6edac] | 531 | Many lib*<16-byte-hash>.so libraries.
|
---|
[03d537cd] | 532 | </seg>
|
---|
| 533 | <seg>
|
---|
| 534 | ~/.cargo,
|
---|
[21699c7e] | 535 | /opt/rustc/lib/rustlib,
|
---|
| 536 | /opt/rustc/share/doc/rustc-&rust-version;, and
|
---|
| 537 | /opt/rustc/share/zsh/site-functions
|
---|
[03d537cd] | 538 | </seg>
|
---|
| 539 | </seglistitem>
|
---|
| 540 | </segmentedlist>
|
---|
| 541 |
|
---|
| 542 | <variablelist>
|
---|
| 543 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 544 | <?dbfo list-presentation="list"?>
|
---|
| 545 | <?dbhtml list-presentation="table"?>
|
---|
| 546 |
|
---|
[7d259126] | 547 | <varlistentry id="cargo-clippy">
|
---|
| 548 | <term><command>cargo-clippy</command></term>
|
---|
| 549 | <listitem>
|
---|
| 550 | <para>
|
---|
| 551 | provides lint checks for a cargo package.
|
---|
| 552 | </para>
|
---|
| 553 | <indexterm zone="rust cargo-clippy">
|
---|
| 554 | <primary sortas="b-cargo-clippy">cargo-clippy</primary>
|
---|
| 555 | </indexterm>
|
---|
| 556 | </listitem>
|
---|
| 557 | </varlistentry>
|
---|
| 558 |
|
---|
[a7b1bddc] | 559 | <varlistentry id="cargo-fmt">
|
---|
| 560 | <term><command>cargo-fmt</command></term>
|
---|
| 561 | <listitem>
|
---|
| 562 | <para>
|
---|
| 563 | formats all bin and lib files of the current crate using
|
---|
| 564 | rustfmt.
|
---|
| 565 | </para>
|
---|
| 566 | <indexterm zone="rust cargo-fmt">
|
---|
| 567 | <primary sortas="b-cargo-fmt">cargo-fmt</primary>
|
---|
| 568 | </indexterm>
|
---|
| 569 | </listitem>
|
---|
| 570 | </varlistentry>
|
---|
| 571 |
|
---|
[4f9e45d9] | 572 | <varlistentry id="cargo-miri">
|
---|
| 573 | <term><command>cargo-miri</command></term>
|
---|
| 574 | <listitem>
|
---|
| 575 | <para>
|
---|
| 576 | <!-- FIXME reword to 'is used by' if Miri installed
|
---|
| 577 | AND works enough to report its \-\-help -->
|
---|
| 578 | is for use by Miri to interpret bin crates and tests
|
---|
| 579 | </para>
|
---|
| 580 | <indexterm zone="rust cargo-miri">
|
---|
| 581 | <primary sortas="b-cargo-miri">cargo-miri</primary>
|
---|
| 582 | </indexterm>
|
---|
| 583 | </listitem>
|
---|
| 584 | </varlistentry>
|
---|
| 585 |
|
---|
[4c6edac] | 586 | <varlistentry id="cargo">
|
---|
| 587 | <term><command>cargo</command></term>
|
---|
| 588 | <listitem>
|
---|
| 589 | <para>
|
---|
| 590 | is the Package Manager for Rust.
|
---|
| 591 | </para>
|
---|
| 592 | <indexterm zone="rust cargo">
|
---|
| 593 | <primary sortas="b-cargo">cargo</primary>
|
---|
| 594 | </indexterm>
|
---|
| 595 | </listitem>
|
---|
| 596 | </varlistentry>
|
---|
| 597 |
|
---|
[7d259126] | 598 | <varlistentry id="clippy-driver">
|
---|
| 599 | <term><command>clippy-driver</command></term>
|
---|
| 600 | <listitem>
|
---|
| 601 | <para>
|
---|
| 602 | provides lint checks for Rust.
|
---|
| 603 | </para>
|
---|
| 604 | <indexterm zone="rust clippy-driver">
|
---|
| 605 | <primary sortas="b-clippy-driver">clippy-driver</primary>
|
---|
| 606 | </indexterm>
|
---|
| 607 | </listitem>
|
---|
| 608 | </varlistentry>
|
---|
| 609 |
|
---|
[4f9e45d9] | 610 | <varlistentry id="miri">
|
---|
| 611 | <term><command>miri</command></term>
|
---|
| 612 | <listitem>
|
---|
| 613 | <para>
|
---|
| 614 | is an interpreter for Rust's mid-level intermediate representation
|
---|
| 615 | (MIR). It is broken in this version.
|
---|
| 616 | </para>
|
---|
| 617 | <indexterm zone="rust miri">
|
---|
| 618 | <primary sortas="b-miri">miri</primary>
|
---|
| 619 | </indexterm>
|
---|
| 620 | </listitem>
|
---|
| 621 | </varlistentry>
|
---|
| 622 |
|
---|
[326f830] | 623 | <varlistentry id="rls">
|
---|
| 624 | <term><command>rls</command></term>
|
---|
| 625 | <listitem>
|
---|
| 626 | <para>
|
---|
| 627 | is the Rust Language Server. This can run in the background to
|
---|
| 628 | provide IDEs, editors, and other tools with information about Rust
|
---|
| 629 | programs.
|
---|
| 630 | </para>
|
---|
| 631 | <indexterm zone="rust rls">
|
---|
| 632 | <primary sortas="b-rls">rls</primary>
|
---|
| 633 | </indexterm>
|
---|
| 634 | </listitem>
|
---|
| 635 | </varlistentry>
|
---|
| 636 |
|
---|
[03d537cd] | 637 | <varlistentry id="rust-gdb">
|
---|
| 638 | <term><command>rust-gdb</command></term>
|
---|
| 639 | <listitem>
|
---|
| 640 | <para>
|
---|
[a7b1bddc] | 641 | is a wrapper script for gdb, pulling in Python
|
---|
| 642 | pretty-printing modules installed in <filename
|
---|
| 643 | class="directory">/usr/lib/rustlib/etc</filename>.
|
---|
[03d537cd] | 644 | </para>
|
---|
| 645 | <indexterm zone="rust rust-gdb">
|
---|
| 646 | <primary sortas="b-rust-gdb">rust-gdb</primary>
|
---|
| 647 | </indexterm>
|
---|
| 648 | </listitem>
|
---|
| 649 | </varlistentry>
|
---|
| 650 |
|
---|
| 651 | <varlistentry id="rust-lldb">
|
---|
| 652 | <term><command>rust-lldb</command></term>
|
---|
| 653 | <listitem>
|
---|
| 654 | <para>
|
---|
[a7b1bddc] | 655 | is a wrapper script for LLDB (the LLVM debugger)
|
---|
| 656 | pulling in the Python pretty-printing modules.
|
---|
[03d537cd] | 657 | </para>
|
---|
| 658 | <indexterm zone="rust rust-lldb">
|
---|
| 659 | <primary sortas="b-rust-lldb">rust=lldb</primary>
|
---|
| 660 | </indexterm>
|
---|
| 661 | </listitem>
|
---|
| 662 | </varlistentry>
|
---|
| 663 |
|
---|
| 664 | <varlistentry id="rustc">
|
---|
| 665 | <term><command>rustc</command></term>
|
---|
| 666 | <listitem>
|
---|
| 667 | <para>
|
---|
| 668 | is the rust compiler.
|
---|
| 669 | </para>
|
---|
| 670 | <indexterm zone="rust rustc">
|
---|
| 671 | <primary sortas="b-rustc">rustc</primary>
|
---|
| 672 | </indexterm>
|
---|
| 673 | </listitem>
|
---|
| 674 | </varlistentry>
|
---|
| 675 |
|
---|
| 676 | <varlistentry id="rustdoc">
|
---|
| 677 | <term><command>rustdoc</command></term>
|
---|
| 678 | <listitem>
|
---|
| 679 | <para>
|
---|
| 680 | generates documentation from rust source code.
|
---|
| 681 | </para>
|
---|
| 682 | <indexterm zone="rust rustdoc">
|
---|
| 683 | <primary sortas="b-rustdoc">rustdoc</primary>
|
---|
| 684 | </indexterm>
|
---|
| 685 | </listitem>
|
---|
| 686 | </varlistentry>
|
---|
| 687 |
|
---|
[a7b1bddc] | 688 | <varlistentry id="rustfmt">
|
---|
| 689 | <term><command>rustfmt</command></term>
|
---|
| 690 | <listitem>
|
---|
| 691 | <para>
|
---|
| 692 | formats rust code.
|
---|
| 693 | </para>
|
---|
| 694 | <indexterm zone="rust rustfmt">
|
---|
| 695 | <primary sortas="b-rustfmt">rustfmt</primary>
|
---|
| 696 | </indexterm>
|
---|
| 697 | </listitem>
|
---|
| 698 | </varlistentry>
|
---|
| 699 |
|
---|
[03d537cd] | 700 | <varlistentry id="libstd">
|
---|
| 701 | <term><filename class="libraryfile">libstd-<16-byte-hash>.so</filename></term>
|
---|
| 702 | <listitem>
|
---|
| 703 | <para>
|
---|
| 704 | is the Rust Standard Library, the foundation of portable Rust software.
|
---|
| 705 | </para>
|
---|
| 706 | <indexterm zone="rust libstd">
|
---|
| 707 | <primary sortas="c-libstd">libstd-<16-byte-hash>.so</primary>
|
---|
| 708 | </indexterm>
|
---|
| 709 | </listitem>
|
---|
| 710 | </varlistentry>
|
---|
| 711 | </variablelist>
|
---|
| 712 | </sect2>
|
---|
| 713 | </sect1>
|
---|