Ignore:
Timestamp:
11/13/2023 01:09:47 PM (6 months ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
12.1, 12.1-rc1, multilib, trunk, xry111/arm64, xry111/clfs-ng, xry111/loongarch, xry111/loongarch-12.1, xry111/mips64el, xry111/update-glibc
Children:
95ebbb4
Parents:
e70bf8f
git-author:
Xi Ruoyao <xry111@…> (09/11/2023 06:42:06 AM)
git-committer:
Xi Ruoyao <xry111@…> (11/13/2023 01:09:47 PM)
Message:

settingenviron: Set MAKEFLAGS for parallelism in ~lfs/.bashrc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter04/settingenviron.xml

    re70bf8f ra0a803c  
    196196  </important>
    197197
     198  <para>
     199    For many modern systems with multiple processors (or cores) the
     200    compilation time for a package can be reduced by performing a "parallel
     201    make" by telling the make program how many processors are available via
     202    a command line option or an environment variable.  For instance, an Intel
     203    Core i9-13900K processor has 8 P (performance) cores and
     204    16 E (efficiency) cores, and a P core can simultaneously run two threads
     205    so each P core are modeled as two logical cores by the Linux kernel.
     206    As the result there are 32 logical cores in total.  One obvious way to
     207    use all these logical cores is allowing <command>make</command> to spawn
     208    up to 32 build jobs.  This can be done by passing the
     209    <parameter>-j32</parameter> option to <command>make</command>:
     210  </para>
     211
     212  <screen role='nodump'><userinput>make -j32</userinput></screen>
     213
     214  <para>
     215    Or set the <envar>MAKEFLAGS</envar> environment variable and its
     216    content will be automatically used by <command>make</command> as
     217    command line options:
     218  </para>
     219
     220  <screen role='nodump'><userinput>export MAKEFLAGS=-j32</userinput></screen>
     221
     222  <important>
     223    <para>
     224      Never pass a <parameter>-j</parameter> option without a number to
     225      <command>make</command> or set such an option in
     226      <envar>MAKEFLAGS</envar>.  Doing so will allow <command>make</command>
     227      to spawn infinite build jobs and cause system stability issue.
     228    </para>
     229  </important>
     230
     231  <para>
     232    To use all logical cores available for building packages in
     233    <xref linkend='chapter-cross-tools'/> and
     234    <xref linkend='chapter-temporary-tools'/>, set <envar>MAKEFLAGS</envar>
     235    now in <filename>.bashrc</filename>:
     236  </para>
     237
     238<screen><userinput>cat &gt;&gt; ~/.bashrc &lt;&lt; "EOF"
     239<literal>export MAKEFLAGS=-j<replaceable>$(nproc)</replaceable></literal>
     240EOF</userinput></screen>
     241
     242  <para>
     243    Replace <replaceable>$(nproc)</replaceable> with the number of logical
     244    cores you want to use if you don't want to use all the logical cores.
     245  </para>
     246
    198247  <para>Finally, to ensure the environment is fully prepared for building the
    199248  temporary tools, force the <command>bash</command> shell to read
Note: See TracChangeset for help on using the changeset viewer.