source: general/prog/rust.xml@ 622cc86e

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 622cc86e was 13d9cb6a, checked in by Xi Ruoyao <xry111@…>, 21 months ago

rustc: list libgit2 as external dependency

We are using internally shipped libgit2 for now.

  • Property mode set to 100644
File size: 30.0 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">
[87065037]18 <!ENTITY rust-time "21 SBU (including download time; add 10 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">
[f2ae6ba8]203 <xref linkend="cmake"/>
[03d537cd]204 </para>
205
[69d1a8e]206 <bridgehead renderas="sect4">Recommended</bridgehead>
[a7b1bddc]207 <para role="recommended">
[f2ae6ba8]208 <xref linkend="curl"/>,
209 <xref linkend="libssh2"/>, and
[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
[f2ae6ba8]215 <note>
216 <para>
217 If a recommended dependency is not installed, a shipped copy in the
218 Rustc source tarball will be built and used.
219 </para>
220 </note>
221
[03d537cd]222 <bridgehead renderas="sect4">Optional</bridgehead>
223 <para role="optional">
[13d9cb6a]224 <xref linkend="gdb"/> (used by the testsuite if it is present) and
225 <ulink url='https://libgit2.org/'>libgit2</ulink>
[03d537cd]226 </para>
227
228 <para condition="html" role="usernotes">
229 User Notes: <ulink url="&blfs-wiki;/rust"/>
230 </para>
231 </sect2>
232
233 <sect2 role="installation">
234 <title>Installation of Rust</title>
235
[bf4b5fc]236 <note>
237 <para>
238 Currently Rust compiler produces SSE2 instructions for 32-bit x86,
239 causing the generated code broken on 32-bit systems without a
240 SSE2-capable processor. All x86 processor models released after
241 2004 should be SSE2-capable. Run
242 <command>lscpu | grep sse2</command> as a test. If it outputs
243 anything, your CPU is SSE2-capable and OK. Otherwise you may try
244 to build this package <emphasis>on a SSE2-capable system</emphasis>
245 with the following fix applied:
246 </para>
247
248 <!-- computeroutput used deliberately to stop anyone from copying
249 blindly -->
250<screen role="nodump"><computeroutput>sed 's@pentium4@pentiumpro@' -i \
251 compiler/rustc_target/src/spec/i686_unknown_linux_gnu.rs</computeroutput></screen>
252
253 <para>
254 And copy the resulting
255 <filename class="directory">/opt/rustc-&rust-version;</filename>
256 to the system without SSE2 capability. But this change is still
257 under upstream review and not tested by BLFS editors.
258 </para>
259 </note>
260
[03d537cd]261 <para>
[d396c65]262 To install into the
263 <filename class="directory">/opt</filename> directory, remove the symlink
264 and create a new directory (i.e. with a different name if trying a
265 modified build).
[4f9e45d9]266 As the <systemitem class="username">root</systemitem>
[b05ea0b]267 user:
268 </para>
269
[d396c65]270<screen role="root"><userinput>mkdir /opt/rustc-&rust-version; &amp;&amp;
[0bc808c]271ln -svfn rustc-&rust-version; /opt/rustc</userinput></screen>
[b05ea0b]272
273 <note>
274 <para>
275 If multiple versions of <application>Rust</application> are installed
276 in <filename class="directory">/opt</filename>, changing to another
277 version only requires changing the <filename> /opt/rustc</filename>
278 symbolic link and then running <command>ldconfig</command>.
279 </para>
280 </note>
281
282 <para>
283 Create a suitable <filename>config.toml</filename> file which will
[4f9e45d9]284 configure the build.
[4c6edac]285 </para>
286
[272f28b]287<screen><userinput>cat &lt;&lt; EOF &gt; config.toml
[51dfb3e]288<literal># see config.toml.example for more possible options
[69d1a8e]289# See the 8.4 book for an example using shipped LLVM
290# e.g. if not installing clang, or using a version before 10.0
[4c6edac]291[llvm]
[4f9e45d9]292# by default, rust will build for a myriad of architectures
[25997c4a]293targets = "X86"
[4f9e45d9]294
[7f057ac]295# When using system llvm prefer shared libraries
296link-shared = true
297
[4c6edac]298[build]
[4f9e45d9]299# omit docs to save time and space (default is to build them)
[25997c4a]300docs = false
301
[4c6edac]302# install cargo as well as rust
303extended = true
304
305[install]
[ff803c4]306prefix = "/opt/rustc-&rust-version;"
307docdir = "share/doc/rustc-&rust-version;"
[326f830]308
309[rust]
[4c6edac]310channel = "stable"
[326f830]311rpath = false
[a7b1bddc]312
313# BLFS does not install the FileCheck executable from llvm,
314# so disable codegen tests
315codegen-tests = false
316
[0f7f7c9]317[target.x86_64-unknown-linux-gnu]
318# NB the output of llvm-config (i.e. help options) may be
319# dumped to the screen when config.toml is parsed.
320llvm-config = "/usr/bin/llvm-config"
321
322[target.i686-unknown-linux-gnu]
323# NB the output of llvm-config (i.e. help options) may be
324# dumped to the screen when config.toml is parsed.
325llvm-config = "/usr/bin/llvm-config"
326
[51dfb3e]327</literal>
[4c6edac]328EOF</userinput></screen>
329
[ec2353a]330<!--<para>
[d7e8f67]331 Adapt rustc to allow it to build and function with the changes in LLVM-9:
332 </para>
333
[ec2353a]334<screen><userinput remap="pre">patch -Np1 -i ../rustc-&rust-version;-llvm9_fixes-1.patch</userinput></screen>-->
[d7e8f67]335
[4c6edac]336 <para>
[ec2353a]337 Compile <application>Rust</application> by running the following
[03d537cd]338 commands:
339 </para>
340
[ca97a2a]341<!-- fixed in 1.58.0, retain as a reminder that fixed crates can be used
[e7c8506a]342<screen><userinput>sed -i -e '/^curl /s/0.4.38/0.4.40/' \
343 -e '/^curl-sys /s/0.4.48/0.4.50/' \
[ca97a2a]344 src/tools/cargo/Cargo.toml &amp;&amp; -->
[e7c8506a]345
[ca97a2a]346<screen><userinput>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &amp;&amp;
[f2ae6ba8]347{ [ ! -e /usr/include/libssh2.h ] ||
348 export LIBSSH2_SYS_USE_PKG_CONFIG=1; } &amp;&amp;
[4f8ca94]349python3 ./x.py build --exclude src/tools/miri</userinput></screen>
[a7b1bddc]350
[6bcd464]351 <note>
[a7b1bddc]352 <para>
[6bcd464]353 The testsuite will generate some messages in the
[a7b1bddc]354 <phrase revision="sysv">system log</phrase>
355 <phrase revision="systemd">systemd journal</phrase>
[6bcd464]356 for traps on invalid opcodes, and for segmentation faults.
[25997c4a]357 In themselves these are nothing to worry about, just a way for the
[4f9e45d9]358 test to be terminated.
[a7b1bddc]359 </para>
[6bcd464]360 </note>
[a7b1bddc]361
[03d537cd]362 <para>
[4f8ca94]363 To run the tests issue <command>python3 ./x.py test --verbose
364 --no-fail-fast | tee rustc-testlog</command>: as with the build, that
365 will use all available CPUs.
[03d537cd]366 </para>
367
368 <para>
[bf4b5fc]369 At a minimum, 51 tests will fail: all 46 of the tests in
[ca97a2a]370 the <quote>assembly</quote> suite which are not skipped (various lints
371 cause the warnings in these tests to be treated as errors), and
[bf4b5fc]372 5 other tests, 4 of which involve the
373 <filename>rustdoc-ui/issue-98690.rs</filename> file, and another one,
374 <filename>run-make-fulldeps/long-linker-command-lines</filename>.
[ca97a2a]375<!-- If <command>gdb</command> is installed, another failure
[3e8c126]376 (debuginfo/function-names.rs) can be expected.
[ca97a2a]377 # seems ok with 11.2 ken -->
[925dbb2a]378 </para>
379
380 <para>
381 As with all large testsuites, other tests might fail on some machines -
382 if the number of additional failures is in the single digits,
[ca97a2a]383 check the log for 'failures:' and review lines above that, particularly the
[4f9e45d9]384 'stderr:' lines. Any mention of
[4cc77fbd]385 SIGSEGV or signal 11 in a failing test is a cause for concern.
[25997c4a]386 </para>
387
[b6ff745e]388 <para>
[69d1a8e]389 If you get any <emphasis>other</emphasis> failing test which reports an
390 issue number then you should search for that issue. For example, when
[bf5fb94]391 rustc &gt;= 1.41.1 was built with a version of sysllvm before 10.0 the test
[925dbb2a]392 for issue 69225 failed <ulink
[69d1a8e]393 url="https://github.com/rust-lang/rust/issues/69225"/> and that should be
[0f7f7c9]394 regarded as a critical failure (they released 1.41.1 because of it).
[69d1a8e]395 Most other failures will not be critical.
396 </para>
397
398 <para>
[bf5fb94]399 Therefore, you should determine the number of failures.
400 </para>
401
402<!--
403 The total number
[69d1a8e]404 of tests varies depending on which dependencies are present, e.g. more
405 will be run if <command>gdb</command> is available. If you wish, the
406 total number which were considered can be found if you run:
[03d537cd]407 </para>
408
[bf5fb94]409<screen remap="test"><userinput>egrep 'running [[:digit:]]+ test' rustc-testlog | awk '{ sum += $2 } END { print sum }'</userinput></screen>-->
[4c6edac]410
[03d537cd]411 <para>
[bf5fb94]412 The number of tests which failed can be found by running:
[03d537cd]413 </para>
414
[e7d4e823]415<screen remap="test"><userinput>grep '^test result:' rustc-testlog | awk '{ sum += $6 } END { print sum }'</userinput></screen>
[03d537cd]416
[4c6edac]417 <para>
[69d1a8e]418 And similarly if you care about how many tests passed use $4, for those
419 which were ignored (i.e. skipped) use $8 (and $10 for 'measured', $12 for
420 'filtered out' but both are probably zero).
[4c6edac]421 </para>
422
423 <para>
[a7b1bddc]424 Still as your normal user, do a DESTDIR install:
[4c6edac]425 </para>
426
[f2ae6ba8]427<screen><userinput>DESTDIR=${PWD}/install python3 ./x.py install &amp;&amp;
[fb940713]428unset LIBSSH2_SYS_USE_PKG_CONFIG</userinput></screen>
[a7b1bddc]429
430 <para>
431 Now, as the <systemitem class="username">root</systemitem> user
432 install the files from the DESTDIR:
433 </para>
434
[bb0652ca]435<screen role="root"><userinput>chown -R root:root install &amp;&amp;
436cp -a install/* /</userinput></screen>
[a7b1bddc]437
[03d537cd]438 </sect2>
439
440 <sect2 role="commands">
441 <title>Command Explanations</title>
442
443 <para>
[d396c65]444 <command>ln -svfn rustc-&rust-version; /opt/rustc</command>: if this is
445 not the first use of the <filename class="directory">/opt/rustc</filename>
446 symlink, overwrite it by forcing, and use the '-n' flag to avoid getting
447 confusing results from e.g. <command>ls -l</command>.
448 </para>
449
450 <para>
[4c6edac]451 <command>targets = "X86"</command>: this avoids building all the available
[a7b1bddc]452 linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc). Unfortunately,
453 rust insists on installing source files for these below
[21699c7e]454 <filename class="directory">/opt/rustc/lib/src</filename>.
[03d537cd]455 </para>
456
457 <para>
[4c6edac]458 <command>extended = true</command>: this installs Cargo alongside Rust.
[03d537cd]459 </para>
460
461 <para>
[4c6edac]462 <command>channel = "stable"</command>: this ensures only stable features
463 can be used, the default in <filename>config.toml</filename> is to use
464 development features, which is not appropriate for a released version.
[03d537cd]465 </para>
466
[326f830]467 <para>
468 <command>rpath = false</command>: by default, <command>rust</command> can
469 be run from where it was built, without being installed. That adds DT_RPATH
470 entries to all of the ELF files, which produces very messy output from
471 <command>ldd</command>, showing the libraries in the place they were built,
472 even if they have been deleted from there after the install.
473 </para>
474
[5f1b4b5]475 <!-- comment while using shipped LLVM -->
[a7b1bddc]476 <para>
477 <command>[target.x86_64-unknown-linux-gnu]</command>: the syntax of
478 <filename>config.toml</filename> requires an <literal>llvm-config</literal>
479 entry for each target for which system-llvm is to be used. Change the target
480 to <literal>[target.i686-unknown-linux-gnu]</literal> if you are building
481 on 32-bit x86. This whole section may be omitted if you wish to build
482 against the shipped llvm, or do not have clang, but the resulting build will
[7d259126]483 be larger and take longer.
[5f1b4b5]484 </para>
[a7b1bddc]485
[ca97a2a]486<!--<para>
[e7c8506a]487 <command>sed -i -e '/^curl /s/0.4.38/0.4.40/' ... </command>: two crates
488 normally downloaded for this release do not correctly initialise
489 <application>curl</application> if using
490 <application>openssl-3.0.0</application>. Upstream has fixed that for a
491 future release, this sed causes the fixed versions to be used.
[ca97a2a]492 </para>-->
[e7c8506a]493
[bb0652ca]494 <para>
495 <command>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"</command>:
496 This adds a link to libffi to any RUSTFLAGS you may already be passing
497 to the build. On some systems, linking fails to include libffi unless
498 this is used. The reason why this is needed is not clear.
499 </para>
500
[25997c4a]501 <para>
502 <command>--exclude src/tools/miri</command>: For a long time, the miri
503 crate (an interpreter for the Midlevel Intermediate Representation)
504 has failed to build on releases. It is optional, but the failure
[4f9e45d9]505 messages can persuade people that the whole build failed. However,
506 although it is not built in the main compile, with rustc-1.35.0 it
[925dbb2a]507 now got compiled during the install, but it was broken in that version.
[4f9e45d9]508 <!-- might be unbroken in 1.36.0, if so remove broken from description
509 of miri below. https://github.com/rust-lang/rust/issues/61830 -->
[bf4b5fc]510 Omitting it should save a little time. Even if this switch is
511 not given, miri is not installed.
[25997c4a]512 </para>
513
[03d537cd]514 <para>
[4c6edac]515 <command>--verbose</command>: this switch can sometimes provide more
516 information about a test which fails.
[03d537cd]517 </para>
[4c6edac]518
519 <para>
520 <command>--no-fail-fast</command>: this switch ensures that the testsuite
521 will not stop at the first error.
522 </para>
523
[f2ae6ba8]524 <!-- https://github.com/alexcrichton/ssh2-rs/issues/173 -->
[fb940713]525 <para>
[f2ae6ba8]526 <command>export LIBSSH2_SYS_USE_PKG_CONFIG=1</command>: Allow
527 <command>cargo</command> to link to system libssh2.
[fb940713]528 </para>
529
[326f830]530 <para>
[4f8ca94]531 <command>DESTDIR=${PWD}/install python3 ./x.py install</command>: This
532 effects a DESTDIR-style install in the source tree,creating an <filename
[bb0652ca]533 class="directory">install</filename> directory. Note that DESTDIR installs
534 need an absolute path, passing 'install' will not work.
[a7b1bddc]535 </para>
536
537 <para>
[bb0652ca]538 <command>chown -R root:root install</command>: the DESTDIR install
[a7b1bddc]539 was run by a regular user, who owns the files. For security, change their
540 owner before doing a simple copy to install them.
[326f830]541 </para>
542
[03d537cd]543 </sect2>
544
[b05ea0b]545 <sect2 role="configuration">
546 <title>Configuring Rust</title>
547
548 <sect3 id="rustc-config">
549 <title>Configuration Information</title>
550
551 <para>
552 If you installed <application>rustc</application> in
553 <filename class="directory">/opt</filename>, you need to update the
[de33b2a]554 following configuration files so that <application>rustc</application>
555 is correctly found by other packages and system processes.
[b05ea0b]556 </para>
557
558 <para>
559 As the <systemitem class="username">root</systemitem> user, update
560 the <filename>/etc/ld.so.conf</filename> file and the dynamic linker's
561 run-time cache file:
562 </para>
563
564<screen role="root"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; EOF
565<literal># Begin rustc addition
566
567/opt/rustc/lib
568
569# End rustc addition</literal>
570EOF
571
572ldconfig</userinput></screen>
573
[f16e76c6]574 <indexterm zone="rust rustc-config">
[b05ea0b]575 <primary sortas="e-etc-ld.so.conf">/etc/ld.so.conf</primary>
576 </indexterm>
577
578 <para>
579 As the <systemitem class="username">root</systemitem> user, create
580 the <filename>/etc/profile.d/rustc.sh</filename> file:
581 </para>
582
583<screen role="root"><userinput>cat &gt; /etc/profile.d/rustc.sh &lt;&lt; "EOF"
584<literal># Begin /etc/profile.d/rustc.sh
585
586pathprepend /opt/rustc/bin PATH
587
[8e305cf]588# Include /opt/rustc/man in the MANPATH variable to access manual pages
589pathappend /opt/rustc/share/man MANPATH
590
[b05ea0b]591# End /etc/profile.d/rustc.sh</literal>
592EOF</userinput></screen>
593
[de33b2a]594 <para>
[8558044]595 Immediately after installation, update the current PATH
[de33b2a]596 for your current shell as a normal user:
597 </para>
[b05ea0b]598
599<screen><userinput>source /etc/profile.d/rustc.sh</userinput></screen>
600
601 </sect3>
602 </sect2>
603
604
[03d537cd]605 <sect2 role="content">
606 <title>Contents</title>
607
608 <segmentedlist>
[78399edc]609 <segtitle>Installed Programs</segtitle>
610 <segtitle>Installed Libraries</segtitle>
611 <segtitle>Installed Directories</segtitle>
[03d537cd]612
613 <seglistitem>
614 <seg>
[3e8c126]615 cargo-clippy, cargo-fmt, cargo-miri (optional), cargo, clippy-driver,
[bf4b5fc]616 miri (optional), rls, rust-analyzer, rust-demangler, rust-gdb,
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
[4f9e45d9]662 <varlistentry id="cargo-miri">
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>
673 </varlistentry>
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
[4f9e45d9]699 <varlistentry id="miri">
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>
750 </varlistentry>
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.