Linux运行程序报error while loading shared libraries

Linux运行程序时报:

./Test2: error while loading shared libraries: lib***.so: 
cannot open shared object file: No such file or directory

一般遇见这个问题,直接ldd看一下依赖的so和LD_LIBRARY_PATH,然后再export LD_LIBRARY_PATH,加上对应路径基本就能解决。

如果报出问题时依赖的so是能够found的,但是运行时依然出现该问题。

可以尝试执行:

sudo vim /etc/ld.so.conf

将文件修改为:

include /etc/ld.so.conf.d/*.conf
/usr/***/***/lib

保存后执行sudo ldconfig即可。

原文地址:https://www.cnblogs.com/tiandsp/p/14681361.html