(I) Historical Background
Nowadays, most software comes with shared libraries, or for security or business considerations.
For example:
Oracle: $ ORACLE_HOME/lib
MySQL: $ HOME/mysql/lib
The following is the configuration of LD_LIBRARY_PATH in. bash_profile under the oracle user.
Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/lib:/usr/X11R6/lib
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ ORACLE_HOME/jdk/jre/lib/i386
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ ORACLE_HOME/jdk/jre/lib/i386/server
Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ ORACLE_HOME/rdbms/lib
(Ii) Concepts
① Below are some similar things
Shared Library, dynamic link library,. so file
② Ld. so is also called the shared library loader.
(3) meaning of existence
Used to tell ld. so where to find someone's shared library
(Iv) Let's Talk About
The. so file is managed and loaded by ld. so, which searches for the. so file required by the APP in the standard path/lib or/usr/lib,
But for non-standard paths:
In Linux, add the private path to/etc/ld. so. conf, run ldconfig to generate ld. so. cache, and ld. so.
For UNIX, LD_LIBRARY_PATH is used to process. so files in non-standard paths.
The Search priority is as follows (Linux ):
① LD_LIBRARY_PATH environment variable specifies the Directory
②/Etc/ld. so. conf specifies the Directory
③ Standard path first/usr/lib and then/lib
(V) Common Errors
Error while loading shared libraries: ooxx. so.0: cannot open shared object file: No such file or directory
How is ooxx named? If you are interested, click here to open the link.
(Vi) General Solutions
① Place the built-in library cp to/usr/lib or/lib, and then ldconfig has a case: Click to open the link
②/Etc/ld. so. conf, and then ldconfig
③ LD_LIBRARY_PATH (this variable has been criticized)
Supplement:
You can view the shared libraries that a program depends on as follows:
[Root @ b7-~] # Ldd/home/mysql/bin/mysqldump
Libpthread. so.0 =>/lib64/libpthread. so.0 (0x000000337d200000)
Libz. so.1 =>/usr/lib64/libz. so.1 (0x000000337e600000)
Librt. so.1 =>/lib64/librt. so.1 (0x000000337d600000)
Libdl. so.2 =>/lib64/libdl. so.2 (0x000000337c600000)
Libstdc ++. so.6 =>/usr/lib64/libstdc ++. so.6 (0x00000031ebe00000)
Libm. so.6 =>/lib64/libm. so.6 (0x000000337da00000)
Libgcc_s.so.1 =>/lib64/libgcc_s.so.1 (0x00000031e9e00000)
Libc. so.6 =>/lib64/libc. so.6 (0x000000337c200000)
/Lib64/ld-linux-x86-64.so.2 (0x000000337be000)
The output can be divided into three columns:
Column 1: Library on which the program depends
Column 2: Corresponding libraries provided by the system and required libraries of the program
Column 3: Start address of Library Loading
Recommended reading:
Linux Command cd
Cat for Linux commands
Linux Command alias/unalias
Linux Command Parsing: su root and su-root