Before learning about the functions of files in the/etc/lD. So. conf. d/directory, we will first introduce several methods for running programs to load dynamic libraries:
First, run the ldconfig command
The ldconfig command is mainly used in the default search directory (/lib and/usr/lib) and dynamic library configuration file/etc/lD. so. search for the shared dynamic link library (Format: 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.
The key content involved here is the command ldconfig, configuration file directory:/etc/lD. so. conf. d. The configuration file is in/etc/lD. so. the conf content is edited by the user and buffered file/etc/lD. so. cache. The following is an example. For example, when you deploy software, some dynamic libraries are installed in the EXE Directory, which can be implemented using the following method,
1) configure the exe. conf file and add a line ~ /EXE, and then put the file under the/etc/lD. So. conf. d directory;
2) add an include lD. So. conf. d/EXE. conf line to the/etc/lD. So. conf file.
3) execute the ldconfig command
When the program runs, it will automatically add a dynamic library to search for in the EXE directory.
Second, use the LD_LIBRARY_PATH environment variable
You can. bashrc or. the environment variable is configured in cshrc. LD_LIBRARY_PATH indicates the directories in which the loader can find the shared library. you can set multiple search directories separated by colons.
The above example can also be implemented through the above method.
Add a row in. bashrc or. cshrc, export LD_LIBRARY_PATH = ~ /EXE: $ LD_LIBRARY_PATH.
Third, use the compilation option-WL and-rpath to specify the dynamic search path.
The-wl option tells the compiler to pass the following parameters to the linker.
Through the above introduction, the functions of/etc/lD. So. conf. d/are clearer.