简体   繁体   English

找不到ldd库

[英]ldd library not found

I get the following error launching my program: 启动程序时出现以下错误:

error while loading shared libraries: libnetcdf.so.6: cannot open shared object file: No such file or directory 加载共享库时出错:libnetcdf.so.6:无法打开共享库文件:没有这样的文件或目录

The point is the libnetcdf.so.6 is the old version of the library, I have deleted it and built the new one. 关键是libnetcdf.so.6是该库的旧版本,我已删除它并构建了新版本。

So when I try ldd I see: 因此,当我尝试ldd我会看到:

libnetcdf.so.7 => /usr/local/lib/libnetcdf.so.7 (0x00007f70f8c4b000)

but also 但是也

libnetcdf.so.6 => not found

Why this old reference? 为什么使用这个旧参考书? What can I do to solve? 我该怎么办?

You will need to re-link your application to libnetcdf.so.7 so the application looks for that rather than .6 您将需要将您的应用程序重新链接到libnetcdf.so.7,以便该应用程序查找而不是.6。

You may have a symbolic link that the linker will look at with no version number (libnetcdf.so) if this isn't present you may need to create it before re-linking: 您可能有一个符号链接,链接器将在该链接中查找该链接,而没有版本号(libnetcdf.so)(如果不存在),则可能需要在重新链接之前创建它:

ln -s libnetcdf.so.7 libnetcfd.so

If you can't re-link the application then you can create a symbolic link to make the application look at your newer library (although this could cause segmentation faults if the library versions aren't binary compatible) to point to the actual .so file: 如果无法重新链接应用程序,则可以创建符号链接以使应用程序查看较新的库(尽管如果库版本与二进制文件不兼容,这可能会导致分段错误),以指向实际的.so文件:

ln -s libnetcfd.so.7 libnetcfd.so.6

This will cause the application to find the shared object it requires but isn't the ideal solution. 这将导致应用程序找到所需的共享对象,但不是理想的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM