Introduction to the use of Ldconfig in Linux

Source: Internet
Author: User

Introduction to the use of Ldconfig in Linux

Ldconfig is a dynamic link Library management command designed to allow dynamic link libraries to be shared by the system.

Main uses of Ldconfig:

The default searches for/lilb and/usr/lib, as well as the library files in the directory listed in the configuration file/etc/ld.so.conf.

Search for a shareable dynamic-link library, with the format of the library file: lib***.so.**, which creates the connection and cache files required for the dynamic loader (ld.so).

The cache file defaults to/etc/ld.so.cache, which holds the list of dynamically linked library names that have been ordered.

Ldconfig usually runs at system startup, and when a user installs a new dynamic-link library, they need to run the command manually.

Ldconfig Command parameter Description:

1,-V, or--verbose: With this option, Ldconfig will display the directory being scanned and the dynamic-link library It was searching for, as well as the name of the connection it created.

2,-N: With this option, Ldconfig scans only the directories specified by the command line, does not scan the default directory (/lib,/usr/lib), and does not scan directories listed in the configuration file/etc/ld.so.conf.

3,-N: This option indicates that Ldconfig does not rebuild the cache file (/etc/ld.so.cache). If the-X option is not used, the connection to the file is updated Ldconfig as usual.

4.-X: This option indicates that Ldconfig does not update the file's connection. If the-n option is not used, the cache file is updated normally.

5,-F CONF: This option specifies that the profile for the dynamic link library is CONF and the system defaults to/etc/ld.so.conf.

6,-C cache: This option specifies that the generated cache file is cached, and the system defaults to/etc/ld.so.cache, which holds a list of queued, shareable, dynamic-link libraries.

7.-R root: This option changes the root of the application to be root (called 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.-r/usr/ ZZZ, when you open the configuration file/etc/ld.so.conf, the/usr/zzz/etc/ld.so.conf file is actually opened. With this option, you can greatly increase the flexibility of dynamic link library management.

8,-L: Typically, Ldconfig will automatically establish a connection to a dynamic-link library when it searches for a dynamic-link library. When you select this option, you will enter expert mode and you need to manually set up the connection. This is not required for general users.

9,-P or--print-cache: This option instructs Ldconfig to print out the names of all shared libraries that are saved by the current cache file.

10,-C format or--format=format: This option specifies the format in which the cache file is used, in total three types: LD (old format), new (newer format), and Compat (the default format).

11,-V: This option prints out the version information for Ldconfig and then exits.

12,-or--help or--usage: These three options have the same effect, which is to let Ldconfig print out its Help information and then exit.

Ldconfig areas to note:

1, to/lib and/usr/lib inside add things, is not modified/etc/ld.so.conf file, but after adding the need to call the next ldconfig, or the added library will not be found.

2, if the added library is not in/lib and/usr/lib inside, it is necessary to modify the/etc/ld.so.conf file, the file is appended to the path of the library, and then need to recall the next Ldconfig command. For example, when you install MySQL, its library file/usr/local/mysql/lib, you need to append 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 addition of the LIBRARY is not/lib or/usr/lib, but do not have permission to write/etc/ld.so.conf file, then you need to write a global variable Ld_library_path in the export, you can.

Introduction to the use of Ldconfig in Linux

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.