cannot load shared library that exists in /usr/local/lib (Fedora x64)
Solution 1
Thank you to @Joachim_Pileborg:
ldconfig uses the file /etc/ld.so.conf. You can add /usr/local/lib to that file, re-run ldconfig and try again
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.
Solution 2
I found a working solution for both /usr/local/lib and /usr/local/lib64 directories in this commit.
First run this command as root to add those directories.
tee /etc/ld.so.conf.d/local.conf <<EOF
/usr/local/lib
/usr/local/lib64
EOF
Next run as root:
ldconfig
williamstome
Tom Williams is a graduate student at Tufts University. He is studying Artificial Intelligence.
Updated on June 05, 2022Comments
-
williamstome almost 2 years
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
ls /usr/local/lib/liblcm*
yields/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.This exhausts the list of answers I've seen whilst grepping around stackOverflow.
Anyone spot the problem?
-
FuriousGeorge about 8 years
ldconfig
uses a cache of the files in the directory, so simply adding the file to the directory isn't sufficient. You must runsudo ldconfig
in order to update the cache -
Qix - MONICA WAS MISTREATED over 3 yearsSimply running
sudo ldconfig
was enough. For whatever reason, be it this particular package or aptitude itself,apt install
didn't seem to correctly install the package so even though I could link against it I couldn't run my program. After runningldconfig
, it just automagically started running correctly.