Linux ldconfig command and linuxldconfig command
I. Introduction
Ldconfig is a dynamic link library management command. To share the dynamic link library with the system, you also need to run the dynamic link library management command-ldconfig. The ldconfig command is mainly used in the default search directory (/lib and/usr/lib) and dynamic library configuration file/etc/ld. so. find the shared dynamic link library under the directory listed in conf (format as described earlier, lib *. so *) to create a dynamic loader (ld. so) the required connection and cache file. the default cached file is/etc/ld. so. cache. This file stores the list of Dynamic Linked Library names in the sorted order.
Ii. Precautions
1. add content in/lib and/usr/lib without modifying/etc/ld. so. conf, but you need to execute ldconfig, otherwise the library will not find 2. to add content outside the preceding two directories, you need to modify/etc/ld. so. conf and execute ldconfig. Otherwise, the library will not be able to find
For example, if you install mysql to/usr/local/mysql, mysql has a lot of Libraries under/usr/local/mysql/lib. In this case, you need to install mysql in/etc/ld. so. add/usr/local/mysql/lib under conf and run ldconfig.
3. if you want to put lib out of these two directories, you do not want to put it in/etc/ld. so. add content in conf. You can export a global variable LD_LIBRARY_PATH, and then find the library in this directory when running the program. Generally, this is only a temporary solution, which is used when you do not have the permission or need it temporarily. ldconfig is related to running the program and has nothing to do with compiling. During compilation, you should add-L instead of obfuscation. in short, it is recommended that ldconfig be used no matter what changes are made to the library. Otherwise, unexpected results may occur. It won't take too much time, but it will save a lot of trouble.