Changeset 97e7219


Ignore:
Timestamp:
01/18/2023 03:16:10 AM (15 months ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
11.3, 12.0, 12.1, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, lazarus, lxqt, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, xry111/llvm18, xry111/xf86-video-removal
Children:
0f9a1f08, 4fe5cec
Parents:
aa5add9
git-author:
Xi Ruoyao <xry111@…> (01/18/2023 03:07:48 AM)
git-committer:
Xi Ruoyao <xry111@…> (01/18/2023 03:16:10 AM)
Message:

rust: revise config.toml entries (#17520)

  • Add locked-deps = true and vendor = true. These allows building the package w/o downloading from crates.io (the bootstrap compiler still needs to be downloaded though), and eliminates the necessity of using a DESTDIR installation. Note that in LFS we already do DESTDIR installation for ncurses so we won't lose too much educational material.
  • Add description = "for BLFS &version;" so BLFS version will show up in the output of rustc --version.
  • Remove rpath = false. With rpath we can skip the modification of /etc/ld.so.conf file. Note that rpath is coded as $ORIGIN/../lib, so if you run ldd on the executable in the build directory, it will show the path to the build directory; but if you run ldd on the installed executable, it will show the correct path to the installed library. See man ld.so for more information about $ORIGIN.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • general/prog/rust.xml

    raa5add9 r97e7219  
    99  <!ENTITY rust-md5sum        "96b082a8b44707eafa9d696923f40c28">
    1010  <!ENTITY rust-size          "136 MB">
    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'
    14        to measure it, or du -sm to look at the size of the build tree before and
    15        after the tests. -->
    16 
    17   <!ENTITY rust-buildsize     "9.4 GB (674 MB installed) including 360 MB of ~/.cargo files for the user building this. Add 6.5 GB including extra 312 MB of ~/.cargo files if running the tests">
     11  <!ENTITY rust-buildsize     "9.1 GB (323 MB installed); add 6.2 GB if running the tests">
    1812  <!ENTITY rust-time          "17 SBU (including download time; add 23 SBU for tests, both on a 4-core machine)">
    1913]>
     
    4741    <para>
    4842      As with many  other programming languages, rustc (the rust compiler)
    49       needs a binary from which to bootstrap. It will download a stage0 binary
    50       and many cargo crates (these are actually .tar.gz source archives) at
    51       the start of the build, so you cannot compile it without an internet
    52       connection.
    53     </para>
    54 
    55     <para>
    56       These crates will then remain in various forms (cache, directories of
    57       extracted source), in <filename class="directory">~/.cargo</filename> for
    58       ever more. It is common for large <application>rust</application> packages
    59       to use multiple versions of some crates. If you purge the files before
    60       updating this package, very few crates will need to be updated by the
    61       packages in this book which use it (and they will be downloaded as
    62       required). But if you retain an older version as a fallback option and
    63       then use it (when <emphasis>not</emphasis> building in
    64       <filename class="directory">/usr</filename>), it is likely that it will
    65       then have to re-download some crates. For a full download (i.e. starting
    66       with an empty or missing <filename class="directory">~/.cargo</filename>)
    67       downloading the external cargo files for this version only takes a minute
    68       or so on a fast network.
     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.
    6946    </para>
    7047
     
    8966      <para>
    9067        If you prefer, you can of course change the prefix to <filename
    91         class="directory">/usr</filename> and omit the
    92         <command>ldconfig</command> and the actions to add rustc to the PATH.
     68        class="directory">/usr</filename>.
    9369      </para>
    9470    </note>
     
    138114        often reasonably consistent, but as with all compilations using
    139115        <command>rustc</command> there can be some very slow outliers.
    140       </para>
    141       <para>
    142         Unusually, a DESTDIR-style method is being used to install this package.
    143         This is because running the install as root not only downloads all of the
    144         cargo files again (to <filename>/root/.cargo</filename>), it then spends
    145         a very long time recompiling. Using this method saves a lot of time, at
    146         the cost of extra disk space.
    147116      </para>
    148117    </note>
     
    305274extended = true
    306275
     276# Do not query new versions of dependencies online.
     277locked-deps = true
     278
    307279# Specify which extended tools (those from the default install).
    308280tools = ["cargo", "clippy", "rustfmt"]
     281
     282# Use the source code shipped in the tarball for the dependencies.
     283# The combination of this and the "locked-deps" entry avoids downloading
     284# many crates from Internet, and makes the Rustc build more stable.
     285vendor = true
    309286
    310287[install]
     
    314291[rust]
    315292channel = "stable"
    316 rpath = false
     293description = "for BLFS &version;"
    317294
    318295# BLFS used to not install the FileCheck executable from llvm,
     
    370347    </para>
    371348
    372 <screen remap="test"><userinput>export LD_LIBRARY_PATH=$PWD/build/x86_64-unknown-linux-gnu/stage1/lib/ &amp;&amp;
    373 python3 ./x.py test --verbose --no-fail-fast | tee rustc-testlog
    374 unset LD_LIBRARY_PATH</userinput></screen>
     349<screen remap="test"><userinput>python3 ./x.py test --verbose --no-fail-fast | tee rustc-testlog</userinput></screen>
    375350
    376351    <para>
     
    417392
    418393    <para>
    419       Still as your normal user, do a DESTDIR install:
    420     </para>
    421 
    422 <screen><userinput>DESTDIR=${PWD}/install python3 ./x.py install &amp;&amp;</userinput></screen>
    423 
    424     <para>
    425       Now, as the <systemitem class="username">root</systemitem> user
    426       install the files from the DESTDIR:
    427     </para>
    428 
    429 <screen role="root"><userinput>chown -R root:root install &amp;&amp;
    430 cp -a install/* /</userinput></screen>
     394      Now, as the &root; user, install the package:
     395    </para>
     396
     397<screen role='root'><userinput>python3 ./x.py install</userinput></screen>
    431398
    432399  </sect2>
     
    444411    <para>
    445412      <command>targets = "X86"</command>: this avoids building all the available
    446       linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc). Unfortunately,
     413      linux cross-compilers (AArch64, MIPS, PowerPC, SystemZ, etc). Unfortunately,
    447414      rust insists on installing source files for these below
    448415      <filename class="directory">/opt/rustc/lib/src</filename>.
     
    450417
    451418    <para>
    452       <command>extended = true</command>: this installs Cargo alongside Rust.
     419      <command>extended = true</command>: this installs several tools
     420      (specified by the <literal>tools</literal> entry) alongside
     421      <command>rustc</command>.
    453422    </para>
    454423
     
    470439    </para>
    471440
    472     <para>
    473       <command>rpath = false</command>: by default, <command>rust</command> can
    474       be run from where it was built, without being installed. That adds DT_RPATH
    475       entries to all of the ELF files, which produces very messy output from
    476       <command>ldd</command>, showing the libraries in the place they were built,
    477       even if they have been deleted from there after the install.
    478     </para>
    479 
    480441    <!-- comment while using shipped LLVM -->
    481442    <para>
     
    513474
    514475    <para>
    515       <command>export LD_LIBRARY_PATH=$PWD/build/x86_64-unknown-linux-gnu/stage1/lib/</command>:
    516       In builds where rpath is enabled, the stage1 libraries can be used by the
    517       tests. But BLFS has disabled rpath: this environment variable allows a lot
    518       more tests to run. Without it there are no reported failures in most runs,
    519       but some odd messages in the test log implying failures.
    520     </para>
    521 
    522     <para>
    523476      <command>--verbose</command>: this switch can sometimes provide more
    524477      information about a test which fails.
     
    528481      <command>--no-fail-fast</command>: this switch ensures that the test suite
    529482      will not stop at the first error.
    530     </para>
    531 
    532     <para>
    533       <command>DESTDIR=${PWD}/install python3 ./x.py install</command>: This
    534       effects a DESTDIR-style install in the source tree,creating an <filename
    535       class="directory">install</filename> directory. Note that DESTDIR installs
    536       need an absolute path, passing 'install' will not work.
    537     </para>
    538 
    539     <para>
    540       <command>chown -R root:root install</command>: the DESTDIR install
    541       was run by a regular user, who owns the files. For security, change their
    542       owner before doing a simple copy to install them.
    543483    </para>
    544484
     
    557497        is correctly found by other packages and system processes.
    558498      </para>
    559 
    560       <para>
    561         As the <systemitem class="username">root</systemitem> user, update
    562         the <filename>/etc/ld.so.conf</filename> file and the dynamic linker's
    563         run-time cache file:
    564       </para>
    565 
    566 <screen role="root"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; EOF
    567 <literal># Begin rustc addition
    568 
    569 /opt/rustc/lib
    570 
    571 # End rustc addition</literal>
    572 EOF
    573 
    574 ldconfig</userinput></screen>
    575 
    576       <indexterm zone="rust rustc-config">
    577         <primary sortas="e-etc-ld.so.conf">/etc/ld.so.conf</primary>
    578       </indexterm>
    579499
    580500      <para>
Note: See TracChangeset for help on using the changeset viewer.