Changeset ec43904
- Timestamp:
- 07/10/2012 05:58:22 PM (12 years ago)
- Branches:
- 10.0, 10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, 7.10, 7.4, 7.5, 7.6, 7.6-blfs, 7.6-systemd, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, basic, bdubbs/svn, elogind, gnome, kde5-13430, kde5-14269, kde5-14686, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, krejzi/svn, lazarus, lxqt, nosym, perl-modules, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, systemd-11177, systemd-13485, trunk, upgradedb, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
- Children:
- 33e6618a
- Parents:
- 2f4014b
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
introduction/important/libraries.xml
r2f4014b rec43904 14 14 </sect1info> 15 15 16 <title>Libraries: static or shared</title>16 <title>Libraries: Static or shared?</title> 17 17 18 18 <!-- section g : 'Others' in longindex.html --> … … 22 22 23 23 <sect2 role="package"> 24 <title>Libraries: static or shared</title>24 <title>Libraries: Static or shared?</title> 25 25 26 <para>The original libraries were simply an archive of routines ,from which26 <para>The original libraries were simply an archive of routines from which 27 27 the required routines were extracted and linked into the executable program. 28 28 These are described as static libraries (libfoo.a). On some old operating 29 29 systems they are the only type available.</para> 30 30 31 <para>On almost all Linux platforms we also have shared libraries (libfoo.so) 32 - one copy of the library is loaded into vitual memory, and shared by all the 33 programs which call any of its functions. This is space efficient.</para> 31 <para>On almost all Linux platforms we also have shared libraries 32 (libfoo.so) - one copy of the library is loaded into virtual memory, and 33 shared by all the programs which call any of its functions. This is space 34 efficient.</para> 34 35 35 36 <para>In the past, essential programs such as a shell were often linked 36 37 statically so that some form of minimal recovery system would exist even if 37 shared libraries, such as libc.so, became damaged (e ,g,moved to38 shared libraries, such as libc.so, became damaged (e.g. moved to 38 39 <filename class="directory">lost+found</filename> after fsck following an 39 unclean shutdown). Nowadays, most people use an alternative system install ,40 or a Live CD , if they have to recover. Journalling filesystems also reduce40 unclean shutdown). Nowadays, most people use an alternative system install 41 or a Live CD if they have to recover. Journaling filesystems also reduce 41 42 the likelihood of this sort of problem.</para> 42 43 … … 53 54 library version is automatic once the newer library is installed and the 54 55 program is (re)started (provided the library major version is unchanged, 55 e.g. going from from libfoo.so.2.0 to libfoo.so.2.1 : going to libfoo.so.3 56 will require recompilation - use <command>ldd</command> to find what uses 57 the old version). If a program is linked to a static library, the program 58 always has to be recompiled. If you know which programs linked to a 59 particular static library, this is merely an annoyance. But usually you will 60 <emphasis>not</emphasis> know which programs to recompile.</para> 56 e.g. going from libfoo.so.2.0 to libfoo.so.2.1. Going to libfoo.so.3 57 will require recompilation - <command>ldd</command> can be used to find 58 which programs use the old version). If a program is linked to a static 59 library, the program always has to be recompiled. If you know which 60 programs are linked to a particular static library, this is merely an 61 annoyance. But usually you will <emphasis>not</emphasis> know which 62 programs to recompile.</para> 61 63 62 <para>Most libraries are shared, but if you do something unusual such as63 moving a shared library to <filename class="directory">/lib</filename> and64 accidentally break the <literal>.so</literal> symlink in65 <filename class="directory">/usr/lib</filename> but keep the static library66 there, the static library will be silently linked into the programs which67 need it.</para>64 <para>Most libraries are shared, but if you do something unusual, such as 65 moving a shared library to <filename class="directory">/lib</filename> 66 accidentally breaking the <literal>.so</literal> symlink in 67 <filename class="directory">/usr/lib</filename> while keeping the static 68 library in <filename class="directory">/lib</filename>, the static library 69 will be silently linked into the programs which need it.</para> 68 70 69 <para>One way to identify when a static library is used is to deal with it71 <para>One way to identify when a static library is used, is to deal with it 70 72 at the end of the installation of every package. Write a script to find all 71 the static libraries in /usr/lib or wherever you are installing to, and 72 either move them to another directory so that they are no longer found by 73 the linker, or rename them so that libfoo.a becomes e.g. libfoo.a.hidden. 74 You can then temporarily restore a static library if it is ever needed, and 75 make a note which package needs it. You may choose to exclude some of the 76 static libraries from glibc if you do this (<filename>libc_nonshared.a, 77 libg.a, libieee.a, libm.a, libpthread_nonshared.a, librpcsvc.a, 78 libsupc++.a</filename> to simplify compilation.</para> 73 the static libraries in <filename class="directory">/usr/lib</filename> or 74 wherever you are installing to, and either move them to another directory so 75 that they are no longer found by the linker, or rename them so that libfoo.a 76 becomes e.g. libfoo.a.hidden. The static library can then be temporarily 77 restored if it is ever needed, and the package needing it can be 78 identified. You may choose to exclude some of the static libraries from 79 glibc if you do this (<filename>libc_nonshared.a, libg.a, libieee.a, libm.a, 80 libpthread_nonshared.a, librpcsvc.a, libsupc++.a</filename>) to simplify 81 compilation.</para> 79 82 80 83 <!-- versions hardcoded in this para, it's a comment on those versions --> 81 <para>If you do that, you may discover that more packages than you were 82 expecting use a static library. That was the case with 83 <application>nettle-2.4</application> in its default static-only configuration: 84 required by <application>GnuTLS-3.0.19</application> but also linked into 85 package(s) which used that, such as 84 <para>If you use this approach, you may discover that more packages than 85 you were expecting use a static library. That was the case with 86 <application>nettle-2.4</application> in its default static-only 87 configuration: It was required by <application>GnuTLS-3.0.19</application>, 88 but also linked into package(s) which used 89 <application>GnuTLS</application>, such as 86 90 <application>glib-networking-2.32.3</application>.</para> 87 91 88 92 <para>Many packages put some of their common functions into a static 89 library which is only used by the programs within the package and 90 crucially is <emphasis>not</emphasis> installed as a standalone library.91 These internal libraries are not a problem - if the package has to be92 rebuilt to fix a bug or vulnerability, nothing else is linked to them.93 </para>93 library which is only used by the programs within the package and, 94 crucially, the library is <emphasis>not</emphasis> installed as a 95 standalone library. These internal libraries are not a problem - if the 96 package has to be rebuilt to fix a bug or vulnerability, nothing else is 97 linked to them.</para> 94 98 95 <para>When we speak of System libraries, we mean the shared versions. Some96 packages such as <xref linkend="firefox"/> and <xref linkend="gs"/> include97 many other libraries. When they link to them, they link statically so this98 also makes the programs bigger. The version they ship is often older than99 the version used in the system, so it may contain bugs - sometimes100 developers go to the trouble of fixing bugs in their included libraries,101 other times they do not.</para>99 <para>When BLFS mentions system libraries, it means shared versions of 100 libraries. Some packages such as <xref linkend="firefox"/> and 101 <xref linkend="gs"/> include many other libraries. When they link to them, 102 they link statically so this also makes the programs bigger. The version 103 they ship is often older than the version used in the system, so it may 104 contain bugs - sometimes developers go to the trouble of fixing bugs in 105 their included libraries, other times they do not.</para> 102 106 103 107 <para>Sometimes, deciding to use system libraries is an easy decision. Other 104 108 times it may require you to alter the system version (e.g. for 105 109 <xref linkend="libpng"/> if used for <xref linkend="firefox"/>). 106 Occasionally a package has an old shipped library, can no longer link to the107 current version, but can link to a less-old version : the book will usually108 just use the shipped version. Sometimes the included library is no longer109 developed separately, or its upstream is now the same as the package's110 upstream and you have no other packages which will use it. In those cases,111 you might decide to use the included static library even if you usually112 prefer to use system libraries.</para>110 Occasionally, a package ships an old library and can no longer link to 111 the current version, but can link to an older version. In this case, BLFS 112 will usually just use the shipped version. Sometimes the included library 113 is no longer developed separately, or its upstream is now the same as the 114 package's upstream and you have no other packages which will use it. 115 In those cases, you might decide to use the included static library even if 116 you usually prefer to use system libraries.</para> 113 117 114 118 <para condition="html" role="usernotes">User Notes: -
kde4/add/kde4admin.xml
r2f4014b rec43904 80 80 81 81 <bridgehead renderas="sect4">Optional</bridgehead> 82 <para role="optional"> 83 <xref linkend="python2"/>, 84 <!--<xref linkend="pykde4"/>, --> 85 <ulink url="http://www.riverbankcomputing.co.uk/software/pyqt/intro">PyQt4</ulink>, 82 <para role="optional"> 83 <ulink url="&kde-download-http;&kde-version;/src/">PyKDE4</ulink>, 86 84 <ulink url="http://cyberelk.net/tim/software/pycups/">PyCups</ulink> and 87 85 <ulink url="http://cyberelk.net/tim/software/system-config-printer/">system-config-printer</ulink> -
kde4/add/kde4plasmaaddons.xml
r2f4014b rec43904 80 80 <bridgehead renderas="sect4">Optional</bridgehead> 81 81 <para role="optional"> 82 <xref linkend="libkexiv2"/>, 82 <xref linkend="libkexiv2"/>, 83 83 <ulink url="http://edu.kde.org/marble/">Marble</ulink> (for the desktop globe wallpaper) and 84 84 <ulink url="http://eigen.tuxfamily.org/">Eigen</ulink> (for the Mandelbrot wallpaper plugin) -
kde4/core/kde4workspace.xml
r2f4014b rec43904 90 90 <xref linkend="libusb"/>, 91 91 <xref linkend="NetworkManager"/>, 92 <xref linkend="lm_sensors"/>, 92 <xref linkend="lm_sensors"/>, 93 <ulink url="&kde-download-http;&kde-version;/src/">PyKDE4</ulink>, 93 94 <ulink url="http://code.google.com/p/google-gadgets-for-linux/">GoogleGadgets</ulink>, 94 95 <ulink url="ftp://ftp.kde.org/pub/kde/stable/prison/1.0/src/">Prison</ulink>, -
postlfs/filesystems/lvm2.xml
r2f4014b rec43904 136 136 137 137 <seglistitem> 138 <seg>dmsetup, fsadm, lvm, lvmconf, lv ndump, vgimportclone. There139 are also numerous symbolic links to lvm to imp ement specific138 <seg>dmsetup, fsadm, lvm, lvmconf, lvmdump, vgimportclone. There 139 are also numerous symbolic links to lvm to implement specific 140 140 functionality.</seg> 141 141 <seg>libdevmapper.so</seg> … … 185 185 <listitem> 186 186 <para>is a script that modifies the locking configuration in 187 a nlvm configuration file.</para>187 a lvm configuration file.</para> 188 188 <indexterm zone="lvm2 lvmconf"> 189 189 <primary sortas="b-lvmconf">lvmconf</primary> -
postlfs/virtualization/virtualization.xml
r2f4014b rec43904 17 17 18 18 <para>Virtualization allows running a complete operating system, or virtual 19 machine (VM) within another operting environment as a task. There are19 machine (VM), within another operating environment as a task. There are 20 20 several commercial and open source environments that either emulate another 21 21 processor or utilize the hardware virtualization features of the host
Note:
See TracChangeset
for help on using the changeset viewer.