Introduction to ldconfig in Linux

Source: Internet
Author: User

Ldconfig is a dynamic link library management command to share the dynamic link library with the system.

Main uses of ldconfig:

Search for/lilb and/usr/lib by default, and the library files under the directories listed in the configuration file/etc/lD. So. conf.

Search for a shared dynamic link library. The format of the library file is lib ***. so. ** to create a dynamic loader (LD. so) the required connection and cache file.

The default cache file is/etc/lD. So. cache. This file stores the list of Dynamic Linked Library names sorted.

Ldconfig is usually run when the system starts. When you install a new dynamic link library, you need to manually run this command.

Ldconfig command parameters:

1.-V or -- verbose: When this option is used, ldconfig displays the directory being scanned, The searched dynamic link library, and the name of the connection it created.

2.-N: When this option is used, ldconfig only scans the directory specified by the command line and does not scan the default directory (/lib,/usr/lib ), nor scan the configuration file/etc/lD. so. conf directory.

3.-N: This option indicates that ldconfig does not recreate the cache file (/etc/lD. So. cache). If the-x option is not used, ldconfig updates the file connection as usual.

4.-X: This option indicates that ldconfig does not update the file connection. If the-n option is not used, the cached file will be updated normally.

5.-F conf: This option specifies that the configuration file of the dynamic link library is Conf, and the default value is/etc/lD. So. conf.

6.-C cache: This option specifies that the generated cache file is cache. The default value is/etc/lD. so. cache. This file stores the list of dynamically linked libraries that can be shared in the sorted order.

7.-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, which corresponds to root/etc/lD. so. conf. for example, when-r/usr/ZZZ is used, open the configuration file/etc/lD. so. in Conf,/usr/ZZZ/etc/LD is actually enabled. so. CONF file. this option can greatly increase the flexibility of dynamic link library management.

8.-L: Generally, ldconfig automatically establishes a connection to the dynamic link library when searching for a dynamic link library. when this option is selected, the expert mode is enabled. You need to manually set the connection. this option is not required for general users.

9.-P or -- print-Cache: This option indicates that ldconfig prints the names of all the shared libraries saved in the current cache file.

10.-C format or -- format = format: This option is used to specify the format used by the cache file. There are three types: LD (old format), new (new format) and compat (compatible format, which is the default format ).

11.-V: This option prints the version information of ldconfig and then exits.

12.-Or
-- Help or -- Usage:
The three options share the same role, so that ldconfig prints the help information and then exits .,

Ldconfig:

1. add something to/lib and/usr/lib without modifying/etc/lD. so. CONF file, but after adding it, you need to call ldconfig. Otherwise, the added library will not be found.

2. If the added library is not in/lib and/usr/lib, you must modify/etc/lD. so. CONF file, append the path of the Library to the file, and then call the ldconfig command again. For example, when installing MySQL, the library file/usr/local/MySQL/lib needs to be appended to the/etc/lD. So. conf file. The command is as follows:

# Echo "/usr/local/MySQL/lib">/etc/lD. So. conf

# Ldconfig-v | grep MySQL

3. If the added library is not under/lib or/usr/lib, but you do not have the permission to write/etc/lD. so. in the conf file, you need to write a global variable LD_LIBRARY_PATH to the export.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.