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