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