source: general/prog/rust.xml@ d7f9c0ec

12.1 12.2 gimp3 ken/TL2024 ken/tuningfonts lazarus plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/for-12.3 xry111/llvm18 xry111/spidermonkey128
Last change on this file since d7f9c0ec was d6b169d, checked in by Xi Ruoyao <xry111@…>, 12 months ago

rust: Adapt for LLVM 17 and note additional test failures

  • Property mode set to 100644
File size: 29.6 KB
RevLine 
[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 " ">
[808aeec]9 <!ENTITY rust-md5sum "4125b8bf1b0bc6a520f8ec21252322e7">
[cf983bd]10 <!ENTITY rust-size "145 MB">
[134f1cb]11 <!ENTITY rust-buildsize "8.9 GB (292 MB installed); add 6.4 GB if running the tests">
[1fd7593]12 <!ENTITY rust-time "6.7 SBU (including download time; add 6.2 SBU for tests, both using parallelism=8)">
[03d537cd]13]>
14
15<sect1 id="rust" xreflabel="rustc-&rust-version;">
16 <?dbhtml filename="rust.html"?>
17
18
19 <title>Rustc-&rust-version;</title>
20
21 <indexterm zone="rust">
22 <primary sortas="a-rust">Rust</primary>
23 </indexterm>
24
25 <sect2 role="package">
26 <title>Introduction to Rust</title>
27 <para>
28 The <application>Rust</application> programming language is designed
29 to be a safe, concurrent, practical language.
30 </para>
31
[25997c4a]32 <para>
33 This package is updated on a six-weekly release cycle. Because it is
[ec2353a]34 such a large and slow package to build, is at the moment only required
35 by a few packages in this book, and particularly because newer versions
36 tend to break older mozilla packages, the BLFS editors take the view that
37 it should only be updated when that is necessary (either to fix problems,
38 or to allow a new version of a package to build).
[25997c4a]39 </para>
40
[03d537cd]41 <para>
42 As with many other programming languages, rustc (the rust compiler)
[97e7219]43 needs a binary from which to bootstrap. It will download a stage0
44 binary at the start of the build, so you cannot compile it without an
45 Internet connection.
[25997c4a]46 </para>
47
48 <note>
49 <para>
[d396c65]50 Although BLFS usually installs in <filename
51 class="directory">/usr</filename>, when you later upgrade to a newer
52 version of <application>rust</application> the old libraries in <filename
53 class="directory">/usr/lib/rustlib</filename> will remain, with various
54 hashes in their names, but will not be usable and will waste space. The
55 editors recommend placing the files in the <filename
56 class="directory">/opt</filename> directory. In particular, if you
57 have reason to rebuild with a modified configuration (e.g. using the
[e7c8506a]58 shipped LLVM after building with shared LLVM, perhaps to compile crates
[ca97a2a]59 for architectures which the BLFS LLVM build does not support)
[e7c8506a]60 it is possible for the install to leave a broken
[d396c65]61 <command>cargo</command> program. In such a situation, either remove
62 the existing installation first, or use a different prefix such as
63 /opt/rustc-&rust-version;-build2.
[25997c4a]64 </para>
[b05ea0b]65
66 <para>
[d396c65]67 If you prefer, you can of course change the prefix to <filename
[97e7219]68 class="directory">/usr</filename>.
[b05ea0b]69 </para>
[25997c4a]70 </note>
71
[03d537cd]72 <para>
73 The current <application>rustbuild</application> build-system will use
[bf5fb94]74 all processors, although it does not scale well and often falls
[03d537cd]75 back to just using one core while waiting for a library to compile.
[5ce1bdb]76 However it can be mostly limited to a specified number of processors by
77 a combination of adding the switch <literal>--jobs &lt;N&gt;</literal>
78 (e.g. '--jobs 4' to limit to 4 processors) on each invocation of
[808aeec]79 <command>python3 x.py</command> <emphasis>and</emphasis> using an
[5ce1bdb]80 environment variable <envar>CARGO_BUILD_JOBS=&lt;N&gt;</envar>. At the
81 moment this is not effective when some of the rustc tests are run.
[03d537cd]82 </para>
83
[bf5fb94]84 <para>
85 The current version of rust's num_cpus crate now recognizes that cgroups
86 can be used to restrict which processors it is allowed to use. So if your
87 machine lacks DRAM (typically, less than 2GB DRAM per core) that might be
88 an alternative to taking CPUs offline.
[b6d54494]89 Read <xref linkend='build-in-cgroup'/> for how to use a cgroup.
[bf5fb94]90 </para>
91
[03d537cd]92 <para>
93 At the moment <application>Rust</application> does not provide any
[4c6edac]94 guarantees of a stable ABI.
[03d537cd]95 </para>
96
[326f830]97 <note>
[7d259126]98 <para>
99 Rustc defaults to building for ALL supported architectures, using a
[4f8ca94]100 shipped copy of LLVM. In BLFS the build is only for the X86
[925dbb2a]101 architecture.
[d396c65]102 If you intend to develop rust crates, this build may not be good
[b05ea0b]103 enough for your purposes.
[7d259126]104 </para>
[326f830]105 <para>
[4f9e45d9]106 The build times of this version when repeated on the same machine are
107 often reasonably consistent, but as with all compilations using
108 <command>rustc</command> there can be some very slow outliers.
[326f830]109 </para>
110 </note>
111
[282a0eb]112 &lfs120_checked;
[03d537cd]113
114 <bridgehead renderas="sect3">Package Information</bridgehead>
115 <itemizedlist spacing="compact">
116 <listitem>
117 <para>
118 Download (HTTP): <ulink url="&rust-download-http;"/>
119 </para>
120 </listitem>
121 <listitem>
122 <para>
123 Download (FTP): <ulink url="&rust-download-ftp;"/>
124 </para>
125 </listitem>
126 <listitem>
127 <para>
128 Download MD5 sum: &rust-md5sum;
129 </para>
130 </listitem>
131 <listitem>
132 <para>
133 Download size: &rust-size;
134 </para>
135 </listitem>
136 <listitem>
137 <para>
138 Estimated disk space required: &rust-buildsize;
139 </para>
140 </listitem>
141 <listitem>
142 <para>
143 Estimated build time: &rust-time;
144 </para>
145 </listitem>
146 </itemizedlist>
147
[ec2353a]148<!--<bridgehead renderas="sect3">Additional Downloads</bridgehead>
[d7e8f67]149 <itemizedlist spacing="compact">
150 <listitem>
151 <para>
152 Required patch:
153 <ulink url="&patch-root;/rustc-&rust-version;-llvm9_fixes-1.patch"/>
154 </para>
155 </listitem>
[ec2353a]156 </itemizedlist>-->
[d7e8f67]157
[03d537cd]158 <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
159
160 <bridgehead renderas="sect4">Required</bridgehead>
161 <para role="required">
[e59834d]162 <xref linkend="cmake"/> and
163 <!-- Required for downloading stage 0 binaries.
164 Otherwise it's recommended (if not installed, a vendored copy
165 will be built). -->
166 <xref linkend="curl"/>
[03d537cd]167 </para>
168
[afb71d0a]169 &build-use-internet;
170
[69d1a8e]171 <bridgehead renderas="sect4">Recommended</bridgehead>
[a7b1bddc]172 <para role="recommended">
[e59834d]173 <xref linkend="libssh2"/> and
[0daaefc8]174 <xref linkend="llvm"/>
[4f9e45d9]175 (built with -DLLVM_LINK_LLVM_DYLIB=ON so that rust can link to
[741231d]176 system LLVM instead of building its shipped version)
[69d1a8e]177 </para>
[a7b1bddc]178
[f2ae6ba8]179 <note>
180 <para>
181 If a recommended dependency is not installed, a shipped copy in the
182 Rustc source tarball will be built and used.
183 </para>
184 </note>
185
[03d537cd]186 <bridgehead renderas="sect4">Optional</bridgehead>
187 <para role="optional">
[08b315d]188 <xref linkend="gdb"/> (used by the test suite if it is present),
189 <xref linkend="git"/> (required by the test suite), and
[13d9cb6a]190 <ulink url='https://libgit2.org/'>libgit2</ulink>
[03d537cd]191 </para>
192
193 <para condition="html" role="usernotes">
[42ddc30]194 Editor Notes: <ulink url="&blfs-wiki;/rust"/>
[03d537cd]195 </para>
196 </sect2>
197
198 <sect2 role="installation">
199 <title>Installation of Rust</title>
200
[bf4b5fc]201 <note>
202 <para>
[8f9e533]203 Currently the rust compiler produces SSE2 instructions for 32-bit x86,
204 causing the generated code to be broken on 32-bit systems without a
[bf4b5fc]205 SSE2-capable processor. All x86 processor models released after
206 2004 should be SSE2-capable. Run
207 <command>lscpu | grep sse2</command> as a test. If it outputs
208 anything, your CPU is SSE2-capable and OK. Otherwise you may try
209 to build this package <emphasis>on a SSE2-capable system</emphasis>
210 with the following fix applied:
211 </para>
212
213 <!-- computeroutput used deliberately to stop anyone from copying
214 blindly -->
215<screen role="nodump"><computeroutput>sed 's@pentium4@pentiumpro@' -i \
216 compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs</computeroutput></screen>
217
218 <para>
219 And copy the resulting
220 <filename class="directory">/opt/rustc-&rust-version;</filename>
221 to the system without SSE2 capability. But this change is still
222 under upstream review and not tested by BLFS editors.
223 </para>
224 </note>
225
[03d537cd]226 <para>
[d396c65]227 To install into the
[7baeffe]228 <filename class="directory">/opt</filename> directory, remove any
229 existing <filename>/opt/rustc</filename> symlink
[d396c65]230 and create a new directory (i.e. with a different name if trying a
[7baeffe]231 modified build of the same version).
[4f9e45d9]232 As the <systemitem class="username">root</systemitem>
[b05ea0b]233 user:
234 </para>
235
[29c8a42]236<screen role="root"><userinput>mkdir -pv /opt/rustc-&rust-version; &amp;&amp;
[0bc808c]237ln -svfn rustc-&rust-version; /opt/rustc</userinput></screen>
[b05ea0b]238
239 <note>
240 <para>
241 If multiple versions of <application>Rust</application> are installed
242 in <filename class="directory">/opt</filename>, changing to another
243 version only requires changing the <filename> /opt/rustc</filename>
244 symbolic link and then running <command>ldconfig</command>.
245 </para>
246 </note>
247
248 <para>
249 Create a suitable <filename>config.toml</filename> file which will
[4f9e45d9]250 configure the build.
[4c6edac]251 </para>
252
[272f28b]253<screen><userinput>cat &lt;&lt; EOF &gt; config.toml
[51dfb3e]254<literal># see config.toml.example for more possible options
[7baeffe]255# See the 8.4 book for an old example using shipped LLVM
256# e.g. if not installing clang, or using a version before 13.0
257
258# tell x.py to not keep printing an annoying warning
259changelog-seen = 2
260
[4c6edac]261[llvm]
[4f9e45d9]262# by default, rust will build for a myriad of architectures
[25997c4a]263targets = "X86"
[4f9e45d9]264
[7f057ac]265# When using system llvm prefer shared libraries
266link-shared = true
267
[4c6edac]268[build]
[4f9e45d9]269# omit docs to save time and space (default is to build them)
[25997c4a]270docs = false
271
[7baeffe]272# install extended tools: cargo, clippy, etc
[4c6edac]273extended = true
274
[97e7219]275# Do not query new versions of dependencies online.
276locked-deps = true
277
[7baeffe]278# Specify which extended tools (those from the default install).
[24ecd679]279tools = ["cargo", "clippy", "rustdoc", "rustfmt"]
[7baeffe]280
[97e7219]281# Use the source code shipped in the tarball for the dependencies.
282# The combination of this and the "locked-deps" entry avoids downloading
283# many crates from Internet, and makes the Rustc build more stable.
284vendor = true
285
[4c6edac]286[install]
[ff803c4]287prefix = "/opt/rustc-&rust-version;"
288docdir = "share/doc/rustc-&rust-version;"
[326f830]289
290[rust]
[4c6edac]291channel = "stable"
[97e7219]292description = "for BLFS &version;"
[a7b1bddc]293
[7baeffe]294# BLFS used to not install the FileCheck executable from llvm,
295# so disabled codegen tests. The assembly tests rely on FileCheck
296# and cannot easily be disabled, so those will anyway fail if
297# FileCheck has not been installed.
298#codegen-tests = false
[a7b1bddc]299
[0f7f7c9]300[target.x86_64-unknown-linux-gnu]
301# NB the output of llvm-config (i.e. help options) may be
302# dumped to the screen when config.toml is parsed.
303llvm-config = "/usr/bin/llvm-config"
304
305[target.i686-unknown-linux-gnu]
306# NB the output of llvm-config (i.e. help options) may be
307# dumped to the screen when config.toml is parsed.
[808aeec]308llvm-config = "/usr/bin/llvm-config"</literal>
[4c6edac]309EOF</userinput></screen>
310
[d6b169d]311 <para>
312 Adapt rustc to allow it to build and function with the changes in
313 LLVM-17:
[d7e8f67]314 </para>
315
[d6b169d]316<screen><userinput remap="pre">sed 's/FS,/"", &amp;/' \
317 -i ./compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp &amp;&amp;
318sed '/LLVMContext.h/i#include "llvm/ADT/SmallString.h"' \
319 -i compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp</userinput></screen>
[d7e8f67]320
[4c6edac]321 <para>
[ec2353a]322 Compile <application>Rust</application> by running the following
[03d537cd]323 commands:
324 </para>
325
[ca97a2a]326<!-- fixed in 1.58.0, retain as a reminder that fixed crates can be used
[e7c8506a]327<screen><userinput>sed -i -e '/^curl /s/0.4.38/0.4.40/' \
328 -e '/^curl-sys /s/0.4.48/0.4.50/' \
[ca97a2a]329 src/tools/cargo/Cargo.toml &amp;&amp; -->
[e7c8506a]330
[7baeffe]331<screen><userinput>{ [ ! -e /usr/include/libssh2.h ] ||
[f2ae6ba8]332 export LIBSSH2_SYS_USE_PKG_CONFIG=1; } &amp;&amp;
[808aeec]333python3 x.py build</userinput></screen>
[a7b1bddc]334
[6bcd464]335 <note>
[a7b1bddc]336 <para>
[48771ae]337 The test suite will generate some messages in the
[a7b1bddc]338 <phrase revision="sysv">system log</phrase>
339 <phrase revision="systemd">systemd journal</phrase>
[6bcd464]340 for traps on invalid opcodes, and for segmentation faults.
[25997c4a]341 In themselves these are nothing to worry about, just a way for the
[4f9e45d9]342 test to be terminated.
[a7b1bddc]343 </para>
[6bcd464]344 </note>
[a7b1bddc]345
[03d537cd]346 <para>
[7baeffe]347 To run the tests (again using all available CPUs) issue:
[03d537cd]348 </para>
[f15d31df]349
[808aeec]350<screen remap="test"><userinput>mkdir -pv .github/workflows &amp;&amp;
351python3 x.py run src/tools/expand-yaml-anchors &amp;&amp;
352SSL_CERT_DIR=/etc/ssl/certs \
353python3 x.py test --verbose --no-fail-fast | tee rustc-testlog</userinput></screen>
[0c1c573]354
[d401fde]355 <!-- https://github.com/rust-lang/rust/issues/112209
356 I only saw 2 failures with 1.71.1, but Rainer saw 6 ones.
357 I don't want to find out the maximum number (by building rustc
358 in somewhere like /a/very/long/long/long/.../long/path) so I'd
359 just omit the exact number of failures here. -->
[0c1c573]360 <para>
[d401fde]361 Some <literal>ui</literal> tests may fail (the number of failures
362 depends on the length of the absolute path to the
[0c1c573]363 <filename class='directory'>rustc-&rust-version;-src</filename>
[d401fde]364 directory). These failures can be identified by viewing the
365 <filename>rustc-testlog</filename> file and search for the
366 <computeroutput>note: the full type name has been written
367 to</computeroutput>... messages and they can be safely ignored.
[0c1c573]368 </para>
[03d537cd]369
[d6b169d]370 <!-- https://github.com/rust-lang/rust/pull/115869 -->
371 <para>
372 The test named <filename>tests/ui/issues/issue-21763.rs</filename>
373 is known to fail.
374 </para>
375
376 <para>
377 With LLVM-17, the tests named
378 <!-- https://github.com/rust-lang/rust/issues/109671 -->
379 <filename>tests/ui/abi/stack-protector.rs</filename> and
380 <!-- https://github.com/rust-lang/rust/pull/105545 -->
381 <filename>tests/ui/dyn-star/llvm-old-style-ptrs.rs</filename> are
382 known to fail.
383 </para>
384
[03d537cd]385 <para>
[7baeffe]386 If <command>FileCheck</command> from <application>LLVM</application> has
387 not been installed, all 47 tests from the <quote>assembly</quote> suite
388 will fail.
[925dbb2a]389 </para>
390
[7e52a4a]391 <para>
392 On some systems, scripting the tests may result in the tests hanging on
393 <filename>test: combine_install_with_separate_uninstall</filename>. If
394 this happens, the problem can be worked around by pressing the Enter key.
395 The test can also be removed with:
396 </para>
397
398<screen role="nodump"><userinput>sed -e '/runtest combine_install_with/s/^/#/g' -i src/tools/rust-installer/test.sh</userinput></screen>
399
[925dbb2a]400 <para>
[48771ae]401 As with all large test suites, other tests might fail on some machines -
[320d985]402 if the number of additional failures is low,
[ca97a2a]403 check the log for 'failures:' and review lines above that, particularly the
[4f9e45d9]404 'stderr:' lines. Any mention of
[4cc77fbd]405 SIGSEGV or signal 11 in a failing test is a cause for concern.
[25997c4a]406 </para>
407
[b6ff745e]408 <para>
[69d1a8e]409 If you get any <emphasis>other</emphasis> failing test which reports an
410 issue number then you should search for that issue. For example, when
[bf5fb94]411 rustc &gt;= 1.41.1 was built with a version of sysllvm before 10.0 the test
[925dbb2a]412 for issue 69225 failed <ulink
[69d1a8e]413 url="https://github.com/rust-lang/rust/issues/69225"/> and that should be
[0f7f7c9]414 regarded as a critical failure (they released 1.41.1 because of it).
[69d1a8e]415 Most other failures will not be critical.
416 </para>
417
418 <para>
[bf5fb94]419 Therefore, you should determine the number of failures.
420 </para>
421
[03d537cd]422 <para>
[7baeffe]423 The number of tests which passed and failed can be found by running:
[03d537cd]424 </para>
425
[7baeffe]426<!-- split into two lines for narrower screen windows -->
427<screen remap="test"><userinput>grep '^test result:' rustc-testlog |
428 awk '{sum1 += $4; sum2 += $6} END { print sum1 " passed; " sum2 " failed" }'</userinput></screen>
[03d537cd]429
[4c6edac]430 <para>
[7baeffe]431 The other available fields are $8 for those which were ignored
432 (i.e. skipped), $10 for 'measured' and $12 for 'filtered out' but both
433 those last two are probably zero.
[4c6edac]434 </para>
435
436 <para>
[97e7219]437 Now, as the &root; user, install the package:
[4c6edac]438 </para>
439
[642fdb7]440 <note>
441 <para>
442 If <command>sudo</command> or <command>su</command> is invoked for
443 switching to the &root; user, ensure
444 <envar>LIBSSH2_SYS_USE_PKG_CONFIG</envar> is correctly passed or the
445 following command may completely rebuild this package. For
446 <command>sudo</command>, use the
447 <option>--preserve-env=LIBSSH2_SYS_USE_PKG_CONFIG</option> option.
448 For <command>su</command>, do <emphasis>not</emphasis> use the
449 <option>-</option> or <option>--login</option>.
450 </para>
451 </note>
452
[808aeec]453<screen role='root'><userinput>python3 x.py install</userinput></screen>
[a7b1bddc]454
[00e0c9cc]455 <!-- TODO: Report to upstream if this persists in the next release -->
456 <para>
457 The building system attempts to install some files twice, and during
458 the second attempt it renames the old one (installed in the first
459 attempt) with the <filename class='extension'>.old</filename> suffix.
460 As the &root; user, remove these files:
461 </para>
462
463 <screen role='root'><userinput>find /opt/rustc-&rust-version; -name "*.old" -delete</userinput></screen>
464
[c407a61f]465 <para>
466 Still as the &root; user, symlink a <application>Zsh</application>
467 completion file into the correct location:
468 </para>
469
470<screen role='root'><userinput>install -vdm755 /usr/share/zsh/site-functions &amp;&amp;
471ln -sfv /opt/rustc/share/zsh/site-functions/_cargo \
472 /usr/share/zsh/site-functions</userinput></screen>
473
[03d537cd]474 </sect2>
475
476 <sect2 role="commands">
[7baeffe]477 <title>Command Explanations</title>
[03d537cd]478
479 <para>
[d396c65]480 <command>ln -svfn rustc-&rust-version; /opt/rustc</command>: if this is
481 not the first use of the <filename class="directory">/opt/rustc</filename>
482 symlink, overwrite it by forcing, and use the '-n' flag to avoid getting
483 confusing results from e.g. <command>ls -l</command>.
484 </para>
485
486 <para>
[0c1c573]487 <literal>targets = "X86"</literal>: this avoids building all the available
[97e7219]488 linux cross-compilers (AArch64, MIPS, PowerPC, SystemZ, etc). Unfortunately,
[a7b1bddc]489 rust insists on installing source files for these below
[21699c7e]490 <filename class="directory">/opt/rustc/lib/src</filename>.
[03d537cd]491 </para>
492
493 <para>
[0c1c573]494 <literal>extended = true</literal>: this installs several tools
[97e7219]495 (specified by the <literal>tools</literal> entry) alongside
496 <command>rustc</command>.
[03d537cd]497 </para>
498
[7baeffe]499 <para>
[0c1c573]500 <literal>tools = ["cargo", "clippy", "rustdoc", "rustfmt"]</literal>:
[24ecd679]501 only build the tools from the 'default' profile in binary command
502 <command>rustup</command> which are recommended for most users.
503 The other tools are unlikely to be useful unless using (old) code
504 analyzers or editing the standard library.
[7baeffe]505 </para>
506
[03d537cd]507 <para>
[0c1c573]508 <literal>channel = "stable"</literal>: this ensures only stable features
[4c6edac]509 can be used, the default in <filename>config.toml</filename> is to use
510 development features, which is not appropriate for a released version.
[03d537cd]511 </para>
512
[5f1b4b5]513 <!-- comment while using shipped LLVM -->
[a7b1bddc]514 <para>
[0c1c573]515 <literal>[target.x86_64-unknown-linux-gnu]</literal>: the syntax of
[a7b1bddc]516 <filename>config.toml</filename> requires an <literal>llvm-config</literal>
517 entry for each target for which system-llvm is to be used. Change the target
518 to <literal>[target.i686-unknown-linux-gnu]</literal> if you are building
519 on 32-bit x86. This whole section may be omitted if you wish to build
520 against the shipped llvm, or do not have clang, but the resulting build will
[7d259126]521 be larger and take longer.
[5f1b4b5]522 </para>
[a7b1bddc]523
[ca97a2a]524<!--<para>
[e7c8506a]525 <command>sed -i -e '/^curl /s/0.4.38/0.4.40/' ... </command>: two crates
526 normally downloaded for this release do not correctly initialise
527 <application>curl</application> if using
528 <application>openssl-3.0.0</application>. Upstream has fixed that for a
529 future release, this sed causes the fixed versions to be used.
[ca97a2a]530 </para>-->
[e7c8506a]531
[7baeffe]532 <!-- https://github.com/alexcrichton/ssh2-rs/issues/173 -->
[bb0652ca]533 <para>
[7baeffe]534 <command>export LIBSSH2_SYS_USE_PKG_CONFIG=1</command>: Allow
535 <command>cargo</command> to link to system libssh2.
536 </para>
537
538<!--<para>
[bb0652ca]539 <command>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"</command>:
540 This adds a link to libffi to any RUSTFLAGS you may already be passing
541 to the build. On some systems, linking fails to include libffi unless
542 this is used. The reason why this is needed is not clear.
[7baeffe]543 2023-01-14 : assumed to be no longer needed, but it is some years
544 since one person reported needing this, keep it commented for the moment.
545 </para>-->
[bb0652ca]546
[0c1c573]547 <!-- https://github.com/alexcrichton/openssl-probe/issues/25 -->
548 <para>
549 <envar>SSL_CERT_DIR=/etc/ssl/certs</envar>: Work around an issue
550 causing test failures with the CA certificate store layout used by
551 <xref linkend='make-ca'/>.
552 </para>
553
[03d537cd]554 <para>
[0c1c573]555 <parameter>--verbose</parameter>: this switch can sometimes provide more
[4c6edac]556 information about a test which fails.
[03d537cd]557 </para>
[4c6edac]558
559 <para>
[0c1c573]560 <parameter>--no-fail-fast</parameter>: this switch ensures that the test suite
[4c6edac]561 will not stop at the first error.
562 </para>
563
[03d537cd]564 </sect2>
565
[b05ea0b]566 <sect2 role="configuration">
567 <title>Configuring Rust</title>
568
569 <sect3 id="rustc-config">
570 <title>Configuration Information</title>
571
572 <para>
573 If you installed <application>rustc</application> in
574 <filename class="directory">/opt</filename>, you need to update the
[de33b2a]575 following configuration files so that <application>rustc</application>
576 is correctly found by other packages and system processes.
[b05ea0b]577 </para>
578
579 <para>
580 As the <systemitem class="username">root</systemitem> user, create
581 the <filename>/etc/profile.d/rustc.sh</filename> file:
582 </para>
583
584<screen role="root"><userinput>cat &gt; /etc/profile.d/rustc.sh &lt;&lt; "EOF"
585<literal># Begin /etc/profile.d/rustc.sh
586
587pathprepend /opt/rustc/bin PATH
588
[8e305cf]589# Include /opt/rustc/man in the MANPATH variable to access manual pages
590pathappend /opt/rustc/share/man MANPATH
591
[b05ea0b]592# End /etc/profile.d/rustc.sh</literal>
593EOF</userinput></screen>
594
[de33b2a]595 <para>
[8558044]596 Immediately after installation, update the current PATH
[de33b2a]597 for your current shell as a normal user:
598 </para>
[b05ea0b]599
600<screen><userinput>source /etc/profile.d/rustc.sh</userinput></screen>
601
602 </sect3>
603 </sect2>
604
605
[03d537cd]606 <sect2 role="content">
607 <title>Contents</title>
608
609 <segmentedlist>
[78399edc]610 <segtitle>Installed Programs</segtitle>
611 <segtitle>Installed Libraries</segtitle>
612 <segtitle>Installed Directories</segtitle>
[03d537cd]613
[7baeffe]614 <seglistitem>
[03d537cd]615 <seg>
[7baeffe]616 cargo-clippy, cargo-fmt, cargo, clippy-driver, rust-gdb,
[bf4b5fc]617 rust-gdbgui, rust-lldb, rustc, rustdoc, and rustfmt
[03d537cd]618 </seg>
619 <seg>
[3e8c126]620 librustc-driver-&lt;16-byte-hash&gt;.so,
621 libstd-&lt;16-byte-hash&gt;.so, and
622 libtest-&lt;16-byte-hash&gt;.so
[03d537cd]623 </seg>
624 <seg>
625 ~/.cargo,
[3e8c126]626 /opt/rustc, symbolic link to
627 /opt/rustc-&rust-version;
[03d537cd]628 </seg>
629 </seglistitem>
630 </segmentedlist>
631
632 <variablelist>
633 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
634 <?dbfo list-presentation="list"?>
635 <?dbhtml list-presentation="table"?>
636
[7d259126]637 <varlistentry id="cargo-clippy">
638 <term><command>cargo-clippy</command></term>
639 <listitem>
640 <para>
[4c24eb0a]641 provides lint checks for a cargo package
[7d259126]642 </para>
643 <indexterm zone="rust cargo-clippy">
644 <primary sortas="b-cargo-clippy">cargo-clippy</primary>
645 </indexterm>
646 </listitem>
647 </varlistentry>
648
[a7b1bddc]649 <varlistentry id="cargo-fmt">
650 <term><command>cargo-fmt</command></term>
651 <listitem>
652 <para>
653 formats all bin and lib files of the current crate using
[4c24eb0a]654 rustfmt
[a7b1bddc]655 </para>
656 <indexterm zone="rust cargo-fmt">
657 <primary sortas="b-cargo-fmt">cargo-fmt</primary>
658 </indexterm>
659 </listitem>
660 </varlistentry>
661
[7baeffe]662<!-- <varlistentry id="cargo-miri">
[4f9e45d9]663 <term><command>cargo-miri</command></term>
664 <listitem>
665 <para>
[bf4b5fc]666 is for use by Miri to interpret bin crates and tests. It is
667 not installed by default.
[4f9e45d9]668 </para>
669 <indexterm zone="rust cargo-miri">
670 <primary sortas="b-cargo-miri">cargo-miri</primary>
671 </indexterm>
672 </listitem>
[7baeffe]673 </varlistentry>-->
[4f9e45d9]674
[4c6edac]675 <varlistentry id="cargo">
676 <term><command>cargo</command></term>
677 <listitem>
678 <para>
[4c24eb0a]679 is the Package Manager for Rust
[4c6edac]680 </para>
681 <indexterm zone="rust cargo">
682 <primary sortas="b-cargo">cargo</primary>
683 </indexterm>
684 </listitem>
685 </varlistentry>
686
[7d259126]687 <varlistentry id="clippy-driver">
688 <term><command>clippy-driver</command></term>
689 <listitem>
690 <para>
[4c24eb0a]691 provides lint checks for Rust
[7d259126]692 </para>
693 <indexterm zone="rust clippy-driver">
694 <primary sortas="b-clippy-driver">clippy-driver</primary>
695 </indexterm>
696 </listitem>
697 </varlistentry>
698
[7baeffe]699<!-- <varlistentry id="miri">
[4f9e45d9]700 <term><command>miri</command></term>
701 <listitem>
702 <para>
703 is an interpreter for Rust's mid-level intermediate representation
[bf4b5fc]704 (MIR). It is not installed by default.
[4f9e45d9]705 </para>
706 <indexterm zone="rust miri">
707 <primary sortas="b-miri">miri</primary>
708 </indexterm>
709 </listitem>
710 </varlistentry>
711
[326f830]712 <varlistentry id="rls">
713 <term><command>rls</command></term>
714 <listitem>
715 <para>
716 is the Rust Language Server. This can run in the background to
717 provide IDEs, editors, and other tools with information about Rust
[4c24eb0a]718 programs
[326f830]719 </para>
720 <indexterm zone="rust rls">
721 <primary sortas="b-rls">rls</primary>
722 </indexterm>
723 </listitem>
724 </varlistentry>
725
[f78dbb74]726 <varlistentry id="rust-analyzer">
727 <term><command>rust-analyzer</command></term>
728 <listitem>
729 <para>
730 is an implementation of Language Server Protocol for the Rust
731 programming language.
732 </para>
733 <indexterm zone="rust rust-analyzer">
734 <primary sortas="b-rust-analyzer">rust-analyzer</primary>
735 </indexterm>
736 </listitem>
737 </varlistentry>
738
[bf4b5fc]739 <varlistentry id="rust-demangler">
740 <term><command>rust-demangler</command></term>
741 <listitem>
742 <para>
743 converts a list of Rust mangled symbols into a
744 corresponding list of demangled symbols
745 </para>
746 <indexterm zone="rust rust-demangler">
747 <primary sortas="b-rust-demangler">rust-demangler</primary>
748 </indexterm>
749 </listitem>
[7baeffe]750 </varlistentry> -->
[bf4b5fc]751
[03d537cd]752 <varlistentry id="rust-gdb">
753 <term><command>rust-gdb</command></term>
754 <listitem>
755 <para>
[4c24eb0a]756 is a wrapper script for gdb, pulling in Python pretty-printing
757 modules installed in
758 <filename class="directory">/opt/rustc-&rust-version;/lib/rustlib/etc</filename>
[03d537cd]759 </para>
760 <indexterm zone="rust rust-gdb">
761 <primary sortas="b-rust-gdb">rust-gdb</primary>
762 </indexterm>
763 </listitem>
764 </varlistentry>
765
[ec2353a]766 <varlistentry id="rust-gdbgui">
767 <term><command>rust-gdbgui</command></term>
768 <listitem>
769 <para>
770 is a wrapper script for a graphical front end to gdb that runs in a
[4c24eb0a]771 browser
[ec2353a]772 </para>
773 <indexterm zone="rust rust-gdbgui">
774 <primary sortas="b-rust-gdbgui">rust-gdbgui</primary>
775 </indexterm>
776 </listitem>
777 </varlistentry>
778
[03d537cd]779 <varlistentry id="rust-lldb">
780 <term><command>rust-lldb</command></term>
781 <listitem>
782 <para>
[a7b1bddc]783 is a wrapper script for LLDB (the LLVM debugger)
[4c24eb0a]784 pulling in the Python pretty-printing modules
[03d537cd]785 </para>
786 <indexterm zone="rust rust-lldb">
787 <primary sortas="b-rust-lldb">rust=lldb</primary>
788 </indexterm>
789 </listitem>
790 </varlistentry>
791
792 <varlistentry id="rustc">
793 <term><command>rustc</command></term>
794 <listitem>
795 <para>
[4c24eb0a]796 is the rust compiler
[03d537cd]797 </para>
798 <indexterm zone="rust rustc">
799 <primary sortas="b-rustc">rustc</primary>
800 </indexterm>
801 </listitem>
802 </varlistentry>
803
804 <varlistentry id="rustdoc">
805 <term><command>rustdoc</command></term>
806 <listitem>
807 <para>
[4c24eb0a]808 generates documentation from rust source code
[03d537cd]809 </para>
810 <indexterm zone="rust rustdoc">
811 <primary sortas="b-rustdoc">rustdoc</primary>
812 </indexterm>
813 </listitem>
814 </varlistentry>
815
[a7b1bddc]816 <varlistentry id="rustfmt">
817 <term><command>rustfmt</command></term>
818 <listitem>
819 <para>
[4c24eb0a]820 formats rust code
[a7b1bddc]821 </para>
822 <indexterm zone="rust rustfmt">
823 <primary sortas="b-rustfmt">rustfmt</primary>
824 </indexterm>
825 </listitem>
826 </varlistentry>
827
[03d537cd]828 <varlistentry id="libstd">
829 <term><filename class="libraryfile">libstd-&lt;16-byte-hash&gt;.so</filename></term>
830 <listitem>
831 <para>
[4c24eb0a]832 is the Rust Standard Library, the foundation of portable Rust software
[03d537cd]833 </para>
834 <indexterm zone="rust libstd">
835 <primary sortas="c-libstd">libstd-&lt;16-byte-hash&gt;.so</primary>
836 </indexterm>
837 </listitem>
838 </varlistentry>
839 </variablelist>
840 </sect2>
[4c24eb0a]841
[03d537cd]842</sect1>
Note: See TracBrowser for help on using the repository browser.