Manage Libraries With ldconfig Command In Linux – POFTUT

Manage Libraries With ldconfig Command In Linux


Linux applications, tools, services uses libraries to get necessary functionalities. Libraries provides a lot of functionality to the related applications, tools and services. One library can be used by different applications. This is called dynamic library using or loading.

Shared Libraries

Shared libraries reside in /lib , /lib64 and /usr/lib . Each library is put into related directories like apt , gcc or similar. Dynamic libraries generally have extension .so but there are also some version related numbering.

For example libvte.so.9 is a dynamic library for vte which version is 9 .

Shared Libraries
Shared Libraries

Add Path To ldconfig

Some times the required libraries for the executable is not located in the standard paths. The default library path is hold in LD_LIBRARY_PATH environments variable. We should add new path to this variable. In the example we assume that the new library path is /foo

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/foo
Add Path To ldconfig
Add Path To ldconfig

Rebuild Cache

ldconfig is located at /etc/ld.so.conf which content is like below. We will add the library path with include command. The final content will be like below.

include /etc/ld.so.conf.d/*.conf 
include /foo

Now we will run the ldconfig -p command to read configuration file and rebuild the cache.

$ ldconfig -p

LEARN MORE  How To Set Path In Bash Shell Linux?

Leave a Comment