source: general/prog/rust.xml@ 4c6edac

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 8.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 4c6edac was 4c6edac, checked in by Ken Moffat <ken@…>, 7 years ago

Rustc-1.19.0, archive llvm-3 and also the separate cargo which is now installed by rust.

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

  • Property mode set to 100644
File size: 9.6 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 "75e779670ac79edf023497a9c37eb35d">
10 <!ENTITY rust-size "48 MB">
11 <!ENTITY rust-buildsize "4.2 GB (362 MB installed), (add 0.6GB for tests) plus 273MB for ~/.cargo files">
12 <!ENTITY rust-time "33 SBU (add 14 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 &lfs81_checked;
57
58 <bridgehead renderas="sect3">Package Information</bridgehead>
59 <itemizedlist spacing="compact">
60 <listitem>
61 <para>
62 Download (HTTP): <ulink url="&rust-download-http;"/>
63 </para>
64 </listitem>
65 <listitem>
66 <para>
67 Download (FTP): <ulink url="&rust-download-ftp;"/>
68 </para>
69 </listitem>
70 <listitem>
71 <para>
72 Download MD5 sum: &rust-md5sum;
73 </para>
74 </listitem>
75 <listitem>
76 <para>
77 Download size: &rust-size;
78 </para>
79 </listitem>
80 <listitem>
81 <para>
82 Estimated disk space required: &rust-buildsize;
83 </para>
84 </listitem>
85 <listitem>
86 <para>
87 Estimated build time: &rust-time;
88 </para>
89 </listitem>
90 </itemizedlist>
91
92 <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
93
94 <bridgehead renderas="sect4">Required</bridgehead>
95 <para role="required">
96 <xref linkend="curl"/>,
97 <xref linkend="cmake"/>,
98 <xref linkend="python2"/>
99 </para>
100
101 <bridgehead renderas="sect4">Optional</bridgehead>
102 <para role="optional">
103 <xref linkend="gdb"/> (used by debuginfo-gdb in the testsuite),
104 <xref linkend="ninja"/>
105 </para>
106
107 <para condition="html" role="usernotes">
108 User Notes: <ulink url="&blfs-wiki;/rust"/>
109 </para>
110 </sect2>
111
112 <sect2 role="installation">
113 <title>Installation of Rust</title>
114
115 <note>
116 <para>
117 This package is updated on a six-weekly release cycle. Because it is
118 such a large and slow package to build, and is at the moment only used
119 by one package in this book, the BLFS editors take the view that it
120 should only be updated when that is necessary.
121 </para>
122 </note>
123
124 <para>
125 First create a suitable <filename>config.toml</filename> file
126 which will configure the build :
127 </para>
128
129<screen><userinput>cat &lt;&lt;EOF &gt; config.toml
130# see src/bootstrap/config.toml.example for more possible options
131[llvm]
132targets = "X86"
133
134[build]
135# install cargo as well as rust
136extended = true
137
138[install]
139prefix = "/usr"
140docdir = "share/doc/rustc-1.19.0"
141channel = "stable"
142EOF</userinput></screen>
143
144 <para>
145 Now install <application>Rust</application> by running the following
146 commands:
147 </para>
148
149<screen><userinput>./x.py build</userinput></screen>
150
151 <para>
152 To run the tests issue
153 <command>./x.py test --verbose --no-fail-fast &gt;../rustc-testlog</command>:
154 as with the build, that will use all available CPUs. This runs maniy suites
155 of tests (in an apparently random order), three may fail:
156 compile-fail/issue-37131.rs and run-make/target-without-atomics both try to
157 compile for the thumbv6m-none-eabi target, but the BLFS build does not cater for
158 that, and all 105 tests in debuginfo-gdb will fail if
159 <application>gdb</application> has not been installed.
160 </para>
161
162 <para>
163 If you wish to look at the numbers for the results, you can find the total
164 number of tests which were considered by running:
165 </para>
166
167<screen><command>grep 'running .* tests' ../rustc-testlog | awk '{ sum += $2 } END { print sum }'</command></screen>
168
169 <para>
170 That should report 14029 tests. Similarly, the total tests which failed can
171 be found by running:
172 </para>
173
174<screen><command>grep '^test result:' ../rustc-testlog | awk '{ sum += $6 } END { print sum }'</command></screen>
175
176 <para>
177 And similarly for the tests which passed use $4, for those which were ignored
178 (i.e. skipped) use $8 (and $10 for 'measured', $12 for 'filtered out' but both
179 are probably zero). The breakdown does not match the overall total.
180 </para>
181
182 <para>
183 Now, as the <systemitem class="username">root</systemitem> user:
184 </para>
185
186<screen role="root"><userinput>./x.py dist --install</userinput></screen>
187 </sect2>
188
189 <sect2 role="commands">
190 <title>Command Explanations</title>
191
192 <para>
193 <command>targets = "X86"</command>: this avoids building all the available
194 linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc).
195 </para>
196
197 <para>
198 <command>extended = true</command>: this installs Cargo alongside Rust.
199 </para>
200
201 <para>
202 <command>channel = "stable"</command>: this ensures only stable features
203 can be used, the default in <filename>config.toml</filename> is to use
204 development features, which is not appropriate for a released version.
205 </para>
206
207 <para>
208 <command>--verbose</command>: this switch can sometimes provide more
209 information about a test which fails.
210 </para>
211
212 <para>
213 <command>--no-fail-fast</command>: this switch ensures that the testsuite
214 will not stop at the first error.
215 </para>
216
217 </sect2>
218
219 <sect2 role="content">
220 <title>Contents</title>
221
222 <segmentedlist>
223 <segtitle>Installed Programs</segtitle>
224 <segtitle>Installed Libraries</segtitle>
225 <segtitle>Installed Directories</segtitle>
226
227 <seglistitem>
228 <seg>
229 cargo, rust-gdb, rust-lldb, rustc, rustdoc.
230 </seg>
231 <seg>
232 Many lib*&lt;16-byte-hash&gt;.so libraries.
233 </seg>
234 <seg>
235 ~/.cargo,
236 /usr/lib/rustlib,
237 /usr/share/doc/rustc-&rust-version;, and
238 /usr/share/zsh/site-functions/
239 </seg>
240 </seglistitem>
241 </segmentedlist>
242
243 <variablelist>
244 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
245 <?dbfo list-presentation="list"?>
246 <?dbhtml list-presentation="table"?>
247
248 <varlistentry id="cargo">
249 <term><command>cargo</command></term>
250 <listitem>
251 <para>
252 is the Package Manager for Rust.
253 </para>
254 <indexterm zone="rust cargo">
255 <primary sortas="b-cargo">cargo</primary>
256 </indexterm>
257 </listitem>
258 </varlistentry>
259
260 <varlistentry id="rust-gdb">
261 <term><command>rust-gdb</command></term>
262 <listitem>
263 <para>
264 is a Python wrapper script for gdb.
265 </para>
266 <indexterm zone="rust rust-gdb">
267 <primary sortas="b-rust-gdb">rust-gdb</primary>
268 </indexterm>
269 </listitem>
270 </varlistentry>
271
272 <varlistentry id="rust-lldb">
273 <term><command>rust-lldb</command></term>
274 <listitem>
275 <para>
276 is a Python wrapper script for LLDB (the LLVM debugger).
277 </para>
278 <indexterm zone="rust rust-lldb">
279 <primary sortas="b-rust-lldb">rust=lldb</primary>
280 </indexterm>
281 </listitem>
282 </varlistentry>
283
284 <varlistentry id="rustc">
285 <term><command>rustc</command></term>
286 <listitem>
287 <para>
288 is the rust compiler.
289 </para>
290 <indexterm zone="rust rustc">
291 <primary sortas="b-rustc">rustc</primary>
292 </indexterm>
293 </listitem>
294 </varlistentry>
295
296 <varlistentry id="rustdoc">
297 <term><command>rustdoc</command></term>
298 <listitem>
299 <para>
300 generates documentation from rust source code.
301 </para>
302 <indexterm zone="rust rustdoc">
303 <primary sortas="b-rustdoc">rustdoc</primary>
304 </indexterm>
305 </listitem>
306 </varlistentry>
307
308 <varlistentry id="libstd">
309 <term><filename class="libraryfile">libstd-&lt;16-byte-hash&gt;.so</filename></term>
310 <listitem>
311 <para>
312 is the Rust Standard Library, the foundation of portable Rust software.
313 </para>
314 <indexterm zone="rust libstd">
315 <primary sortas="c-libstd">libstd-&lt;16-byte-hash&gt;.so</primary>
316 </indexterm>
317 </listitem>
318 </varlistentry>
319 </variablelist>
320 </sect2>
321</sect1>
Note: See TracBrowser for help on using the repository browser.