Open main menu

Wikibooks β

LPI Linux Certification/Manage Shared Libraries

< LPI Linux Certification


Detailed ObjectiveEdit

Weight: 1

Candidates should be able to determine the shared libraries that executable programs depend on and install them when necessary.

  • Key knowledge area(s):
    • Identify shared libraries.
    • Identify the typical locations of system libraries.
    • Load shared libraries.
  • The following is a partial list of the used files, terms and utilities:
    • ldd
    • ldconfig
    • /etc/

Shared librariesEdit

A library is a set of functions that programs can use to implement their functionalities. When building (linking) a program, those libraries can be statically or dynamically linked to an executable. Static link means that the final program will contain the library function within its file. (lib.a) Dynamic link means that the needed libraries would need to be loaded into RAM when the program needs to be executed. (

The default directories for all the standard libraries are:

  • /lib: Used mainly by /bin programs.
  • /usr/lib: Used mainly by /usr/bin programs.

The file /etc/ is used by the system to specify other library locations. To build a cache file used by the runtime loader of all the available libraies, use ldconfig. The file /etc/ will be generated.

Library dependenciesEdit

To print shared programs or library dependencies, use ldd.

ldd [-vdr] program|library


$ ldd -d -v /bin/cp => /lib/ (0x40027000)
  /lib/ => /lib/ (0x40000000)

  Version information:
      (GLIBC_2.1.3) => /lib/
      (GLIBC_2.1) => /lib/
      (GLIBC_2.2) => /lib/
      (GLIBC_2.0) => /lib/
      (GLIBC_2.1.1) => /lib/
      (GLIBC_2.2.3) => /lib/
      (GLIBC_2.1) => /lib/
      (GLIBC_2.2) => /lib/
      (GLIBC_2.0) => /lib/

Runtime loaderEdit

The runtime loader finds the needed library of a program and will load them into RAM. The search order of is:

  • The cache file /etc/
  • The default directories /lib and /usr/lib.