Specify the shared library path

Before looking at the role of /etc/ld.so.conf.d/ directory file, first introduced to the program is run several ways to load dynamic library:
first, by ldconfig command
    ldconfig command uses, mainly in the default directory listed in the /etc/ld.so.conf search directory (/ lib and / usr / lib) and the dynamic library configuration file, search for a shareable dynamic link library (formats such as lib * .so *), and then Creating a dynamic loader (ld.so) required for connection and cache file cache file defaults to /etc/ld.so.cache, save this file has been sorted list of names of dynamic link library.
    this involves the inside there are key elements of the command: ldconfig, the configuration file directory: /etc/ld.so.conf.d, the configuration file /etc/ld.so.conf content edited by the user, cache files /etc/ld.so.cache. Here's an example, such as when you deploy software, installed in some dynamic libraries exe directory, the following method can be achieved by,
1) exe.conf configuration file, which his party ~ / exe, then place the file / etc /ld.so.conf.d the directory;
2) add a line include ld.so.conf.d / exe.conf in /etc/ld.so.conf
3) ldconfig command execution
program run after automatically exe increase in dynamic library search directory.
The second, by the LD_LIBRARY_PATH environment variable
can be configured in .bashrc or .cshrc the environment variable, LD_LIBRARY_PATH mean to tell loader which can be found in the shared library directory. You can set multiple search directories, these directories with a colon between spaced apart.
the same is the above example, may be achieved by the above method
.Bashrc .cshrc or increase in the line, export LD_LIBRARY_PATH = ~ / exe: $ LD_LIBRARY_PATH can.

The third, by compiling option -Wl, -rpath specify the path of dynamic search
    -Wl option tells the compiler to pass parameters back to the linker.
    Through the above description, the role of /etc/ld.so.conf.d/ relatively clear.

Guess you like

Origin www.cnblogs.com/DXGG-Bond/p/11812189.html