Unable to load dynamic library under Linux When the following abnormal situation occurs
If the path of the dynamic library is (/usr/cluster/.share/lib) Solution: Method 1: Add the path to the /etc/ld.so.conf file, vi /etc/ld.so.conf Add the following content include ld.so.conf.d/*.conf /usr/cluster/.share/lib Method 2: Enter in the terminal: Method 3: Modify the /etc/profile file export MPI_HOME=/usr/cluster export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MPI_HOME/.share/lib Execute source /etc/profile in the terminal to make the configuration file take effect Solution to the failure of loading dynamic library when the program is running The error message is as follows:
There are generally two reasons. One is that the shared library (lib*.so.* file) is not included in the operating system or the shared library version is incorrect. The solution is to download and install it again. Another reason is that the shared library has been installed, but when the program that needs to call the shared library is executed, 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 purpose of the ldconfig command is to search for sharable dynamic link libraries (formatted like lib*.so*) in the default search directories (b and /usrb) and the directories listed in the dynamic library configuration file /etc/ld.so.conf, and then create the connection and cache files required by the dynamic loader (ld.so). The cache file defaults to /etc/ld.so.cache, which stores the sorted list of dynamic link library names. If the shared library file is installed to /usr/local/lib (generally open source shared libraries are installed to this directory) or other directories other than /lib or /usr/lib, then before executing the ldconfig command, you must also add the new shared library directory to the shared library configuration file /etc/ld.so.conf, as follows: # cat /etc/ld.so.conf include ld.so.conf.d/*.conf # echo "/usr/local/lib" >> /etc/ld.so.conf #ldconfig Or create a new file with .conf as the suffix in the /etc/ld.so.conf.d/ directory and add the directory where the library file is located to the file. Then execute ldconfig to update the /etc/ld.so.cache file. If the shared library file is installed in a directory other than /lib or /usr/lib, but you do not want to add the shared library path to the /etc/ld.so.conf file (or you do not have permission to add the path). You can export a global variable LD_LIBRARY_PATH means to tell the loader in which directories to find shared libraries. You can set multiple search directories, separated by colons. For example, if you installed mysql to the /usr/local/mysql directory, and there are a lot of library files under /usr/local/mysql/lib, you can add the following statement to .bashrc or .bash_profile or shell: Generally speaking, this is just a temporary solution, used when there is no permission or temporary need. If the library file required by the program is lower than the version of the library file currently existing in the system, a link can be made. for example: error while loading shared libraries: libncurses.so.4: cannot open shared object file: No such file or directory ls /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 create a link ln -s /usr/lib/libncurses.so.5.3 /usr/lib/libncurses.so.4 Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: jQuery plugin to achieve code rain effect
>>: jQuery plugin to implement floating menu
Table of contents Generate random numbers Generat...
Demand background: Insert GIF dynamic images into...
We all know that after the MySQL database is inst...
The first type: full CSS control, layer floating ...
Scenario A recent requirement is an h5 page for m...
I like to pay attention to some news on weekdays a...
<template> <div class="app-containe...
This article describes the MySQL user rights mana...
When learning about inline-block, I found that the...
MySQL is a relational database management system ...
When I first started designing web pages using XH...
This article explains the difference between arro...
The specific code is as follows: <div id="...
This article uses an example to describe how to r...
Table of contents 1. Introduction 1.1 Principle 1...