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