1684 views|0 replies

3836

Posts

19

Resources
The OP
 

About the use and description of idconfig [Copy link]

ldconfig is a dynamic link library management command, its purpose is to make the dynamic link library shared by the system.

The main uses of ldconfig:

By default, library files are searched in /lilb and /usr/lib, as well as in directories listed in the configuration file /etc/ld.so.conf.

Search for the shareable dynamic link library, the format of the library file is: lib***.so.**, and then create the connection and cache files required by the dynamic loader (ld.so).

The default cache file is /etc/ld.so.cache, which stores a sorted list of dynamic link library names.

ldconfig is usually run when the system starts, and when the user installs a new dynamic link library, this command needs to be run 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 searches for, as well as the name of the connection it creates.

2. -n: When this option is used, 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.

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 file connection as usual.

4. -X: This option instructs ldconfig not to update the file link. If the -N option is not used, the cache file is updated normally.

5. -f CONF: This option specifies the configuration file of the dynamic link library as CONF, and the system defaults to /etc/ld.so.conf.

6. -C CACHE: This option specifies that the generated cache file is CACHE. The system default is /etc/ld.so.cache, which stores a list of sorted shareable dynamic link libraries.

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 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 file /usr/zzz/etc/ld.so.conf is actually opened. This option can greatly increase the flexibility of dynamic link library management.

8. -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, it will enter expert mode and you need to manually set the connection. General users do not use this option.

9. -p or --print-cache: This option instructs ldconfig to print out the names of all 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 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: These three options have the same effect, all of which make ldconfig print out its help information and then exit.

Things to note about ldconfig:

1. When adding things to /lib and /usr/lib, you do not need to modify the /etc/ld.so.conf file, but you need to call ldconfig after adding, otherwise the added library will not be found.

2. If the added library is not in /lib and /usr/lib, you must modify the /etc/ld.so.conf file, add the path of the library to the file, and then call the ldconfig command again. For example, when installing MySQL, its library file /usr/local/mysql/lib needs to be added 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 in /lib or /usr/lib, but you do not have permission to write the /etc/ld.so.conf file, you need to write a global variable LD_LIBRARY_PATH to the export.

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list