$ ./a.out
./a.out: error while loading shared libraries: libopencv_shape.so.3.1: cannot open shared object file: No such file or directory
I was certainly able to locate the file manually in the proper directory:
$ find / -name libopencv_shape.so.3.1
/usr/local/lib/libopencv_shape.so.3.1
Very interesting. This is probably because I manually compiled and installed opencv3.1.0 from sources. In any case, here is the solution.
First, we need to look for the shared library path. The system dynamic linker locations are specified in /etc/ld.so.conf file, which probably includes .conf files in /etc/ld.so.conf.d/ folder. Each of the .conf files in the folder specifies the system dynamic linker locations, such as /lib/x86_64-linux-gnu.
Also, one can define the shell-variable LD_LIBRARY_PATH to include the directory of the shared library file that needs to be linked.
My case? It was a subtle. I certainly had the library folder included in one of the config files:
$ cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
Yet, I was still getting the error. Why? That's because I needed to manually load config:
$ sudo ldconfig
No comments:
Post a Comment