- Timestamp:
- 07/29/2002 07:09:14 PM (22 years ago)
- 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, 12.2, 12.2-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, v4_0, v4_1, v5_0, 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/loongarch-12.2, xry111/mips64el, xry111/multilib, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- ad58f79
- Parents:
- 9be68e9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/whystatic.xml
r9be68e9 r415157ef 20 20 library attached to the program. Just imagine if you had a simple command 21 21 like ls with an extra 2.5 MB attached to it! Instead of making the library 22 an actual part of the program, or statically linked, the library is stored as a23 separate file, which is loaded only when the program needs it. This is what 24 we call dynamically linked, as the library is loaded and unloaded dynamically, 25 as the program needs it.</para>22 an actual part of the program, or statically linked, the library is stored 23 as a separate file, which is loaded only when the program needs it. This 24 is what we call dynamically linked, as the library is loaded and unloaded 25 dynamically, as the program needs it.</para> 26 26 27 <para>So now we have a 1 KB file and a 2.5 MB file, but we still haven't saved any 28 space (except maybe RAM until the library is needed). The 29 <emphasis>real</emphasis> advantage of 30 dynamically linked libraries is that we only need one copy of the library. 31 If <filename>ls</filename> and <filename>rm</filename> both use the same 32 library, then we don't need two copies of the 33 library, as they can both get the code from the same file. 27 <para>So now we have a 1 KB file and a 2.5 MB file, but we still haven't 28 saved any space (except maybe RAM until the library is needed). The 29 <emphasis>real</emphasis> advantage of dynamically linked libraries is 30 that we only need one copy of the library. If <filename>ls</filename> and 31 <filename>rm</filename> both use the same library, then we don't need two 32 copies of the library, as they can both get the code from the same file. 34 33 Even when in memory, the two programs share the same code, rather than loading 35 34 duplicates into memory. So not only are we saving hard disk space, but also … … 43 42 from within your LFS root (<filename>$LFS</filename>).</para> 44 43 45 <para>So in order for your new programs to run inside the chroot environment you46 need to make sure that the libraries are statically linked when you build44 <para>So in order for your new programs to run inside the chroot environment 45 you need to make sure that the libraries are statically linked when you build 47 46 them, hence the <userinput>--enable-static-link</userinput>, 48 47 <userinput>--disable-shared</userinput>, and … … 58 57 happens when you chroot into your newly crippled LFS system.</para> 59 58 60 <para>If you want to know more about Dynamically Linked Libraries, consult a61 book or website on programming, especially a Linux-related site.</para>59 <para>If you want to know more about Dynamically Linked Libraries, consult 60 a book or website on programming, especially a Linux-related site.</para> 62 61 63 62 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.