Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ~]$  
like image 839
Leo Izen Avatar asked Jan 20 '11 03:01

Leo Izen


People also ask

What goes in usr local lib?

/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.

How are shared libraries loaded in Linux?

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.

What is the difference between usr local lib and usr lib?

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.


1 Answers

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).

like image 171
paxdiablo Avatar answered Sep 19 '22 19:09

paxdiablo