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