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