Ignore:
Timestamp:
02/22/2004 10:32:27 PM (20 years ago)
Author:
Alex Gronenwoud <alex@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.0, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, v5_1, v5_1_1, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
f89de33
Parents:
cd0c92d6
Message:

Moving the final strip from the last chapter to the end of chapter 6.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3258 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter06/chapter06.xml

    rcd0c92d6 rb157558  
    503503
    504504
     505<sect1 id="ch-system-aboutdebug">
     506<title>About debugging symbols</title>
     507<?dbhtml filename="aboutdebug.html" dir="chapter06"?>
     508
     509<para>Most programs and libraries are, by default, compiled with debugging
     510symbols included (with <command>gcc</command>'s <emphasis>-g</emphasis>
     511option). This means that, when debugging a program or library that was compiled
     512with debugging information included, the debugger can give you not only memory
     513addresses but also the names of the routines and variables.</para>
     514 
     515<para>The inclusion of these debugging symbols, however, enlarges a program or
     516library significantly. To get an idea of the amount of space these symbols
     517occupy, have a look at the following:</para>
     518
     519<itemizedlist>
     520
     521<listitem><para>a bash binary
     522with debugging symbols: 1200 KB</para></listitem>
     523
     524<listitem><para>a bash binary
     525without debugging symbols: 480 KB</para></listitem>
     526
     527<listitem><para>Glibc and GCC files (/lib and /usr/lib)
     528with debugging symbols: 87 MB</para></listitem>
     529
     530<listitem><para>Glibc and GCC files
     531without debugging symbols: 16 MB</para></listitem>
     532
     533</itemizedlist>
     534
     535<para>Sizes may vary somewhat, depending on which compiler was used and which C
     536library, but when comparing programs with and without debugging symbols the
     537difference will generally be a factor between 2 and 5.</para>
     538
     539<para>As most people will probably never use a debugger on their system
     540software, a lot of disk space can be regained by removing these symbols. For
     541your convenience, the next section shows how to strip all debugging symbols
     542from all programs and libraries. Information on other ways of optimizing your
     543system can be found in the hint at <ulink
     544url="&hints-root;optimization.txt"/>.</para>
     545
     546</sect1>
     547
     548
     549<sect1 id="ch-system-strippingagain">
     550<title>Stripping again</title>
     551<?dbhtml filename="strippingagain.html" dir="chapter06"?>
     552
     553<para>If you are not a programmer and don't plan to do any debugging on your
     554system software, you can shrink your system by about 200 MB by removing the
     555debugging symbols from binaries and libraries. This causes no inconvenience
     556other than not being able to debug the software fully any more.</para>
     557
     558<para>Most people who use the command mentioned below don't experience any
     559problems. But it is easy to make a typo and render your new system unusable, so
     560before running the strip command it is probably a good idea to make a backup of
     561the current situation.</para>
     562
     563<para>If you are going to perform the stripping, special care is needed to
     564ensure you're not running any of the binaries that are about to be stripped.
     565If you're not sure whether you entered chroot with the command given in
     566<xref linkend="ch-system-chroot"/>, then now exit from chroot and reenter it
     567with the following commands:</para>
     568
     569<screen><userinput>logout; chroot $LFS /tools/bin/env -i \
     570&nbsp;&nbsp;&nbsp;&nbsp;HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
     571&nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr/bin:/sbin:/usr/sbin \
     572&nbsp;&nbsp;&nbsp;&nbsp;/tools/bin/bash --login</userinput></screen>
     573
     574<para>Now you can safely strip the binaries and libraries:</para>
     575
     576<screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
     577&nbsp;&nbsp;&nbsp;-exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
     578
     579<para>A large number of files will be reported as having their file format not
     580recognized. These warnings can be safely ignored, they just mean that those
     581files are scripts instead of binaries, no harm is done.</para>
     582
     583<para>If you are really tight on disk space, you may want to use
     584<emphasis>--strip-all</emphasis> on the binaries in
     585<filename>/{,usr/}{bin,sbin}</filename> to gain several more megabytes. But do
     586<emphasis>not</emphasis> use this option on libraries: they would be
     587destroyed.</para>
     588
     589</sect1>
     590
     591
    505592<sect1 id="ch-system-revisedchroot">
    506593<title>Revised chroot command</title>
    507594<?dbhtml filename="revisedchroot.html" dir="chapter06"?>
    508595
    509 <para>From now on when you exit the chroot environment and wish to re-enter
     596<para>From now on when you exit the chroot environment and wish to reenter
    510597it, you should run the following modified chroot command:</para>
    511598
     
    522609</sect1>
    523610
    524 
    525 &c6-aboutdebug;
    526 
    527611</chapter>
    528612
Note: See TracChangeset for help on using the changeset viewer.