From 73b2841ee14caae80ea8a2bbaa1cb7e2c21e666f Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sun, 15 Mar 2015 23:29:31 +0000 Subject: Remove non-essential static libraries from the installation. Added a new section in Chapter 6 Introduction, supressed many static libraries in different packages, and removed the remaining in the Cleaning Up section. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10880 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter01/changelog.xml | 14 +++++++++++ chapter06/attr.xml | 9 +++---- chapter06/bison.xml | 13 ++++------ chapter06/eudev.xml | 1 + chapter06/expat.xml | 2 +- chapter06/flex.xml | 3 ++- chapter06/gdbm.xml | 4 ++- chapter06/gettext.xml | 4 ++- chapter06/gmp.xml | 5 ++-- chapter06/introduction.xml | 25 +++++++++++++++++++ chapter06/libcap.xml | 4 +++ chapter06/mpc.xml | 4 ++- chapter06/mpfr.xml | 1 + chapter06/ncurses.xml | 61 ++++++++++++++++++++++++++++----------------- chapter06/readline.xml | 4 ++- chapter06/revisedchroot.xml | 14 +++++++++-- chapter06/util-linux.xml | 1 + chapter06/xz.xml | 45 +++++++++++++++++++++++++-------- general.ent | 4 +-- prologue/bookinfo.xml | 4 +-- 20 files changed, 161 insertions(+), 61 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 8ce26e8d3..61f70cd57 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -36,6 +36,20 @@ --> + + 2015-03-15 + + + [bdubbs] - Remove non-essential static libraries + from the installation. Added a new section in Chapter 6 + Introduction, suppressed many static libraries in different + packages, and removed the remaining in the Cleaning Up section. + Fixes + #3751. + + + + 2015-03-11 diff --git a/chapter06/attr.xml b/chapter06/attr.xml index a7c995b15..d565b143c 100644 --- a/chapter06/attr.xml +++ b/chapter06/attr.xml @@ -45,15 +45,12 @@ directory: sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in - Prepare Attr for compilation: -./configure --prefix=/usr --bindir=/bin +./configure --prefix=/usr \ + --bindir=/bin \ + --disable-static Compile the package: diff --git a/chapter06/bison.xml b/chapter06/bison.xml index af13eef5d..568b34c9f 100644 --- a/chapter06/bison.xml +++ b/chapter06/bison.xml @@ -40,17 +40,14 @@ Installation of Bison + Inhibit static library installation: + +sed -i '/lib_LIBRARIES =/d' Makefile.in + Prepare Bison for compilation: ./configure --prefix=/usr --docdir=/usr/share/doc/bison-&bison-version; - + Compile the package: make diff --git a/chapter06/eudev.xml b/chapter06/eudev.xml index b9aca2c4c..c599c92e6 100644 --- a/chapter06/eudev.xml +++ b/chapter06/eudev.xml @@ -62,6 +62,7 @@ BLKID_LIBS='-L/tools/lib -lblkid' \ --enable-keymap \ --disable-introspection \ --disable-gudev \ + --disable-static \ --disable-gtk-doc-html Compile the package: diff --git a/chapter06/expat.xml b/chapter06/expat.xml index 5a3bbea81..b813a840e 100644 --- a/chapter06/expat.xml +++ b/chapter06/expat.xml @@ -43,7 +43,7 @@ Prepare Expat for compilation: -./configure --prefix=/usr +./configure --prefix=/usr --disable-static Compile the package: diff --git a/chapter06/flex.xml b/chapter06/flex.xml index 7ed596a94..f508fb0b2 100644 --- a/chapter06/flex.xml +++ b/chapter06/flex.xml @@ -47,7 +47,8 @@ Prepare Flex for compilation: -./configure --prefix=/usr --docdir=/usr/share/doc/flex-&flex-version; +./configure --prefix=/usr \ + --docdir=/usr/share/doc/flex-&flex-version; Compile the package: diff --git a/chapter06/gdbm.xml b/chapter06/gdbm.xml index 6457f1c83..662dc4324 100644 --- a/chapter06/gdbm.xml +++ b/chapter06/gdbm.xml @@ -46,7 +46,9 @@ Prepare GDBM for compilation: -./configure --prefix=/usr --enable-libgdbm-compat +./configure --prefix=/usr \ + --disable-static \ + --enable-libgdbm-compat The meaning of the configure option: diff --git a/chapter06/gettext.xml b/chapter06/gettext.xml index f1a236ae8..7ad8aeb69 100644 --- a/chapter06/gettext.xml +++ b/chapter06/gettext.xml @@ -45,7 +45,9 @@ Prepare Gettext for compilation: -./configure --prefix=/usr --docdir=/usr/share/doc/gettext-&gettext-version; +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/gettext-&gettext-version; Compile the package: diff --git a/chapter06/gmp.xml b/chapter06/gmp.xml index 6f4c2c7c9..c342d5f59 100644 --- a/chapter06/gmp.xml +++ b/chapter06/gmp.xml @@ -52,8 +52,9 @@ Prepare GMP for compilation: -./configure --prefix=/usr \ - --enable-cxx \ +./configure --prefix=/usr \ + --enable-cxx \ + --disable-static \ --docdir=/usr/share/doc/gmp-&gmp-version; diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml index a3a8b8829..ae0e54c58 100644 --- a/chapter06/introduction.xml +++ b/chapter06/introduction.xml @@ -55,4 +55,29 @@ The SBU values and required disk space includes test suite data for all applicable packages in Chapter 6. + + About libraries + + In general, the LFS editors discourage building and installing static + libraries. The original purpose for most static libraries has been made + obsolete in a modern Linux system. In addition linking a static library + into a program can be detrimental. If an update to the library is needed + to remove a security problem, all programs that use the static library will + need to be relinked to the new library. Since the use of static libraries + is not always obvious, deciding which programs (and the procedures needed to + do the linking) may not even be known. + + In the prcedures in Chapter 6, we remove or disable installation of + most static libraries. In a few cases, especially glibc and gcc, the use + of static libraries remains essential to the general package building + process. Usually this is done by passing a + option to configure. + In other cases, alternate means are needed. + + For a more complete discussion of libraries, see the discussion + + Libraries: Static or shared? in the BLFS book. + + + diff --git a/chapter06/libcap.xml b/chapter06/libcap.xml index 1a71b7b28..202a4b3a4 100644 --- a/chapter06/libcap.xml +++ b/chapter06/libcap.xml @@ -43,6 +43,10 @@ Installation of Libcap + Prevent a static library from being installed: + +sed -i '/install.*STALIBNAME/d' libcap/Makefile + Compile the package: make diff --git a/chapter06/mpc.xml b/chapter06/mpc.xml index a8b8818dc..cac9cc7fa 100644 --- a/chapter06/mpc.xml +++ b/chapter06/mpc.xml @@ -44,7 +44,9 @@ Prepare MPC for compilation: -./configure --prefix=/usr --docdir=/usr/share/doc/mpc-&mpc-version; +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/mpc-&mpc-version; Compile the package and generate the HTML documentation: diff --git a/chapter06/mpfr.xml b/chapter06/mpfr.xml index e4febcc9f..ab702f17a 100644 --- a/chapter06/mpfr.xml +++ b/chapter06/mpfr.xml @@ -49,6 +49,7 @@ Prepare MPFR for compilation: ./configure --prefix=/usr \ + --disable-static \ --enable-thread-safe \ --docdir=/usr/share/doc/mpfr-&mpfr-version; diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index 6761124d4..70aca29fe 100644 --- a/chapter06/ncurses.xml +++ b/chapter06/ncurses.xml @@ -41,15 +41,9 @@ Installation of Ncurses - +sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in Prepare Ncurses for compilation: @@ -57,6 +51,7 @@ --mandir=/usr/share/man \ --with-shared \ --without-debug \ + --without-normal \ --enable-pc-files \ --enable-widec @@ -85,6 +80,14 @@ + + --without-normal + + This switch disables building and installing most static libraries. + + + + Compile the package: @@ -119,11 +122,8 @@ for lib in ncurses form panel menu ; do rm -vf /usr/lib/lib${lib}.so echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so - ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc -done - -ln -sfv libncurses++w.a /usr/lib/libncurses++.a +done Finally, make sure that old applications that look for -lcurses at build time are still @@ -131,9 +131,7 @@ ln -sfv libncurses++w.a /usr/lib/libncurses++.a rm -vf /usr/lib/libcursesw.so echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so -ln -sfv libncurses.so /usr/lib/libcurses.so -ln -sfv libncursesw.a /usr/lib/libcursesw.a -ln -sfv libncurses.a /usr/lib/libcurses.a +ln -sfv libncurses.so /usr/lib/libcurses.so If desired, install the Ncurses documentation: @@ -168,14 +166,31 @@ cp -av lib/lib*.so.5* /usr/lib Installed directories - captoinfo (link to tic), clear, infocmp, infotocap (link to tic), - ncursesw5-config, reset (link to tset), tabs, tic, toe, tput, and tset - libcursesw.{a,so} (symlink and linker script to libncursesw.{a,so}), - libformw.{a,so}, libmenuw.{a,so}, libncurses++w.a, libncursesw.{a,so}, - libpanelw.{a,so}, and their non-wide-character counterparts without "w" - in the library names. - /usr/share/tabset, /usr/share/terminfo, and - /usr/share/doc/ncurses-&ncurses-version; + + captoinfo (link to tic), + clear, + infocmp, + infotocap (link to tic), + ncursesw5-config, + reset (link to tset), + tabs, + tic, + toe, + tput, and + tset + + + libcursesw.so (symlink and linker script to libncursesw.so), + libformw.so, + libmenuw.so, + libncursesw.so, + libpanelw.so, and their non-wide-character counterparts without "w" + in the library names. + + /usr/share/tabset, + /usr/share/terminfo, and + /usr/share/doc/ncurses-&ncurses-version; + diff --git a/chapter06/readline.xml b/chapter06/readline.xml index 1f8c63e56..5ddbdf9df 100644 --- a/chapter06/readline.xml +++ b/chapter06/readline.xml @@ -56,7 +56,9 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install Prepare Readline for compilation: -./configure --prefix=/usr --docdir=/usr/share/doc/readline-&readline-version; +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/readline-&readline-version; Compile the package: diff --git a/chapter06/revisedchroot.xml b/chapter06/revisedchroot.xml index 8927a9f29..d2980f76a 100644 --- a/chapter06/revisedchroot.xml +++ b/chapter06/revisedchroot.xml @@ -35,12 +35,22 @@ instructions for this (see ). -rm -rf /tools - If the virtual kernel file systems have been unmounted, either manually or through a reboot, ensure that the virtual kernel file systems are mounted when reentering the chroot. This process was explained in and . + Finally, thre were several static libraries that were not supressed earlier + in the chapter in order to satisfy the regression tests in several packages. These + libraries are from binutils, bzip2, e2fsprogs, flex, libtool, and zlib. If desired, + remove them now: + +rm /usr/lib/lib{bfd,opcodes}.a +rm /usr/lib/libbz2.a +rm /usr/lib/lib{com_err,e2p,ext2fs,ss}.a +rm /usr/lib/lib{fl,fl_pic}.a +rm /usr/lib/libltdl.a +rm /usr/lib/libz.a + diff --git a/chapter06/util-linux.xml b/chapter06/util-linux.xml index fcf7202b7..c0383410d 100644 --- a/chapter06/util-linux.xml +++ b/chapter06/util-linux.xml @@ -71,6 +71,7 @@ --disable-setpriv \ --disable-runuser \ --disable-pylibmount \ + --disable-static \ --without-python \ --without-systemd \ --without-systemdsystemunitdir diff --git a/chapter06/xz.xml b/chapter06/xz.xml index 77f3c298d..1ecdace87 100644 --- a/chapter06/xz.xml +++ b/chapter06/xz.xml @@ -46,7 +46,10 @@ Prepare Xz for compilation with: -./configure --prefix=/usr --docdir=/usr/share/doc/xz-&xz-version; + +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/xz-&xz-version; Compile the package: @@ -75,15 +78,37 @@ ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.soInstalled directories - lzcat (link to xz), lzcmp (link to xzdiff), lzdiff (link to - xzdiff), lzegrep (link to xzgrep), lzfgrep (link to xzgrep), - lzgrep (link to xzgrep), lzless (link to xzless), lzma (link to xz), - lzmadec, lzmainfo, lzmore (link to xzmore), - unlzma (link to xz), unxz, (link to xz), xz, xzcat (link to xz), - xzcmp (link to xzdiff), xzdec, xzdiff, xzegrep (link to xzgrep), - xzfgrep (link to xzgrep), xzgrep, xzless, and xzmore - liblzma.{a,so} - /usr/include/lzma and /usr/share/doc/xz-&xz-version; + + lzcat (link to xz), + lzcmp (link to xzdiff), + lzdiff (link to xzdiff), + lzegrep (link to xzgrep), + lzfgrep (link to xzgrep), + lzgrep (link to xzgrep), + lzless (link to xzless), + lzma (link to xz), + lzmadec, + lzmainfo, + lzmore (link to xzmore), + unlzma (link to xz), + unxz (link to xz), + xz, + xzcat (link to xz), + xzcmp (link to xzdiff), + xzdec, + xzdiff, + xzegrep (link to xzgrep), + xzfgrep (link to xzgrep), + xzgrep, + xzless, and + xzmore + + liblzma.so + + + /usr/include/lzma and + /usr/share/doc/xz-&xz-version; + diff --git a/general.ent b/general.ent index ffe192cf2..36c0cd393 100644 --- a/general.ent +++ b/general.ent @@ -1,7 +1,7 @@ - + - + diff --git a/prologue/bookinfo.xml b/prologue/bookinfo.xml index 5d95c53c5..a44a137a5 100644 --- a/prologue/bookinfo.xml +++ b/prologue/bookinfo.xml @@ -16,8 +16,8 @@ Beekmans - Edited by Matthew Burgess - and Bruce Dubbs + Managing Editor is Bruce + Dubbs -- cgit v1.2.3-54-g00ecf