source: general/prog/rust.xml@ 7b459c22

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/soup3 xry111/xf86-video-removal
Last change on this file since 7b459c22 was ed2176e5, checked in by Xi Ruoyao <xry111@…>, 21 months ago

rust: for systemd, tell how to use systemd-run to limit CPU cores

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