source: general/prog/rust.xml@ bf4b5fc

11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since bf4b5fc was bf4b5fc, checked in by Pierre Labastie <pierre.labastie@…>, 19 months ago

Update to rustc-1.64.0

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