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