Is /usr/local/lib searched for shared libraries?

Leo Izen picture Leo Izen · Jan 20, 2011 · Viewed 92.8k times · Source

Is /usr/local/lib searched for shared libraries ? I have this error:

[Leo@chessman ~]$ whereis ffmpeg
ffmpeg: /usr/local/bin/ffmpeg
[Leo@chessman ~]$ ffmpeg
ffmpeg: error while loading shared libraries: libavcore.so.0: cannot open shared object file: No such file or directory
[Leo@chessman ~]$ ls /usr/local/lib/libav*
/usr/local/lib/libavcodec.a            /usr/local/lib/libavfilter.a
/usr/local/lib/libavcodec.so           /usr/local/lib/libavfilter.so
/usr/local/lib/libavcodec.so.52        /usr/local/lib/libavfilter.so.1
/usr/local/lib/libavcodec.so.52.108.0  /usr/local/lib/libavfilter.so.1.74.0
/usr/local/lib/libavcore.a             /usr/local/lib/libavformat.a
/usr/local/lib/libavcore.so            /usr/local/lib/libavformat.so
/usr/local/lib/libavcore.so.0          /usr/local/lib/libavformat.so.52
/usr/local/lib/libavcore.so.0.16.1     /usr/local/lib/libavformat.so.52.94.0
/usr/local/lib/libavdevice.a           /usr/local/lib/libavutil.a
/usr/local/lib/libavdevice.so          /usr/local/lib/libavutil.so
/usr/local/lib/libavdevice.so.52       /usr/local/lib/libavutil.so.50
/usr/local/lib/libavdevice.so.52.2.3   /usr/local/lib/libavutil.so.50.36.0
[Leo@chessman ~]$ 

Answer

paxdiablo picture paxdiablo · Jan 20, 2011

Make sure your LD_LIBRARY_PATH is set up to include all directories you want to search and then test it again.

You can test this quickly with:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ffmpeg

which will set it only for that invocation.

Alternatively, you can edit /etc/ld.so.conf which contains the default directories searched. Some Linux distributions may not include /usr/local/lib in that file.

Note that you may also need to update the cache /etc/ld.so.cache by running ldconfig (as root, or with sudo).