Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the purpose of the ldconfig command

2025-03-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What is the role of the ldconfig command, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Ldconfig is a dynamic link library management command

In order to make the dynamic link library shared by the system, it is necessary to run the management command of the dynamic link library-ldconfig

The main purpose of the ldconfig command is to search out the shareable dynamic link library (lib*.so*) under the default search directory (/ lib and / usr/lib) and the directory listed in the dynamic library configuration file / etc/ld.so.conf, and then create the connection and cache files needed by the dynamic loader (ld.so). The cache file defaults to / etc/ld.so.cache, which holds a sorted list of dynamic link library names.

Ldconfig usually runs at system startup, but you need to run this command manually when you install a new dynamic link library.

The ldconfig command line usage is as follows:

Ldconfig [- v |-- verbose] [- n] [- N] [- X] [- f CONF] [- C CACHE] [- r ROOT] [- l] [- p |-- print-cache]

[- c FORMAT] [--format=FORMAT] [- V] [-? |-- help |-- usage] path...

The options available for ldconfig are described as follows:

(1)-v or-- verbose: when using this option, ldconfig will display the directory being scanned and the dynamic link library searched, as well as the name of the connection it created.

(2)-n: with this option, ldconfig scans only the directories specified on the command line, not the default directory (/ lib,/usr/lib), nor the directories listed in the configuration file / etc/ld.so.conf.

(3)-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 connection to the file as usual.

(4)-X: this option instructs ldconfig not to 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 configuration file of 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 CACHE, and the system defaults to / etc/ld.so.cache, which holds a sorted list of shareable dynamic link libraries.

(7)-r ROOT: this option changes the application's root directory to ROOT (implemented by calling the chroot function). When this option is selected, the default configuration file / etc/ld.so.conf of the system is actually ROOT/etc/ld.so.conf. If you use-r / usr/zzz, when you open the configuration file / etc/ld.so.conf, you actually open the / usr/zzz/etc/ld.so.conf file. With this option, you can greatly increase the flexibility of dynamic link library management.

(8)-l: normally, when ldconfig searches for dynamic link libraries, the connection of dynamic link libraries will be established automatically. When you select this option, you will enter expert mode and need to set up the connection manually. Ordinary users do not need this item.

(9)-p or-- print-cache: this option instructs ldconfig to print out the names of all shared libraries saved by the current cache file.

(10)-c FORMAT or-- format=FORMAT: this option specifies the format used by the cache file. There are three formats: ld (old format), new (new format), and compat (compatible format, which is the default format).

(11)-V: this option prints out the version information of ldconfig and then exits.

(12)? Or-- help or-- usage: all three options have the same effect, asking ldconfig to print out its help information and then exit.

The shared library mechanism under linux uses a mechanism similar to caching to store library information in / etc/ld.so.cache.

When the program is connected, first look up from this file, and then go to the path of ld.so.conf to look for it in detail.

That's why you modified ld.so.conf to rerun ldconfig.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report