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