In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the Linux program runtime loading dynamic library failure how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
The problem that dynamic libraries cannot be loaded under Linux
When the following anomalies occur
. / test: error while loading shared libraries: libmfs_open.so: cannot open shared object file: No such file or directory
If the path of the dynamic library is in (/ usr/cluster/.share/lib)
Solution:
Method 1. Add a path to the / etc/ld.so.conf file, vi / etc/ld.so.conf
Add the following
Include ld.so.conf.d/*.conf/usr/cluster/.share/lib
Method 2. Enter export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/cluster/.share/lib at the terminal.
Method 3. Modify / etc/profile file
Export MPI_HOME=/usr/clusterexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MPI_HOME/.share/lib
Execute source / etc/profile at the terminal to make the configuration file effective
The solution to the failure of loading dynamic Library when the Program is running
The error message is as follows:
Error while loading shared libraries: libjson.so.0: cannot open shared object file: No such file or directory
There are usually two reasons, one is that the shared library (lib*.so.* file) is not included in the operating system or the version of the shared library is wrong. The solution is to download and install again.
Another reason is that the shared library is already installed, but when executing a program that needs to call the shared library, the program cannot find the shared library file according to the default shared library path. The solution is as follows:
If the shared library file is installed in the / lib or / usr/lib directory, execute the ldconfig command.
The main purpose of the ldconfig command is to search for shareable dynamic link libraries (such as lib*.so*) under the default search directory (b and / usrb) and the directory listed in the dynamic library configuration file / etc/ld.so.conf, and then create the connection and cache files needed by the dynamic loader (ld.so). The cache file defaults to / etc/ld.so.cache, which holds a sorted list of dynamic link library names.
If the shared library file is installed in / usr/local/lib (where all open source shared libraries are installed) or other non-/ lib or / usr/lib directories, add the new shared library directory to the shared library configuration file / etc/ld.so.conf before executing the ldconfig command, as follows:
# cat / etc/ld.so.confinclude ld.so.conf.d/*.conf# echo "/ usr/local/lib" > > / etc/ld.so.conf# ldconfig
Or create any new file with the suffix .conf in the / etc/ld.so.conf.d/ directory and add the directory where the library file is located. Then ldconfig updates the / etc/ld.so.cache file.
If the shared library file is installed in another non / lib or / usr/lib directory, but you don't want to add the shared library path to the / etc/ld.so.conf file (or you don't have permission to add a path). You can export a global variable LD_LIBRARY_PATH, and then when you run the program, you will find a directory to find the shared library.
LD_LIBRARY_PATH means to tell loader in which directories you can find shared libraries. You can set up multiple search directories, separated by colons. For example, if you install a mysql to the / usr/local/mysql directory with a large stack of library files under / usr/local/mysql/lib, you can add the following statement to .bashrc or .bash _ profile or shell:
Export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH
Generally speaking, this is only a temporary solution, used when there is no permission or temporary need.
If the program needs a library file that is lower than the version of the library file that currently exists in the system, you can make a link. For example:
Error while loading shared libraries: libncurses.so.4: cannot open sharedobject file: No such file or directoryls / usr/lib/libncu*/usr/lib/libncurses.a / usr/lib/libncurses.so.5/usr/lib/libncurses.so / usr/lib/libncurses.so.5.3
It can be seen that although there is no libncurses.so.4, there is libncurses.so.5, which is backward compatible.
Just build a link.
Ln-s / usr/lib/libncurses.so.5.3 / usr/lib/libncurses.so.4 Thank you for reading this article carefully. I hope the article "what if the Linux program fails to load the dynamic library when it is running" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.