[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 |
|
---|
[614fc25f] | 7 | <!ENTITY rust-download-http "https://static.rust-lang.org/dist/rustc-&rust-version;-src.tar.gz">
|
---|
[d9bcc5f] | 8 | <!ENTITY rust-download-ftp " ">
|
---|
[bf5fb94] | 9 | <!ENTITY rust-md5sum "a460bed79b92f6a7833ba6e6390ee6ae">
|
---|
| 10 | <!ENTITY rust-size "145 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. -->
|
---|
[25997c4a] | 16 |
|
---|
[bf5fb94] | 17 | <!ENTITY rust-buildsize "7.6 GB (369 MB installed) including 294 MB of ~/.cargo files for the user building this. Add 3.3 GB if running the tests">
|
---|
| 18 | <!ENTITY rust-time "39 SBU (add 31 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 | <othername>$LastChangedBy$</othername>
|
---|
| 26 | <date>$Date$</date>
|
---|
| 27 | </sect1info>
|
---|
| 28 |
|
---|
| 29 | <title>Rustc-&rust-version;</title>
|
---|
| 30 |
|
---|
| 31 | <indexterm zone="rust">
|
---|
| 32 | <primary sortas="a-rust">Rust</primary>
|
---|
| 33 | </indexterm>
|
---|
| 34 |
|
---|
| 35 | <sect2 role="package">
|
---|
| 36 | <title>Introduction to Rust</title>
|
---|
| 37 |
|
---|
| 38 | <para>
|
---|
| 39 | The <application>Rust</application> programming language is designed
|
---|
| 40 | to be a safe, concurrent, practical language.
|
---|
| 41 | </para>
|
---|
| 42 |
|
---|
[25997c4a] | 43 | <para>
|
---|
| 44 | This package is updated on a six-weekly release cycle. Because it is
|
---|
[ec2353a] | 45 | such a large and slow package to build, is at the moment only required
|
---|
| 46 | by a few packages in this book, and particularly because newer versions
|
---|
| 47 | tend to break older mozilla packages, the BLFS editors take the view that
|
---|
| 48 | it should only be updated when that is necessary (either to fix problems,
|
---|
| 49 | or to allow a new version of a package to build).
|
---|
[25997c4a] | 50 | </para>
|
---|
| 51 |
|
---|
[03d537cd] | 52 | <para>
|
---|
| 53 | As with many other programming languages, rustc (the rust compiler)
|
---|
[a7b1bddc] | 54 | needs a binary from which to bootstrap. It will download a stage0 binary
|
---|
| 55 | and many cargo crates (these are actually .tar.gz source archives) at
|
---|
[03d537cd] | 56 | the start of the build, so you cannot compile it without an internet
|
---|
| 57 | connection.
|
---|
| 58 | </para>
|
---|
| 59 |
|
---|
[25997c4a] | 60 | <para>
|
---|
| 61 | These crates will then remain in various forms (cache, directories of
|
---|
| 62 | extracted source), in <filename class="directory">~/.cargo</filename> for
|
---|
| 63 | ever more. It is common for large <application>rust</application> packages
|
---|
| 64 | to use multiple versions of some crates. If you purge the files before
|
---|
| 65 | updating this package, very few crates will need to be updated by the
|
---|
| 66 | packages in this book which use it (and they will be downloaded as
|
---|
| 67 | required). But if you retain an older version as a fallback option and
|
---|
[b05ea0b] | 68 | then use it (when <emphasis>not</emphasis> building in
|
---|
[25997c4a] | 69 | <filename class="directory">/usr</filename>), it is likely that it will
|
---|
[b05ea0b] | 70 | then have to re-download some crates. For a full download (i.e. starting
|
---|
[25997c4a] | 71 | with an empty or missing <filename class="directory">~/.cargo</filename>)
|
---|
| 72 | downloading the external cargo files for this version only takes a minute
|
---|
| 73 | or so on a fast network.
|
---|
| 74 | </para>
|
---|
| 75 |
|
---|
| 76 | <note>
|
---|
| 77 | <para>
|
---|
[d396c65] | 78 | Although BLFS usually installs in <filename
|
---|
| 79 | class="directory">/usr</filename>, when you later upgrade to a newer
|
---|
| 80 | version of <application>rust</application> the old libraries in <filename
|
---|
| 81 | class="directory">/usr/lib/rustlib</filename> will remain, with various
|
---|
| 82 | hashes in their names, but will not be usable and will waste space. The
|
---|
| 83 | editors recommend placing the files in the <filename
|
---|
| 84 | class="directory">/opt</filename> directory. In particular, if you
|
---|
| 85 | have reason to rebuild with a modified configuration (e.g. using the
|
---|
[ec2353a] | 86 | shipped LLVM after building with shared LLVM, or for the
|
---|
| 87 | reverse situation) it is possible for the install to leave a broken
|
---|
[d396c65] | 88 | <command>cargo</command> program. In such a situation, either remove
|
---|
| 89 | the existing installation first, or use a different prefix such as
|
---|
| 90 | /opt/rustc-&rust-version;-build2.
|
---|
[25997c4a] | 91 | </para>
|
---|
[b05ea0b] | 92 |
|
---|
| 93 | <para>
|
---|
[d396c65] | 94 | If you prefer, you can of course change the prefix to <filename
|
---|
| 95 | class="directory">/usr</filename> and omit the
|
---|
| 96 | <command>ldconfig</command> and the actions to add rustc to the PATH.
|
---|
[b05ea0b] | 97 | </para>
|
---|
[25997c4a] | 98 | </note>
|
---|
| 99 |
|
---|
[03d537cd] | 100 | <para>
|
---|
| 101 | The current <application>rustbuild</application> build-system will use
|
---|
[bf5fb94] | 102 | all processors, although it does not scale well and often falls
|
---|
[03d537cd] | 103 | back to just using one core while waiting for a library to compile.
|
---|
[5ce1bdb] | 104 | However it can be mostly limited to a specified number of processors by
|
---|
| 105 | a combination of adding the switch <literal>--jobs <N></literal>
|
---|
| 106 | (e.g. '--jobs 4' to limit to 4 processors) on each invocation of
|
---|
| 107 | <command>python3 ./x.py</command> <emphasis>and</emphasis> using an
|
---|
| 108 | environment variable <envar>CARGO_BUILD_JOBS=<N></envar>. At the
|
---|
| 109 | moment this is not effective when some of the rustc tests are run.
|
---|
[03d537cd] | 110 | </para>
|
---|
| 111 |
|
---|
[bf5fb94] | 112 | <para>
|
---|
| 113 | The current version of rust's num_cpus crate now recognizes that cgroups
|
---|
| 114 | can be used to restrict which processors it is allowed to use. So if your
|
---|
| 115 | machine lacks DRAM (typically, less than 2GB DRAM per core) that might be
|
---|
| 116 | an alternative to taking CPUs offline.
|
---|
| 117 | <phrase revision="sysv">In sysv systems cgroups requires <ulink
|
---|
| 118 | url="https://sourceforge.net/projects/libcg/">libcgroup</ulink>.</phrase>
|
---|
[6fe9b0bd] | 119 | <phrase revision="systemd">That can apparently be achieved by writing
|
---|
[bf5fb94] | 120 | custom unit files.</phrase>
|
---|
| 121 | </para>
|
---|
| 122 |
|
---|
[03d537cd] | 123 | <para>
|
---|
| 124 | At the moment <application>Rust</application> does not provide any
|
---|
[4c6edac] | 125 | guarantees of a stable ABI.
|
---|
[03d537cd] | 126 | </para>
|
---|
| 127 |
|
---|
[326f830] | 128 | <note>
|
---|
[7d259126] | 129 | <para>
|
---|
| 130 | Rustc defaults to building for ALL supported architectures, using a
|
---|
[4f8ca94] | 131 | shipped copy of LLVM. In BLFS the build is only for the X86
|
---|
| 132 | architecture. Rustc still claims to require Python 2, but that is only
|
---|
| 133 | really necessary when building some other architectures with the
|
---|
| 134 | shipped LLVM.
|
---|
[d396c65] | 135 | If you intend to develop rust crates, this build may not be good
|
---|
[b05ea0b] | 136 | enough for your purposes.
|
---|
[7d259126] | 137 | </para>
|
---|
[326f830] | 138 | <para>
|
---|
[4f9e45d9] | 139 | The build times of this version when repeated on the same machine are
|
---|
| 140 | often reasonably consistent, but as with all compilations using
|
---|
| 141 | <command>rustc</command> there can be some very slow outliers.
|
---|
[326f830] | 142 | </para>
|
---|
| 143 | <para>
|
---|
[bb0652ca] | 144 | Unusually, a DESTDIR-style method is being used to install this package.
|
---|
| 145 | This is because running the install as root not only downloads all of the
|
---|
[a7b1bddc] | 146 | cargo files again (to <filename>/root/.cargo</filename>), it then spends
|
---|
[7d259126] | 147 | a very long time recompiling. Using this method saves a lot of time, at
|
---|
| 148 | the cost of extra disk space.
|
---|
[326f830] | 149 | </para>
|
---|
| 150 | </note>
|
---|
| 151 |
|
---|
[193af65e] | 152 | &lfs10_checked;
|
---|
[03d537cd] | 153 |
|
---|
| 154 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 155 | <itemizedlist spacing="compact">
|
---|
| 156 | <listitem>
|
---|
| 157 | <para>
|
---|
| 158 | Download (HTTP): <ulink url="&rust-download-http;"/>
|
---|
| 159 | </para>
|
---|
| 160 | </listitem>
|
---|
| 161 | <listitem>
|
---|
| 162 | <para>
|
---|
| 163 | Download (FTP): <ulink url="&rust-download-ftp;"/>
|
---|
| 164 | </para>
|
---|
| 165 | </listitem>
|
---|
| 166 | <listitem>
|
---|
| 167 | <para>
|
---|
| 168 | Download MD5 sum: &rust-md5sum;
|
---|
| 169 | </para>
|
---|
| 170 | </listitem>
|
---|
| 171 | <listitem>
|
---|
| 172 | <para>
|
---|
| 173 | Download size: &rust-size;
|
---|
| 174 | </para>
|
---|
| 175 | </listitem>
|
---|
| 176 | <listitem>
|
---|
| 177 | <para>
|
---|
| 178 | Estimated disk space required: &rust-buildsize;
|
---|
| 179 | </para>
|
---|
| 180 | </listitem>
|
---|
| 181 | <listitem>
|
---|
| 182 | <para>
|
---|
| 183 | Estimated build time: &rust-time;
|
---|
| 184 | </para>
|
---|
| 185 | </listitem>
|
---|
| 186 | </itemizedlist>
|
---|
| 187 |
|
---|
[ec2353a] | 188 | <!--<bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
[d7e8f67] | 189 | <itemizedlist spacing="compact">
|
---|
| 190 | <listitem>
|
---|
| 191 | <para>
|
---|
| 192 | Required patch:
|
---|
| 193 | <ulink url="&patch-root;/rustc-&rust-version;-llvm9_fixes-1.patch"/>
|
---|
| 194 | </para>
|
---|
| 195 | </listitem>
|
---|
[ec2353a] | 196 | </itemizedlist>-->
|
---|
[d7e8f67] | 197 |
|
---|
[03d537cd] | 198 | <bridgehead renderas="sect3">Rust Dependencies</bridgehead>
|
---|
| 199 |
|
---|
| 200 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 201 | <para role="required">
|
---|
| 202 | <xref linkend="curl"/>,
|
---|
[4f8ca94] | 203 | <xref linkend="cmake"/>, and
|
---|
| 204 | <xref linkend="libssh2"/>
|
---|
[03d537cd] | 205 | </para>
|
---|
| 206 |
|
---|
[69d1a8e] | 207 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
[a7b1bddc] | 208 | <para role="recommended">
|
---|
| 209 | <package>clang</package> from <xref linkend="llvm"/>
|
---|
[4f9e45d9] | 210 | (built with -DLLVM_LINK_LLVM_DYLIB=ON so that rust can link to
|
---|
[741231d] | 211 | system LLVM instead of building its shipped version)
|
---|
[69d1a8e] | 212 | If using an older version, see the config.toml file below re
|
---|
| 213 | using the shipped llvm, because of rust issue 69225.
|
---|
| 214 | </para>
|
---|
[a7b1bddc] | 215 |
|
---|
[03d537cd] | 216 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 217 | <para role="optional">
|
---|
[bf5fb94] | 218 | <xref linkend="gdb"/> (used by the testsuite if it is present)
|
---|
[03d537cd] | 219 | </para>
|
---|
| 220 |
|
---|
| 221 | <para condition="html" role="usernotes">
|
---|
| 222 | User Notes: <ulink url="&blfs-wiki;/rust"/>
|
---|
| 223 | </para>
|
---|
| 224 | </sect2>
|
---|
| 225 |
|
---|
| 226 | <sect2 role="installation">
|
---|
| 227 | <title>Installation of Rust</title>
|
---|
| 228 |
|
---|
| 229 | <para>
|
---|
[d396c65] | 230 | To install into the
|
---|
| 231 | <filename class="directory">/opt</filename> directory, remove the symlink
|
---|
| 232 | and create a new directory (i.e. with a different name if trying a
|
---|
| 233 | modified build).
|
---|
[4f9e45d9] | 234 | As the <systemitem class="username">root</systemitem>
|
---|
[b05ea0b] | 235 | user:
|
---|
| 236 | </para>
|
---|
| 237 |
|
---|
[d396c65] | 238 | <screen role="root"><userinput>mkdir /opt/rustc-&rust-version; &&
|
---|
| 239 | ln -svfin rustc-&rust-version; /opt/rustc</userinput></screen>
|
---|
[b05ea0b] | 240 |
|
---|
| 241 | <note>
|
---|
| 242 | <para>
|
---|
| 243 | If multiple versions of <application>Rust</application> are installed
|
---|
| 244 | in <filename class="directory">/opt</filename>, changing to another
|
---|
| 245 | version only requires changing the <filename> /opt/rustc</filename>
|
---|
| 246 | symbolic link and then running <command>ldconfig</command>.
|
---|
| 247 | </para>
|
---|
| 248 | </note>
|
---|
| 249 |
|
---|
| 250 | <para>
|
---|
| 251 | Create a suitable <filename>config.toml</filename> file which will
|
---|
[4f9e45d9] | 252 | configure the build.
|
---|
[4c6edac] | 253 | </para>
|
---|
| 254 |
|
---|
[272f28b] | 255 | <screen><userinput>cat << EOF > config.toml
|
---|
[51dfb3e] | 256 | <literal># see config.toml.example for more possible options
|
---|
[69d1a8e] | 257 | # See the 8.4 book for an example using shipped LLVM
|
---|
| 258 | # e.g. if not installing clang, or using a version before 10.0
|
---|
[4c6edac] | 259 | [llvm]
|
---|
[4f9e45d9] | 260 | # by default, rust will build for a myriad of architectures
|
---|
[25997c4a] | 261 | targets = "X86"
|
---|
[4f9e45d9] | 262 |
|
---|
[7f057ac] | 263 | # When using system llvm prefer shared libraries
|
---|
| 264 | link-shared = true
|
---|
| 265 |
|
---|
[4c6edac] | 266 | [build]
|
---|
[4f9e45d9] | 267 | # omit docs to save time and space (default is to build them)
|
---|
[25997c4a] | 268 | docs = false
|
---|
| 269 |
|
---|
[4c6edac] | 270 | # install cargo as well as rust
|
---|
| 271 | extended = true
|
---|
| 272 |
|
---|
| 273 | [install]
|
---|
[ff803c4] | 274 | prefix = "/opt/rustc-&rust-version;"
|
---|
| 275 | docdir = "share/doc/rustc-&rust-version;"
|
---|
[326f830] | 276 |
|
---|
| 277 | [rust]
|
---|
[4c6edac] | 278 | channel = "stable"
|
---|
[326f830] | 279 | rpath = false
|
---|
[a7b1bddc] | 280 |
|
---|
| 281 | # BLFS does not install the FileCheck executable from llvm,
|
---|
| 282 | # so disable codegen tests
|
---|
| 283 | codegen-tests = false
|
---|
| 284 |
|
---|
[0f7f7c9] | 285 | [target.x86_64-unknown-linux-gnu]
|
---|
| 286 | # NB the output of llvm-config (i.e. help options) may be
|
---|
| 287 | # dumped to the screen when config.toml is parsed.
|
---|
| 288 | llvm-config = "/usr/bin/llvm-config"
|
---|
| 289 |
|
---|
| 290 | [target.i686-unknown-linux-gnu]
|
---|
| 291 | # NB the output of llvm-config (i.e. help options) may be
|
---|
| 292 | # dumped to the screen when config.toml is parsed.
|
---|
| 293 | llvm-config = "/usr/bin/llvm-config"
|
---|
| 294 |
|
---|
[51dfb3e] | 295 | </literal>
|
---|
[4c6edac] | 296 | EOF</userinput></screen>
|
---|
| 297 |
|
---|
[ec2353a] | 298 | <!--<para>
|
---|
[d7e8f67] | 299 | Adapt rustc to allow it to build and function with the changes in LLVM-9:
|
---|
| 300 | </para>
|
---|
| 301 |
|
---|
[ec2353a] | 302 | <screen><userinput remap="pre">patch -Np1 -i ../rustc-&rust-version;-llvm9_fixes-1.patch</userinput></screen>-->
|
---|
[d7e8f67] | 303 |
|
---|
[bf5fb94] | 304 | <para>
|
---|
| 305 | Two of the tests reliably fail. To cause them to be ignored run the
|
---|
| 306 | following sed command:
|
---|
| 307 | </para>
|
---|
| 308 |
|
---|
| 309 | <screen><userinput>sed -i '1i # ignore-test' \
|
---|
| 310 | src/test/run-make-fulldeps/sysroot-crates-are-unstable/Makefile \
|
---|
| 311 | src/test/run-make-fulldeps/long-linker-command-lines/Makefile</userinput></screen>
|
---|
| 312 |
|
---|
[4c6edac] | 313 | <para>
|
---|
[ec2353a] | 314 | Compile <application>Rust</application> by running the following
|
---|
[03d537cd] | 315 | commands:
|
---|
| 316 | </para>
|
---|
| 317 |
|
---|
[bb0652ca] | 318 | <screen><userinput>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi" &&
|
---|
[4f8ca94] | 319 | python3 ./x.py build --exclude src/tools/miri</userinput></screen>
|
---|
[a7b1bddc] | 320 |
|
---|
[6bcd464] | 321 | <note>
|
---|
[a7b1bddc] | 322 | <para>
|
---|
[6bcd464] | 323 | The testsuite will generate some messages in the
|
---|
[a7b1bddc] | 324 | <phrase revision="sysv">system log</phrase>
|
---|
| 325 | <phrase revision="systemd">systemd journal</phrase>
|
---|
[6bcd464] | 326 | for traps on invalid opcodes, and for segmentation faults.
|
---|
[25997c4a] | 327 | In themselves these are nothing to worry about, just a way for the
|
---|
[4f9e45d9] | 328 | test to be terminated.
|
---|
[a7b1bddc] | 329 | </para>
|
---|
[6bcd464] | 330 | </note>
|
---|
[a7b1bddc] | 331 |
|
---|
[03d537cd] | 332 | <para>
|
---|
[4f8ca94] | 333 | To run the tests issue <command>python3 ./x.py test --verbose
|
---|
| 334 | --no-fail-fast | tee rustc-testlog</command>: as with the build, that
|
---|
| 335 | will use all available CPUs.
|
---|
[03d537cd] | 336 | </para>
|
---|
| 337 |
|
---|
| 338 | <para>
|
---|
[4b8a71a] | 339 | Although no tests are now expected to fail, on an apparently successful
|
---|
| 340 | build (gdb not installed) the testsuite reports that
|
---|
| 341 | 1 commands did not execute successfully.
|
---|
| 342 | <!-- As with all large testsuites,-->
|
---|
| 343 | Some tests might
|
---|
[4cc77fbd] | 344 | fail on some machines - if the number of failures is in the single digits,
|
---|
[4f9e45d9] | 345 | check the log for 'FAILED' and review lines above that, particularly the
|
---|
| 346 | 'stderr:' lines. Any mention of
|
---|
[4cc77fbd] | 347 | SIGSEGV or signal 11 in a failing test is a cause for concern.
|
---|
[25997c4a] | 348 | </para>
|
---|
| 349 |
|
---|
[b6ff745e] | 350 | <para>
|
---|
[69d1a8e] | 351 | If you get any <emphasis>other</emphasis> failing test which reports an
|
---|
| 352 | issue number then you should search for that issue. For example, when
|
---|
[bf5fb94] | 353 | rustc >= 1.41.1 was built with a version of sysllvm before 10.0 the test
|
---|
[69d1a8e] | 354 | for issue 69225 fails <ulink
|
---|
| 355 | url="https://github.com/rust-lang/rust/issues/69225"/> and that should be
|
---|
[0f7f7c9] | 356 | regarded as a critical failure (they released 1.41.1 because of it).
|
---|
[69d1a8e] | 357 | Most other failures will not be critical.
|
---|
| 358 | </para>
|
---|
| 359 |
|
---|
| 360 | <para>
|
---|
[bf5fb94] | 361 | Therefore, you should determine the number of failures.
|
---|
| 362 | </para>
|
---|
| 363 |
|
---|
| 364 | <!--
|
---|
| 365 | The total number
|
---|
[69d1a8e] | 366 | of tests varies depending on which dependencies are present, e.g. more
|
---|
| 367 | will be run if <command>gdb</command> is available. If you wish, the
|
---|
| 368 | total number which were considered can be found if you run:
|
---|
[03d537cd] | 369 | </para>
|
---|
| 370 |
|
---|
[bf5fb94] | 371 | <screen remap="test"><userinput>egrep 'running [[:digit:]]+ test' rustc-testlog | awk '{ sum += $2 } END { print sum }'</userinput></screen>-->
|
---|
[4c6edac] | 372 |
|
---|
[03d537cd] | 373 | <para>
|
---|
[bf5fb94] | 374 | The number of tests which failed can be found by running:
|
---|
[03d537cd] | 375 | </para>
|
---|
| 376 |
|
---|
[e7d4e823] | 377 | <screen remap="test"><userinput>grep '^test result:' rustc-testlog | awk '{ sum += $6 } END { print sum }'</userinput></screen>
|
---|
[03d537cd] | 378 |
|
---|
[4c6edac] | 379 | <para>
|
---|
[69d1a8e] | 380 | And similarly if you care about how many tests passed use $4, for those
|
---|
| 381 | which were ignored (i.e. skipped) use $8 (and $10 for 'measured', $12 for
|
---|
| 382 | 'filtered out' but both are probably zero).
|
---|
[4c6edac] | 383 | </para>
|
---|
| 384 |
|
---|
| 385 | <para>
|
---|
[a7b1bddc] | 386 | Still as your normal user, do a DESTDIR install:
|
---|
[4c6edac] | 387 | </para>
|
---|
| 388 |
|
---|
[fb940713] | 389 | <screen><userinput>export LIBSSH2_SYS_USE_PKG_CONFIG=1 &&
|
---|
[4f8ca94] | 390 | DESTDIR=${PWD}/install python3 ./x.py install &&
|
---|
[fb940713] | 391 | unset LIBSSH2_SYS_USE_PKG_CONFIG</userinput></screen>
|
---|
[a7b1bddc] | 392 |
|
---|
| 393 | <para>
|
---|
| 394 | Now, as the <systemitem class="username">root</systemitem> user
|
---|
| 395 | install the files from the DESTDIR:
|
---|
| 396 | </para>
|
---|
| 397 |
|
---|
[bb0652ca] | 398 | <screen role="root"><userinput>chown -R root:root install &&
|
---|
| 399 | cp -a install/* /</userinput></screen>
|
---|
[a7b1bddc] | 400 |
|
---|
[03d537cd] | 401 | </sect2>
|
---|
| 402 |
|
---|
| 403 | <sect2 role="commands">
|
---|
| 404 | <title>Command Explanations</title>
|
---|
| 405 |
|
---|
| 406 | <para>
|
---|
[d396c65] | 407 | <command>ln -svfn rustc-&rust-version; /opt/rustc</command>: if this is
|
---|
| 408 | not the first use of the <filename class="directory">/opt/rustc</filename>
|
---|
| 409 | symlink, overwrite it by forcing, and use the '-n' flag to avoid getting
|
---|
| 410 | confusing results from e.g. <command>ls -l</command>.
|
---|
| 411 | </para>
|
---|
| 412 |
|
---|
| 413 | <para>
|
---|
[4c6edac] | 414 | <command>targets = "X86"</command>: this avoids building all the available
|
---|
[a7b1bddc] | 415 | linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc). Unfortunately,
|
---|
| 416 | rust insists on installing source files for these below
|
---|
[21699c7e] | 417 | <filename class="directory">/opt/rustc/lib/src</filename>.
|
---|
[03d537cd] | 418 | </para>
|
---|
| 419 |
|
---|
| 420 | <para>
|
---|
[4c6edac] | 421 | <command>extended = true</command>: this installs Cargo alongside Rust.
|
---|
[03d537cd] | 422 | </para>
|
---|
| 423 |
|
---|
| 424 | <para>
|
---|
[4c6edac] | 425 | <command>channel = "stable"</command>: this ensures only stable features
|
---|
| 426 | can be used, the default in <filename>config.toml</filename> is to use
|
---|
| 427 | development features, which is not appropriate for a released version.
|
---|
[03d537cd] | 428 | </para>
|
---|
| 429 |
|
---|
[326f830] | 430 | <para>
|
---|
| 431 | <command>rpath = false</command>: by default, <command>rust</command> can
|
---|
| 432 | be run from where it was built, without being installed. That adds DT_RPATH
|
---|
| 433 | entries to all of the ELF files, which produces very messy output from
|
---|
| 434 | <command>ldd</command>, showing the libraries in the place they were built,
|
---|
| 435 | even if they have been deleted from there after the install.
|
---|
| 436 | </para>
|
---|
| 437 |
|
---|
[5f1b4b5] | 438 | <!-- comment while using shipped LLVM -->
|
---|
[a7b1bddc] | 439 | <para>
|
---|
| 440 | <command>[target.x86_64-unknown-linux-gnu]</command>: the syntax of
|
---|
| 441 | <filename>config.toml</filename> requires an <literal>llvm-config</literal>
|
---|
| 442 | entry for each target for which system-llvm is to be used. Change the target
|
---|
| 443 | to <literal>[target.i686-unknown-linux-gnu]</literal> if you are building
|
---|
| 444 | on 32-bit x86. This whole section may be omitted if you wish to build
|
---|
| 445 | against the shipped llvm, or do not have clang, but the resulting build will
|
---|
[7d259126] | 446 | be larger and take longer.
|
---|
[5f1b4b5] | 447 | </para>
|
---|
[a7b1bddc] | 448 |
|
---|
[bb0652ca] | 449 | <para>
|
---|
| 450 | <command>export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"</command>:
|
---|
| 451 | This adds a link to libffi to any RUSTFLAGS you may already be passing
|
---|
| 452 | to the build. On some systems, linking fails to include libffi unless
|
---|
| 453 | this is used. The reason why this is needed is not clear.
|
---|
| 454 | </para>
|
---|
| 455 |
|
---|
[25997c4a] | 456 | <para>
|
---|
| 457 | <command>--exclude src/tools/miri</command>: For a long time, the miri
|
---|
| 458 | crate (an interpreter for the Midlevel Intermediate Representation)
|
---|
| 459 | has failed to build on releases. It is optional, but the failure
|
---|
[4f9e45d9] | 460 | messages can persuade people that the whole build failed. However,
|
---|
| 461 | although it is not built in the main compile, with rustc-1.35.0 it
|
---|
| 462 | now gets compiled during the install, but it is broken in this version.
|
---|
| 463 | <!-- might be unbroken in 1.36.0, if so remove broken from description
|
---|
| 464 | of miri below. https://github.com/rust-lang/rust/issues/61830 -->
|
---|
[25997c4a] | 465 | </para>
|
---|
| 466 |
|
---|
[03d537cd] | 467 | <para>
|
---|
[4c6edac] | 468 | <command>--verbose</command>: this switch can sometimes provide more
|
---|
| 469 | information about a test which fails.
|
---|
[03d537cd] | 470 | </para>
|
---|
[4c6edac] | 471 |
|
---|
| 472 | <para>
|
---|
| 473 | <command>--no-fail-fast</command>: this switch ensures that the testsuite
|
---|
| 474 | will not stop at the first error.
|
---|
| 475 | </para>
|
---|
| 476 |
|
---|
[fb940713] | 477 | <para>
|
---|
| 478 | <command>export LIBSSH2_SYS_USE_PKG_CONFIG=1</command>: On some systems,
|
---|
| 479 | cairo fails to link during the install because it cannot find libssh2.
|
---|
| 480 | This seems to fix it, but again the reason why the problem occurs is not
|
---|
| 481 | understood.
|
---|
| 482 | </para>
|
---|
| 483 |
|
---|
[326f830] | 484 | <para>
|
---|
[4f8ca94] | 485 | <command>DESTDIR=${PWD}/install python3 ./x.py install</command>: This
|
---|
| 486 | effects a DESTDIR-style install in the source tree,creating an <filename
|
---|
[bb0652ca] | 487 | class="directory">install</filename> directory. Note that DESTDIR installs
|
---|
| 488 | need an absolute path, passing 'install' will not work.
|
---|
[a7b1bddc] | 489 | </para>
|
---|
| 490 |
|
---|
| 491 | <para>
|
---|
[bb0652ca] | 492 | <command>chown -R root:root install</command>: the DESTDIR install
|
---|
[a7b1bddc] | 493 | was run by a regular user, who owns the files. For security, change their
|
---|
| 494 | owner before doing a simple copy to install them.
|
---|
[326f830] | 495 | </para>
|
---|
| 496 |
|
---|
[03d537cd] | 497 | </sect2>
|
---|
| 498 |
|
---|
[b05ea0b] | 499 | <sect2 role="configuration">
|
---|
| 500 | <title>Configuring Rust</title>
|
---|
| 501 |
|
---|
| 502 | <sect3 id="rustc-config">
|
---|
| 503 | <title>Configuration Information</title>
|
---|
| 504 |
|
---|
| 505 | <para>
|
---|
| 506 | If you installed <application>rustc</application> in
|
---|
| 507 | <filename class="directory">/opt</filename>, you need to update the
|
---|
[de33b2a] | 508 | following configuration files so that <application>rustc</application>
|
---|
| 509 | is correctly found by other packages and system processes.
|
---|
[b05ea0b] | 510 | </para>
|
---|
| 511 |
|
---|
| 512 | <para>
|
---|
| 513 | As the <systemitem class="username">root</systemitem> user, update
|
---|
| 514 | the <filename>/etc/ld.so.conf</filename> file and the dynamic linker's
|
---|
| 515 | run-time cache file:
|
---|
| 516 | </para>
|
---|
| 517 |
|
---|
| 518 | <screen role="root"><userinput>cat >> /etc/ld.so.conf << EOF
|
---|
| 519 | <literal># Begin rustc addition
|
---|
| 520 |
|
---|
| 521 | /opt/rustc/lib
|
---|
| 522 |
|
---|
| 523 | # End rustc addition</literal>
|
---|
| 524 | EOF
|
---|
| 525 |
|
---|
| 526 | ldconfig</userinput></screen>
|
---|
| 527 |
|
---|
| 528 | <indexterm zone="rustc rustc-config">
|
---|
| 529 | <primary sortas="e-etc-ld.so.conf">/etc/ld.so.conf</primary>
|
---|
| 530 | </indexterm>
|
---|
| 531 |
|
---|
| 532 | <para>
|
---|
| 533 | As the <systemitem class="username">root</systemitem> user, create
|
---|
| 534 | the <filename>/etc/profile.d/rustc.sh</filename> file:
|
---|
| 535 | </para>
|
---|
| 536 |
|
---|
| 537 | <screen role="root"><userinput>cat > /etc/profile.d/rustc.sh << "EOF"
|
---|
| 538 | <literal># Begin /etc/profile.d/rustc.sh
|
---|
| 539 |
|
---|
| 540 | pathprepend /opt/rustc/bin PATH
|
---|
| 541 |
|
---|
| 542 | # End /etc/profile.d/rustc.sh</literal>
|
---|
| 543 | EOF</userinput></screen>
|
---|
| 544 |
|
---|
[de33b2a] | 545 | <para>
|
---|
| 546 | Immediately after installation, update the current PATH
|
---|
| 547 | for your current shell as a normal user:
|
---|
| 548 | </para>
|
---|
[b05ea0b] | 549 |
|
---|
| 550 | <screen><userinput>source /etc/profile.d/rustc.sh</userinput></screen>
|
---|
| 551 |
|
---|
| 552 | </sect3>
|
---|
| 553 | </sect2>
|
---|
| 554 |
|
---|
| 555 |
|
---|
[03d537cd] | 556 | <sect2 role="content">
|
---|
| 557 | <title>Contents</title>
|
---|
| 558 |
|
---|
| 559 | <segmentedlist>
|
---|
[78399edc] | 560 | <segtitle>Installed Programs</segtitle>
|
---|
| 561 | <segtitle>Installed Libraries</segtitle>
|
---|
| 562 | <segtitle>Installed Directories</segtitle>
|
---|
[03d537cd] | 563 |
|
---|
| 564 | <seglistitem>
|
---|
| 565 | <seg>
|
---|
[ec2353a] | 566 | cargo-clippy, cargo-fmt, cargo-miri, cargo, clippy-driver, miri, rls, rust-gdb, rust-gdbgui, rust-lldb, rustc, rustdoc, rustfmt.
|
---|
[03d537cd] | 567 | </seg>
|
---|
| 568 | <seg>
|
---|
[4c6edac] | 569 | Many lib*<16-byte-hash>.so libraries.
|
---|
[03d537cd] | 570 | </seg>
|
---|
| 571 | <seg>
|
---|
| 572 | ~/.cargo,
|
---|
[21699c7e] | 573 | /opt/rustc/lib/rustlib,
|
---|
| 574 | /opt/rustc/share/doc/rustc-&rust-version;, and
|
---|
| 575 | /opt/rustc/share/zsh/site-functions
|
---|
[03d537cd] | 576 | </seg>
|
---|
| 577 | </seglistitem>
|
---|
| 578 | </segmentedlist>
|
---|
| 579 |
|
---|
| 580 | <variablelist>
|
---|
| 581 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 582 | <?dbfo list-presentation="list"?>
|
---|
| 583 | <?dbhtml list-presentation="table"?>
|
---|
| 584 |
|
---|
[7d259126] | 585 | <varlistentry id="cargo-clippy">
|
---|
| 586 | <term><command>cargo-clippy</command></term>
|
---|
| 587 | <listitem>
|
---|
| 588 | <para>
|
---|
| 589 | provides lint checks for a cargo package.
|
---|
| 590 | </para>
|
---|
| 591 | <indexterm zone="rust cargo-clippy">
|
---|
| 592 | <primary sortas="b-cargo-clippy">cargo-clippy</primary>
|
---|
| 593 | </indexterm>
|
---|
| 594 | </listitem>
|
---|
| 595 | </varlistentry>
|
---|
| 596 |
|
---|
[a7b1bddc] | 597 | <varlistentry id="cargo-fmt">
|
---|
| 598 | <term><command>cargo-fmt</command></term>
|
---|
| 599 | <listitem>
|
---|
| 600 | <para>
|
---|
| 601 | formats all bin and lib files of the current crate using
|
---|
| 602 | rustfmt.
|
---|
| 603 | </para>
|
---|
| 604 | <indexterm zone="rust cargo-fmt">
|
---|
| 605 | <primary sortas="b-cargo-fmt">cargo-fmt</primary>
|
---|
| 606 | </indexterm>
|
---|
| 607 | </listitem>
|
---|
| 608 | </varlistentry>
|
---|
| 609 |
|
---|
[4f9e45d9] | 610 | <varlistentry id="cargo-miri">
|
---|
| 611 | <term><command>cargo-miri</command></term>
|
---|
| 612 | <listitem>
|
---|
| 613 | <para>
|
---|
| 614 | <!-- FIXME reword to 'is used by' if Miri installed
|
---|
| 615 | AND works enough to report its \-\-help -->
|
---|
| 616 | is for use by Miri to interpret bin crates and tests
|
---|
| 617 | </para>
|
---|
| 618 | <indexterm zone="rust cargo-miri">
|
---|
| 619 | <primary sortas="b-cargo-miri">cargo-miri</primary>
|
---|
| 620 | </indexterm>
|
---|
| 621 | </listitem>
|
---|
| 622 | </varlistentry>
|
---|
| 623 |
|
---|
[4c6edac] | 624 | <varlistentry id="cargo">
|
---|
| 625 | <term><command>cargo</command></term>
|
---|
| 626 | <listitem>
|
---|
| 627 | <para>
|
---|
| 628 | is the Package Manager for Rust.
|
---|
| 629 | </para>
|
---|
| 630 | <indexterm zone="rust cargo">
|
---|
| 631 | <primary sortas="b-cargo">cargo</primary>
|
---|
| 632 | </indexterm>
|
---|
| 633 | </listitem>
|
---|
| 634 | </varlistentry>
|
---|
| 635 |
|
---|
[7d259126] | 636 | <varlistentry id="clippy-driver">
|
---|
| 637 | <term><command>clippy-driver</command></term>
|
---|
| 638 | <listitem>
|
---|
| 639 | <para>
|
---|
| 640 | provides lint checks for Rust.
|
---|
| 641 | </para>
|
---|
| 642 | <indexterm zone="rust clippy-driver">
|
---|
| 643 | <primary sortas="b-clippy-driver">clippy-driver</primary>
|
---|
| 644 | </indexterm>
|
---|
| 645 | </listitem>
|
---|
| 646 | </varlistentry>
|
---|
| 647 |
|
---|
[4f9e45d9] | 648 | <varlistentry id="miri">
|
---|
| 649 | <term><command>miri</command></term>
|
---|
| 650 | <listitem>
|
---|
| 651 | <para>
|
---|
| 652 | is an interpreter for Rust's mid-level intermediate representation
|
---|
| 653 | (MIR). It is broken in this version.
|
---|
| 654 | </para>
|
---|
| 655 | <indexterm zone="rust miri">
|
---|
| 656 | <primary sortas="b-miri">miri</primary>
|
---|
| 657 | </indexterm>
|
---|
| 658 | </listitem>
|
---|
| 659 | </varlistentry>
|
---|
| 660 |
|
---|
[326f830] | 661 | <varlistentry id="rls">
|
---|
| 662 | <term><command>rls</command></term>
|
---|
| 663 | <listitem>
|
---|
| 664 | <para>
|
---|
| 665 | is the Rust Language Server. This can run in the background to
|
---|
| 666 | provide IDEs, editors, and other tools with information about Rust
|
---|
| 667 | programs.
|
---|
| 668 | </para>
|
---|
| 669 | <indexterm zone="rust rls">
|
---|
| 670 | <primary sortas="b-rls">rls</primary>
|
---|
| 671 | </indexterm>
|
---|
| 672 | </listitem>
|
---|
| 673 | </varlistentry>
|
---|
| 674 |
|
---|
[03d537cd] | 675 | <varlistentry id="rust-gdb">
|
---|
| 676 | <term><command>rust-gdb</command></term>
|
---|
| 677 | <listitem>
|
---|
| 678 | <para>
|
---|
[a7b1bddc] | 679 | is a wrapper script for gdb, pulling in Python
|
---|
| 680 | pretty-printing modules installed in <filename
|
---|
[68380724] | 681 | class="directory">/opt/rustc-&rust-version;/lib/rustlib/etc</filename>.
|
---|
[03d537cd] | 682 | </para>
|
---|
| 683 | <indexterm zone="rust rust-gdb">
|
---|
| 684 | <primary sortas="b-rust-gdb">rust-gdb</primary>
|
---|
| 685 | </indexterm>
|
---|
| 686 | </listitem>
|
---|
| 687 | </varlistentry>
|
---|
| 688 |
|
---|
[ec2353a] | 689 | <varlistentry id="rust-gdbgui">
|
---|
| 690 | <term><command>rust-gdbgui</command></term>
|
---|
| 691 | <listitem>
|
---|
| 692 | <para>
|
---|
| 693 | is a wrapper script for a graphical front end to gdb that runs in a
|
---|
| 694 | browser.
|
---|
| 695 | </para>
|
---|
| 696 | <indexterm zone="rust rust-gdbgui">
|
---|
| 697 | <primary sortas="b-rust-gdbgui">rust-gdbgui</primary>
|
---|
| 698 | </indexterm>
|
---|
| 699 | </listitem>
|
---|
| 700 | </varlistentry>
|
---|
| 701 |
|
---|
[03d537cd] | 702 | <varlistentry id="rust-lldb">
|
---|
| 703 | <term><command>rust-lldb</command></term>
|
---|
| 704 | <listitem>
|
---|
| 705 | <para>
|
---|
[a7b1bddc] | 706 | is a wrapper script for LLDB (the LLVM debugger)
|
---|
| 707 | pulling in the Python pretty-printing modules.
|
---|
[03d537cd] | 708 | </para>
|
---|
| 709 | <indexterm zone="rust rust-lldb">
|
---|
| 710 | <primary sortas="b-rust-lldb">rust=lldb</primary>
|
---|
| 711 | </indexterm>
|
---|
| 712 | </listitem>
|
---|
| 713 | </varlistentry>
|
---|
| 714 |
|
---|
| 715 | <varlistentry id="rustc">
|
---|
| 716 | <term><command>rustc</command></term>
|
---|
| 717 | <listitem>
|
---|
| 718 | <para>
|
---|
| 719 | is the rust compiler.
|
---|
| 720 | </para>
|
---|
| 721 | <indexterm zone="rust rustc">
|
---|
| 722 | <primary sortas="b-rustc">rustc</primary>
|
---|
| 723 | </indexterm>
|
---|
| 724 | </listitem>
|
---|
| 725 | </varlistentry>
|
---|
| 726 |
|
---|
| 727 | <varlistentry id="rustdoc">
|
---|
| 728 | <term><command>rustdoc</command></term>
|
---|
| 729 | <listitem>
|
---|
| 730 | <para>
|
---|
| 731 | generates documentation from rust source code.
|
---|
| 732 | </para>
|
---|
| 733 | <indexterm zone="rust rustdoc">
|
---|
| 734 | <primary sortas="b-rustdoc">rustdoc</primary>
|
---|
| 735 | </indexterm>
|
---|
| 736 | </listitem>
|
---|
| 737 | </varlistentry>
|
---|
| 738 |
|
---|
[a7b1bddc] | 739 | <varlistentry id="rustfmt">
|
---|
| 740 | <term><command>rustfmt</command></term>
|
---|
| 741 | <listitem>
|
---|
| 742 | <para>
|
---|
| 743 | formats rust code.
|
---|
| 744 | </para>
|
---|
| 745 | <indexterm zone="rust rustfmt">
|
---|
| 746 | <primary sortas="b-rustfmt">rustfmt</primary>
|
---|
| 747 | </indexterm>
|
---|
| 748 | </listitem>
|
---|
| 749 | </varlistentry>
|
---|
| 750 |
|
---|
[03d537cd] | 751 | <varlistentry id="libstd">
|
---|
| 752 | <term><filename class="libraryfile">libstd-<16-byte-hash>.so</filename></term>
|
---|
| 753 | <listitem>
|
---|
| 754 | <para>
|
---|
| 755 | is the Rust Standard Library, the foundation of portable Rust software.
|
---|
| 756 | </para>
|
---|
| 757 | <indexterm zone="rust libstd">
|
---|
| 758 | <primary sortas="c-libstd">libstd-<16-byte-hash>.so</primary>
|
---|
| 759 | </indexterm>
|
---|
| 760 | </listitem>
|
---|
| 761 | </varlistentry>
|
---|
| 762 | </variablelist>
|
---|
| 763 | </sect2>
|
---|
| 764 | </sect1>
|
---|