简体   繁体   English

无法加载/ usr / local / lib中存在的共享库(Fedora x64)

[英]cannot load shared library that exists in /usr/local/lib (Fedora x64)

When attempting to run a program I just compiled successfully, I get the following error: 尝试运行我刚编译成功的程序时,出现以下错误:

./src/sensors/laser_scan_producer: error while loading shared libraries: liblcm.so.1 : cannot open shared object file: No such file or directory ./src/sensors/laser_scan_producer:加载共享库时出错: liblcm.so.1 :无法打开共享对象文件:没有这样的文件或目录

ls /usr/local/lib/liblcm* yields ls /usr/local/lib/liblcm*产生

/usr/local/lib/liblcm.la  
/usr/local/lib/liblcm.so  
/usr/local/lib/liblcm.so.1  
/usr/local/lib/liblcm.so.1.2.0

I have executed sudo ldconfig several times and added /usr/local/lib to LD_LIBRARY_PATH for the sake of redundancy. 我已多次执行sudo ldconfig并为了冗余而将/ usr / local / lib添加到LD_LIBRARY_PATH。

This exhausts the list of answers I've seen whilst grepping around stackOverflow. 这耗尽了我在看到stackOverflow时遇到的答案列表。

Anyone spot the problem? 有谁发现了这个问题?

Thank you to @Joachim_Pileborg: 谢谢@Joachim_Pileborg:

ldconfig uses the file /etc/ld.so.conf. ldconfig使用文件/etc/ld.so.conf。 You can add /usr/local/lib to that file, re-run ldconfig and try again 您可以将/ usr / local / lib添加到该文件,重新运行ldconfig并重试

Doing so fixed the problem, although I find it odd that /usr/local/lib wouldn't have been checked in the natural course of things. 这样做解决了这个问题,虽然我觉得奇怪的是/ usr / local / lib不会在自然过程中被检查过。

I found a working solution for both /usr/local/lib and /usr/local/lib64 directories in this commit . 在此提交中找到了/ usr / local / lib和/ usr / local / lib64目录的工作解决方案。

First run this command as root to add those directories. 首先以root身份运行此命令以添加这些目录。

tee /etc/ld.so.conf.d/local.conf <<EOF
/usr/local/lib
/usr/local/lib64
EOF

Next run as root: 接下来以root身份运行:

ldconfig

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

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