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 ~]$
/usr - Contains non-essential command-line binaries, libraries, header files, and other data. More specifically, /usr/lib is for macOS installed shared libraries. Anything under /usr/local are user-installed. So /usr/local/lib contains shared libraries installed by you.
Shared libraries are the most common way to manage dependencies on Linux systems. These shared resources are loaded into memory before the application starts, and when several processes require the same library, it will be loaded only once on the system. This feature saves on memory usage by the application.
For the question in the topic: /usr/local/lib is meant for libs that you installed (compiled) yourself. /usr/lib is for libraries your distribution provides. You might want to read about the FHS for more info.
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
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With