source: general/prog/rust.xml@ 03d537cd

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 03d537cd was 03d537cd, checked in by Ken Moffat <ken@…>, 7 years ago

Add rust and cargo, ready for firefox-53, with system llvm-3.9.1 in /opt.

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

  • Property mode set to 100644
File size: 9.7 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 "http://static.rust-lang.org/dist/rustc-&rust-version;-src.tar.gz">
8 <!ENTITY rust-download-ftp "">
9 <!ENTITY rust-md5sum "c11d94d9e62f71838b20058f0797357a">
10 <!ENTITY rust-size "28 MB">
11 <!ENTITY rust-buildsize "1.5 GB (208 MB installed) plus 118MB for cargo files">
12 <!ENTITY rust-time "14 SBU (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, and it is likely that the next few versions
54 of <application>firefox</application> will each require the latest version
55 of <application>Rust</application>.
56 </para>
57
58 &lfs80_checked;
59
60 <bridgehead renderas="sect3">Package Information</bridgehead>
61 <itemizedlist spacing="compact">
62 <listitem>
63 <para>
64 Download (HTTP): <ulink url="&rust-download-http;"/>
65 </para>
66 </listitem>
67 <listitem>
68 <para>
69 Download (FTP): <ulink url="&rust-download-ftp;"/>
70 </para>
71 </listitem>
72 <listitem>
73 <para>
74 Download MD5 sum: &rust-md5sum;
75 </para>
76 </listitem>
77 <listitem>
78 <para>
79 Download size: &rust-size;
80 </para>
81 </listitem>
82 <listitem>
83 <para>
84 Estimated disk space required: &rust-buildsize;
85 </para>
86 </listitem>
87 <listitem>
88 <para>
89 Estimated build time: &rust-time;
90 </para>
91 </listitem>
92 </itemizedlist>
93
94 <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
95
96 <bridgehead renderas="sect4">Required</bridgehead>
97 <para role="required">
98 <xref linkend="curl"/>,
99 <xref linkend="cmake"/> (if not using the recommended <xref linkend="llvm-old"/>),
100 <xref linkend="python2"/>
101 </para>
102
103 <bridgehead renderas="sect4">Recommended</bridgehead>
104 <para role="recommended">
105 <!-- acceptable versions of llvm are listed in the tests
106 of LLVM_VERSION in configure, currently 3.{7-9}* -->
107 <xref linkend="llvm-old"/>
108 </para>
109
110 <bridgehead renderas="sect4">Optional</bridgehead>
111 <para role="optional">
112 <xref linkend="gdb"/> (often required for the testsuite, but some of the
113 gdb tests may still fail),
114 <xref linkend="ninja"/>
115 </para>
116
117 <para condition="html" role="usernotes">
118 User Notes: <ulink url="&blfs-wiki;/rust"/>
119 </para>
120 </sect2>
121
122 <sect2 role="installation">
123 <title>Installation of Rust</title>
124
125 <para>
126 Install <application>Rust</application> by running the following
127 commands:
128 </para>
129
130<screen><userinput>
131mkdir build &amp;&amp;
132cd build &amp;&amp;
133
134./configure --prefix=/usr \
135 --docdir=/usr/share/doc/rustc-&rust-version; \
136 --llvm-root=/opt/llvm3 --enable-llvm-link-shared &amp;&amp;
137./x.py build</userinput></screen>
138
139 <para>
140 The testsuite in this package selects random subsets of the
141 possible tests. There is no correlation between how long a
142 particular run of the testsuite takes, and how many tests
143 were run. On occasion, the chosen tests will run in much
144 less than 1.0 SBU, on other occasions they may take more
145 than 20 SBU. Although it is normal to run the testsuite for
146 a compiler, in this case that is very hard to recommend.
147 </para>
148
149 <para>
150 Nevertheless, if you insist on running the tests issue
151 <command>./x.py test</command>: as with the build, that will
152 use all available CPUs.
153 </para>
154
155 <para>
156 Now, as the <systemitem class="username">root</systemitem> user:
157 </para>
158
159<screen role="root"><userinput>
160test -f /usr/lib/libLLVM-3.9.so ||
161 ln -sv /opt/llvm3/lib/libLLVM-3.9.so /usr/lib &amp;&amp;
162
163./x.py dist --install</userinput></screen>
164 </sect2>
165
166 <sect2 role="commands">
167 <title>Command Explanations</title>
168
169 <para>
170 <command>--llvm-root=/opt/llvm3 --enable-llvm-link-shared</command>:
171 This tells rust to use the system verison of llvm3 installed in
172 <filename class="directory">/opt/llvm3</filename>, linking to the
173 shared libraries.
174 </para>
175
176 <para>
177 <option>--enable-dist-host-only</option>: If you did not install a
178 system version of <xref linkend="llvm-old"/>, use this alternative command
179 to build the shipped static version of llvm. It will
180 <emphasis>compile</emphasis> for all the available linux cross-compilers
181 (Aarch64, MIPS, PowerPC, SystemZ, etc) but with this switch it will only
182 <emphasis>install</emphasis> for the host architecture.
183 </para>
184
185 <para>
186 <option>RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"</option>: use this if
187 you need to link against a version of LLVM-3 which was compiled against
188 <xref linkend="libffi"/>.
189 </para>
190
191 <para>
192 <command>ln -sv /opt/llvm3/lib/libLLVM-3.9.so /usr/lib</command>:
193 Although the <emphasis>build</emphasis> of <application>Rust</application>
194 finds the shared library in
195 <filename class="directory">/opt/llvm3/lib</filename>, several of the steps
196 run by the <application>rustbuild</application>
197 <emphasis>installer</emphasis> do not find
198 <filename>libLLVM-3.9.so</filename>. This conditional symlink fixes that,
199 and works even if <filename>libLLVM-3.9.{0,1}</filename> has already been
200 installed in <filename class="directory">/usr</filename>.
201 <emphasis>Omit this command if you did not install a system version of
202 <xref linkend="llvm-old"/></emphasis>.
203 </para>
204 </sect2>
205
206 <sect2 role="content">
207 <title>Contents</title>
208
209 <segmentedlist>
210 <segtitle>Installed Program(s)</segtitle>
211 <segtitle>Installed Librar(y,ies)</segtitle>
212 <segtitle>Installed Director(y,ies)</segtitle>
213
214 <seglistitem>
215 <seg>
216 rust-gdb, rust-lldb, rustc, rustdoc.
217 </seg>
218 <seg>
219 Many libraries (libarena, libflate, libfmt_macros, libgetopts,
220 libgraphviz, liblog, libproc_macro, librustc*, libserialize,
221 libstd, libsyntax, libterm, libtest), all containing a hash in
222 their names.
223 </seg>
224 <seg>
225 ~/.cargo,
226 /usr/lib/rustlib,
227 /usr/share/doc/rustc-&rust-version;.
228 </seg>
229 </seglistitem>
230 </segmentedlist>
231
232 <variablelist>
233 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
234 <?dbfo list-presentation="list"?>
235 <?dbhtml list-presentation="table"?>
236
237 <varlistentry id="rust-gdb">
238 <term><command>rust-gdb</command></term>
239 <listitem>
240 <para>
241 is a Python wrapper script for gdb.
242 </para>
243 <indexterm zone="rust rust-gdb">
244 <primary sortas="b-rust-gdb">rust-gdb</primary>
245 </indexterm>
246 </listitem>
247 </varlistentry>
248
249 <varlistentry id="rust-lldb">
250 <term><command>rust-lldb</command></term>
251 <listitem>
252 <para>
253 is a Python wrapper script for LLDB (the LLVM debugger).
254 </para>
255 <indexterm zone="rust rust-lldb">
256 <primary sortas="b-rust-lldb">rust=lldb</primary>
257 </indexterm>
258 </listitem>
259 </varlistentry>
260
261 <varlistentry id="rustc">
262 <term><command>rustc</command></term>
263 <listitem>
264 <para>
265 is the rust compiler.
266 </para>
267 <indexterm zone="rust rustc">
268 <primary sortas="b-rustc">rustc</primary>
269 </indexterm>
270 </listitem>
271 </varlistentry>
272
273 <varlistentry id="rustdoc">
274 <term><command>rustdoc</command></term>
275 <listitem>
276 <para>
277 generates documentation from rust source code.
278 </para>
279 <indexterm zone="rust rustdoc">
280 <primary sortas="b-rustdoc">rustdoc</primary>
281 </indexterm>
282 </listitem>
283 </varlistentry>
284
285 <varlistentry id="libstd">
286 <term><filename class="libraryfile">libstd-&lt;16-byte-hash&gt;.so</filename></term>
287 <listitem>
288 <para>
289 is the Rust Standard Library, the foundation of portable Rust software.
290 </para>
291 <indexterm zone="rust libstd">
292 <primary sortas="c-libstd">libstd-&lt;16-byte-hash&gt;.so</primary>
293 </indexterm>
294 </listitem>
295 </varlistentry>
296 </variablelist>
297 </sect2>
298</sect1>
Note: See TracBrowser for help on using the repository browser.