In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Dynamic libraries are shared libraries. When it comes to the problem that linux cannot find dynamic libraries, we must first understand the characteristics of dynamic libraries:
The ● dynamic library defers the loading of links to some library functions until the program is running.
● can realize resource sharing between processes. (therefore, dynamic libraries are also called shared libraries)
● makes it easy to upgrade some programs.
● can even really make link loading completely controlled by the programmer in the program code (display calls).
From the first point above, we can see that the dynamic library does not package the library files into the program in binary form like the static library, but dynamically loads the dynamic library when the program needs to call the corresponding library function. At this time, the system only knows the name of the dynamic library, but does not know the absolute path, so the system dynamic loader (dynamic linker/loader) is needed. For the executable program of elf, it is completed by ld-linux.so, which successively searches the DT_RPATH segment of the elf file (uncontrollable) = "environment variable LD_LIBRARY_PATH =" / etc/ld.so.cache file list = "/ lib/ and / usr/lib directory to find the library file and load it into memory.
Then what we need to do is to add the absolute path of the directory where the dynamic library resides to any order of the dynamic loader search order. Here's how to implement it:
Method 1: copy the self-made shared library to / lib or / usr/lib, not recommended
Method 2: add the absolute path of the directory where the dynamic library is located to the system environment variable
2.1. Temporarily add the absolute path of the directory where the dynamic library is located to the environment variable (invalidate with terminal shutdown)
Export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/chiliast/homework/day03/shared/lib
Set the absolute path of the directory where the dynamic library is located to ~ / .bashrc or / etc/profile (permanent)
User level: add the library path to the end of ~ / .bashrc file
Export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/chiliast/homework/day03/shared/lib
Source ~ / bashrc or. ~ / .bashrc to make the configuration effective
System level: add the library path to the end of the / etc/profile file
Export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/chiliast/homework/day03/shared/lib
Source / etc/profile or. / etc/profile to make the configuration effective
Method 3: add the absolute path of the directory where the dynamic library is located to the / etc/ld.so.cache file (2 steps to implement)
Edit the / etc/ld.so.conf file and add the path to the directory where the library file is located
Run ldconfig (requires super user permission), which rebuilds the / etc/ld.so.cache file
These are the details of what to do if the linux dynamic library cannot be found. Please pay attention to other related articles for more information.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.