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