Home > Article > Operation and Maintenance > What to do if linux cannot find lib
Solution to the problem that Linux cannot find lib: 1. Copy the lib library in the program to the "/lib" or "/usr/local/lib" directory, and then execute "ldconfig"; 2. In Add the directory where the library file is located to "ld.so.conf", and then update the "ld.so.cache" file.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
linux What should I do if I can’t find the lib?
The Lib library cannot be found when running the program under Linux. Solution
1. For example,
error while loading shared libraries: xxx: cannot open shared object file: No such file or directory
Method 1:
1. Enter the program Copy the lib library to the /lib or /usr/local/lib directory
2. The purpose of executing the ldconfig
ldconfig command is mainly to search in the default search directories (/lib and /usr/ lib) and the directory listed in the dynamic library configuration file /etc/ld.so.conf
Method 2:
# vim /etc/ld.so.conf //在新的一行中加入库文件所在目录 /xx//xxxxx # ldconfig //更新/etc/ld.so.cache文件
Recommended study:《 Linux video tutorial》
The above is the detailed content of What to do if linux cannot find lib. For more information, please follow other related articles on the PHP Chinese website!