Current location - Health Preservation Learning Network - Slimming men and women - How to check which version of dynamic library is generated in the system?
How to check which version of dynamic library is generated in the system?
Ldd< executable file name >; See which system dynamic link libraries nm; See what symbols are in the executable file. Strip; Removing the symbol table can simplify the executable file. If we want to extract some text information from executable programs, we can also use strings command strings; Dynamic * * * libraries on Linux operating system can be roughly divided into three categories: 1, operating system-level * * libraries and basic system tool libraries such as libc.so, libz.so, libpthread.so, etc. These system libraries will be placed in the /lib and /usr/lib directories. If it is a 64-bit operating system, there will be/. If the operating system has a graphical interface, there will be a /usr/X 1 1R6/lib directory, and if it is a 64-bit operating system, there will be a /usr/x 1r6/lib64 directory. There may also be system library directories for other specific Linux versions. The integrity and correct version of these system library files ensure the normal operation of various programs on Linux. 2. Application-level systems * * * enjoy libraries that are not included in the operating system, but may be enjoyed by many applications * * *. Usually, they will be placed in the /usr/local/lib and /usr/local/lib64 directories. Many self-compiled and installed programs will automatically add /usr/local /lib to the -L parameter of gcc at compile time, and will automatically go to /usr/local/lib to find the * * * library at run time. The above two kinds of dynamic * * * libraries will be found automatically by the application, and you don't need to set up or worry about them. Why is this? Because by default, these directories are added to the search path of the dynamic linker. The search path of Linux system * * * library is defined in the configuration file /etc/ld.so.conf, and the format of this file is roughly as follows:/usr/x1r 6/lib64/usr/x1r 6/lib/usr/local/lib/lib64/lib/. Local/ImageMagick/lib Assuming that the ImageMagick graphic library compiled and installed by ourselves is in the /usr/local/ImageMagick directory, we hope that other applications can use the dynamic * * * library of ImageMagick. Then we just need to add the /usr/local/ImageMagick/lib directory to the /etc/ld.so.conf file, and then execute the: ldconfig command, and Ldcofig will search all the above directories and create a cache file /etc/ld.so.cache for the * * enjoyment library. In order to confirm that ldconfig has searched ImageMagick's library, we can use the strings command introduced above to extract text information from ld.so.cache for inspection: strings/etc/LD.so.cache grep ImageMagick, The output result is:/usr/local/imagemagick/lib/libwand.so.10/usr/local/imagemagick.so/usr/local/imagemagick/lib/lib/libmagick.so.1. 3. Application-specific dynamic * * * shared libraries There are many * * * shared libraries that are only used by specific applications, so there is no need to join the system library path to avoid version conflict between * * * shared libraries of applications. Therefore, Linux can also temporarily specify the * * * shared library search path of the application by setting the environment variable LD_LIBRARY_PATH. Just like the example we cited above, we can preset LD_LIBRARY_PATH in the startup script of the application, and specify the additional * * * shared library search path of the application, so that the application can find it.