Categories
HowTo Posts Ubuntu

Howto fix: “error while loading shared libraries”

While installing opencv on an older version of debian for work I kept getting an error while loading shared libraries which turned out to be a pretty easy fix, just finding the libraries and adding them to the dynamic linker.

The libraries I was having trouble with below:
./blobtrack: error while loading shared libraries: libcxcore.so.1: cannot open shared object file: No such file or directory

ffmpeg
ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

I used the ‘locate’ command to find where the libraries were eg:
locate libcxcore.so.1
This outputted a few locations of where the library was, I decided to use the /usr/local/lib version as both libraries I needed were in there and did the following command to add them to ld.so.conf and reload the dynamic linker:
sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf && ldconfig'

1 reply on “Howto fix: “error while loading shared libraries””

hello

thanks for this howto

I’m using a raspberry pi
i tried to follow your instruction, but still having the same error: error while loading shared libraries: libopencv_core.so.3.0: cannot open shared object file: No such file or directory

knowing that i cross-compiled opencv on my host and just copied the libraries and include files into my raspberry’s /usr/local/lib and /usr/include folders

thanks in advance

Leave a Reply

Your email address will not be published. Required fields are marked *