【发布时间】:2019-04-16 14:56:54
【问题描述】:
在 CentOS 7.2 上,我使用 g++ 4.8.5 构建了一个无法运行的应用程序,因为它在其 runpath 中找不到确实存在的库。我很确定它在两周前有效。什么可能导致这种情况?
$ ./app
./app: error while loading shared libraries: libhdf5.so.9: cannot open shared object file: No such file or directory
$ ldd ./app | grep libhdf5
libhdf5.so.9 => not found
$ readelf app -d | grep path
0x000000000000001d (RUNPATH) Library runpath: [/opt/ProductName/lib:/opt/ProductName/lib/private]
$ ll /opt/ProductName/lib/libhdf5.so*
lrwxrwxrwx. 1 fotechd fotechd 16 Oct 26 14:38 /opt/ProductName/lib/libhdf5.so -> libhdf5.so.9.0.0
lrwxrwxrwx. 1 fotechd fotechd 16 Oct 26 14:38 /opt/ProductName/lib/libhdf5.so.9 -> libhdf5.so.9.0.0
-rwxr-xr-x. 1 fotechd fotechd 3316074 Oct 26 14:35 /opt/ProductName/lib/libhdf5.so.9.0.0
设置LD_LIBRARY_PATH暂时修复它:
$ LD_LIBRARY_PATH=/opt/ProductName/lib ./app
...
OK
【问题讨论】:
-
我在 Fedora 29 系统上遇到了完全相同的问题。你解决了吗?
标签: shared-libraries ld rpath