source: general/prog/rust.xml@ eab496c5

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since eab496c5 was 0a43695, checked in by Ken Moffat <ken@…>, 6 years ago

tags

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@19788 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 12.2 KB
Line 
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.gz">
8 <!ENTITY rust-download-ftp " ">
9 <!ENTITY rust-md5sum "7272ddba14f512e6d2612ef60460bed8">
10 <!ENTITY rust-size "53 MB">
11 <!ENTITY rust-buildsize "4.1 GB (437 MB installed), (add 1.2GB for tests) including 226MB of ~/.cargo files for both the builder and root (from the install)">
12 <!ENTITY rust-time "48 SBU (add 12 SBU for tests, both with 4 processors)">
13]>
14
15<sect1 id="rust" xreflabel="rustc-&rust-version;">
16 <?dbhtml filename="rust.html"?>
17
18 <sect1info>
19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
21 </sect1info>
22
23 <title>Rustc-&rust-version;</title>
24
25 <indexterm zone="rust">
26 <primary sortas="a-rust">Rust</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to Rust</title>
31
32 <para>
33 The <application>Rust</application> programming language is designed
34 to be a safe, concurrent, practical language.
35 </para>
36
37 <para>
38 As with many other programming languages, rustc (the rust compiler)
39 needs a binary from which to bootstrap. It will download a stage0 binary,
40 and several cargo files (these are actually .tar.gz source archives) at
41 the start of the build, so you cannot compile it without an internet
42 connection.
43 </para>
44
45 <para>
46 The current <application>rustbuild</application> build-system will use
47 all available processors, although it does not scale well and often falls
48 back to just using one core while waiting for a library to compile.
49 </para>
50
51 <para>
52 At the moment <application>Rust</application> does not provide any
53 guarantees of a stable ABI.
54 </para>
55
56 <note>
57 <para>
58 Repeated builds of this package on the same machine show a wide range
59 of build times. Some of this might be due to variations in downloading
60 the required cargo files if they are not already present, but this does
61 not seem to adequately explain the variations. Also, both the builder
62 and the user running the install will need to download the cargo crates
63 if they are not already present in <filename>~/.cargo</filename>.
64 </para>
65 <para>
66 If you use a DESTDIR method to install, you will only need to download
67 the crates once, for the build, saving about one-third of the build and
68 install time (but using extra space for the install). Similarly if you
69 were to build as root, or if your user is allowed to run <command>sudo
70 ./x.py install</command> - but those methods are dangerous.
71 </para>
72 </note>
73
74 &lfs82_checked;
75
76 <bridgehead renderas="sect3">Package Information</bridgehead>
77 <itemizedlist spacing="compact">
78 <listitem>
79 <para>
80 Download (HTTP): <ulink url="&rust-download-http;"/>
81 </para>
82 </listitem>
83 <listitem>
84 <para>
85 Download (FTP): <ulink url="&rust-download-ftp;"/>
86 </para>
87 </listitem>
88 <listitem>
89 <para>
90 Download MD5 sum: &rust-md5sum;
91 </para>
92 </listitem>
93 <listitem>
94 <para>
95 Download size: &rust-size;
96 </para>
97 </listitem>
98 <listitem>
99 <para>
100 Estimated disk space required: &rust-buildsize;
101 </para>
102 </listitem>
103 <listitem>
104 <para>
105 Estimated build time: &rust-time;
106 </para>
107 </listitem>
108 </itemizedlist>
109
110 <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
111
112 <bridgehead renderas="sect4">Required</bridgehead>
113 <para role="required">
114 <xref linkend="curl"/>,
115 <xref linkend="cmake"/>,
116<!-- if changing this to use python3, also add python2 as a required
117 dependency for firefox, because at the moment it picks that up from here -->
118 <xref linkend="python2"/>
119 </para>
120
121 <bridgehead renderas="sect4">Optional</bridgehead>
122 <para role="optional">
123 <xref linkend="gdb"/> (used by debuginfo-gdb in the testsuite)
124 </para>
125
126 <para condition="html" role="usernotes">
127 User Notes: <ulink url="&blfs-wiki;/rust"/>
128 </para>
129 </sect2>
130
131 <sect2 role="installation">
132 <title>Installation of Rust</title>
133
134 <note>
135 <para>
136 This package is updated on a six-weekly release cycle. Because it is
137 such a large and slow package to build, and is at the moment only used
138 by one package in this book, the BLFS editors take the view that it
139 should only be updated when that is necessary.
140 </para>
141 </note>
142
143 <para>
144 First create a suitable <filename>config.toml</filename> file
145 which will configure the build :
146 </para>
147
148<screen><userinput>cat &lt;&lt;EOF &gt; config.toml
149# see config.toml.example for more possible options
150[llvm]
151targets = "X86"
152
153[build]
154# install cargo as well as rust
155extended = true
156
157[install]
158prefix = "/usr"
159docdir = "share/doc/rustc-&rust-version;"
160
161[rust]
162channel = "stable"
163rpath = false
164EOF</userinput></screen>
165
166 <para>
167 Now install <application>Rust</application> by running the following
168 commands:
169 </para>
170
171<screen><userinput>./x.py build</userinput></screen>
172
173 <para>
174 To run the tests issue
175 <command>./x.py test --verbose --no-fail-fast &gt;../rustc-testlog</command>:
176 as with the build, that will use all available CPUs. This runs many suites
177 of tests (in an apparently random order), three may fail:
178 compile-fail/issue-37131.rs and run-make/target-without-atomics both try to
179 compile for the thumbv6m-none-eabi target, but the BLFS build does not cater for
180 that, and all 105 tests in debuginfo-gdb will fail if
181 <application>gdb</application> has not been installed. Several other tests in
182 run-make can also fail.
183 </para>
184
185 <para>
186 If you wish to look at the numbers for the results, you can find the total
187 number of tests which were considered by running:
188 </para>
189
190<screen><command>grep 'running .* tests' ../rustc-testlog | awk '{ sum += $2 } END { print sum }'</command></screen>
191
192 <para>
193 That should report 14854 tests. Similarly, the total tests which failed can
194 be found by running:
195 </para>
196
197<screen><command>grep '^test result:' ../rustc-testlog | awk '{ sum += $6 } END { print sum }'</command></screen>
198
199 <para>
200 And similarly for the tests which passed use $4, for those which were ignored
201 (i.e. skipped) use $8 (and $10 for 'measured', $12 for 'filtered out' but both
202 are probably zero). The breakdown does not match the overall total.
203 </para>
204
205 <para>
206 Now, as the <systemitem class="username">root</systemitem> user:
207 </para>
208
209<screen role="root"><userinput>./x.py install</userinput></screen>
210 </sect2>
211
212 <sect2 role="commands">
213 <title>Command Explanations</title>
214
215 <para>
216 <command>targets = "X86"</command>: this avoids building all the available
217 linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc).
218 </para>
219
220 <para>
221 <command>extended = true</command>: this installs Cargo alongside Rust.
222 </para>
223
224 <para>
225 <command>channel = "stable"</command>: this ensures only stable features
226 can be used, the default in <filename>config.toml</filename> is to use
227 development features, which is not appropriate for a released version.
228 </para>
229
230 <para>
231 <command>rpath = false</command>: by default, <command>rust</command> can
232 be run from where it was built, without being installed. That adds DT_RPATH
233 entries to all of the ELF files, which produces very messy output from
234 <command>ldd</command>, showing the libraries in the place they were built,
235 even if they have been deleted from there after the install.
236 </para>
237
238 <para>
239 <command>--verbose</command>: this switch can sometimes provide more
240 information about a test which fails.
241 </para>
242
243 <para>
244 <command>--no-fail-fast</command>: this switch ensures that the testsuite
245 will not stop at the first error.
246 </para>
247
248 <para>
249 <option>PYTHON=/usr/bin/python3 ... tee buildlog</option>: Because rust
250 can use <application>Python3</application> which was installed in LFS,
251 this command tells it to use that instead of the deprecated
252 <application>Python2</application>. For the moment this should be regarded
253 as experimental and problems may be encountered. Because
254 <application>rust</application> will use all CPUs, if an error happened the
255 message may have scrolled out of the terminal's buffer. Logging makes it
256 possible to find out what was reported.
257 </para>
258
259 </sect2>
260
261 <sect2 role="content">
262 <title>Contents</title>
263
264 <segmentedlist>
265 <segtitle>Installed Programs</segtitle>
266 <segtitle>Installed Libraries</segtitle>
267 <segtitle>Installed Directories</segtitle>
268
269 <seglistitem>
270 <seg>
271 cargo, rls, rust-gdb, rust-lldb, rustc, rustdoc.
272 </seg>
273 <seg>
274 Many lib*&lt;16-byte-hash&gt;.so libraries.
275 </seg>
276 <seg>
277 ~/.cargo,
278 /usr/lib/rustlib,
279 /usr/share/doc/rustc-&rust-version;, and
280 /usr/share/zsh/site-functions/
281 </seg>
282 </seglistitem>
283 </segmentedlist>
284
285 <variablelist>
286 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
287 <?dbfo list-presentation="list"?>
288 <?dbhtml list-presentation="table"?>
289
290 <varlistentry id="cargo">
291 <term><command>cargo</command></term>
292 <listitem>
293 <para>
294 is the Package Manager for Rust.
295 </para>
296 <indexterm zone="rust cargo">
297 <primary sortas="b-cargo">cargo</primary>
298 </indexterm>
299 </listitem>
300 </varlistentry>
301
302 <varlistentry id="rls">
303 <term><command>rls</command></term>
304 <listitem>
305 <para>
306 is the Rust Language Server. This can run in the background to
307 provide IDEs, editors, and other tools with information about Rust
308 programs.
309 </para>
310 <indexterm zone="rust rls">
311 <primary sortas="b-rls">rls</primary>
312 </indexterm>
313 </listitem>
314 </varlistentry>
315
316 <varlistentry id="rust-gdb">
317 <term><command>rust-gdb</command></term>
318 <listitem>
319 <para>
320 is a Python wrapper script for gdb.
321 </para>
322 <indexterm zone="rust rust-gdb">
323 <primary sortas="b-rust-gdb">rust-gdb</primary>
324 </indexterm>
325 </listitem>
326 </varlistentry>
327
328 <varlistentry id="rust-lldb">
329 <term><command>rust-lldb</command></term>
330 <listitem>
331 <para>
332 is a Python wrapper script for LLDB (the LLVM debugger).
333 </para>
334 <indexterm zone="rust rust-lldb">
335 <primary sortas="b-rust-lldb">rust=lldb</primary>
336 </indexterm>
337 </listitem>
338 </varlistentry>
339
340 <varlistentry id="rustc">
341 <term><command>rustc</command></term>
342 <listitem>
343 <para>
344 is the rust compiler.
345 </para>
346 <indexterm zone="rust rustc">
347 <primary sortas="b-rustc">rustc</primary>
348 </indexterm>
349 </listitem>
350 </varlistentry>
351
352 <varlistentry id="rustdoc">
353 <term><command>rustdoc</command></term>
354 <listitem>
355 <para>
356 generates documentation from rust source code.
357 </para>
358 <indexterm zone="rust rustdoc">
359 <primary sortas="b-rustdoc">rustdoc</primary>
360 </indexterm>
361 </listitem>
362 </varlistentry>
363
364 <varlistentry id="libstd">
365 <term><filename class="libraryfile">libstd-&lt;16-byte-hash&gt;.so</filename></term>
366 <listitem>
367 <para>
368 is the Rust Standard Library, the foundation of portable Rust software.
369 </para>
370 <indexterm zone="rust libstd">
371 <primary sortas="c-libstd">libstd-&lt;16-byte-hash&gt;.so</primary>
372 </indexterm>
373 </listitem>
374 </varlistentry>
375 </variablelist>
376 </sect2>
377</sect1>
Note: See TracBrowser for help on using the repository browser.