ldconfig

Dynamic link library management commands

Supplementary instructions

The purpose of the ldconfig command is mainly to search for available files in the default search directories /lib and /usr/lib and the directories listed in the dynamic library configuration file /etc/ld.so.conf Shared dynamic link library (format such as lib*.so*), and then create the connection and cache files required by the dynamic loader (ld.so). The cache file defaults to /etc/ld.so.cache. This file saves a sorted list of dynamic link library names. In order to make the dynamic link library shared by the system, you need to run the dynamic link library management command ldconfig. This The executable program is stored in the /sbin directory.

ldconfig is usually run when the system starts, but when the user installs a new dynamic link library, this command needs to be run manually.

grammar

ldconfig [-v|--verbose] [-n] [-N] [-X] [-f CONF] [-C CACHE] [-r ROOT] [-l] [-p|--print-cache] [-c FORMAT] [--format=FORMAT] [-V] -?|--[help|--usage] path...

Options

-v or --verbose: When using this option, ldconfig will display the directories being scanned and the dynamic link libraries searched, as well as the names of the connections it creates.
-n: When using this option, ldconfig only scans the directories specified on the command line, not the default directories (/lib, /usr/lib), nor the directories listed in the configuration file /etc/ld.so.conf.
-N: This option instructs ldconfig not to rebuild the cache file (/etc/ld.so.cache). If the -X option is not used, ldconfig updates the file connection as usual.
-X: This option instructs ldconfig not to update the file connection. If the -N option is not used, the cached file will be updated normally.
-f CONF: This option specifies the configuration file of the dynamic link library as CONF, and the system default is /etc/ld.so.conf.
-C CACHE: This option specifies that the generated cache file is CACHE. The system default is /etc/ld.so.cache. This file stores a sorted list of shareable dynamic link libraries.
-r ROOT: This option changes the root directory of the application to ROOT (implemented by calling the chroot function). When this option is selected, the system default configuration file /etc/ld.so.conf actually corresponds to ROOT/etc/ld.so.conf. For example, when -r /usr/zzz is used, when the configuration file /etc/ld.so.conf is opened, the /usr/zzz/etc/ld.so.conf file is actually opened. Using this option can greatly increase the flexibility of dynamic link library management.
-l: Normally, ldconfig will automatically establish a connection to the dynamic link library when searching for the dynamic link library. When this option is selected, the expert mode will be entered and the connection needs to be set manually. General users do not need this option.
-p or --print-cache: This option instructs ldconfig to print out the names of all shared libraries saved in the current cache file.
-c FORMAT or --format=FORMAT: This option is used to specify the format used for cache files. There are three types: old (old format), new (new format) and compat (compatible format, this is the default format).
-V: This option prints out the version information of ldconfig and then exits.
-? or --help or --usage: These three options have the same effect. They all cause ldconfig to print out its help information and then exit.

Some things to note about ldconfig: