stripping.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. ]>
  7. <sect1 id="ch-tools-stripping">
  8. <?dbhtml filename="stripping.html"?>
  9. <title>Stripping</title>
  10. <para>The steps in this section are optional, but if the LFS partition is
  11. rather small, it is beneficial to learn that unnecessary items can be removed.
  12. The executables and libraries built so far contain about 70 MB of unneeded
  13. debugging symbols. Remove those symbols with:</para>
  14. <screen><userinput>$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
  15. $LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*</userinput></screen>
  16. <para>These commands will skip a number of files, reporting that it does not
  17. recognize their file format. Most of these are scripts instead of binaries.
  18. Note that we use the <command>strip</command> program built in
  19. <quote>Binutils pass 1</quote>, since it is the one that knows how to strip
  20. our cross-compiled programs.</para>
  21. <!-- Normally, the host "strip" could be used too, since it is actually the
  22. same computer. But Some old versions of binutils may generate buggy crt1.o
  23. and the like, because they do not know about recently introduced symbol
  24. types. For more details,
  25. see https://sourceware.org/bugzilla/show_bug.cgi?id=22875-->
  26. <para>Take care <emphasis>not</emphasis> to use
  27. <parameter>--strip-unneeded</parameter> on the libraries. The static
  28. ones would be destroyed and the toolchain packages would need to be
  29. built all over again.</para>
  30. <para>To save more, remove the documentation:</para>
  31. <screen><userinput>rm -rf $LFS/usr/{,share}/{info,man,doc}</userinput></screen>
  32. <para>The libtool .la files are only useful when linking with static
  33. libraries. They are unneeded, and potentially harmful, when using dynamic
  34. shared libraries, specially when using also non-autotools build systems.
  35. Remove those files now:</para>
  36. <screen><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
  37. <para>At this point, you should have at least 3 GB of free space in
  38. <envar>$LFS</envar> that can be used to build and install Glibc and Gcc in
  39. the next phase. If you can build and install Glibc, you can build and install
  40. the rest too.</para>
  41. </sect1>