I'm having trouble finding why this library (matio) isn't working for me. In my Makefile I have this:
LIBS += -L/home/brian/.../matio-1.5.6/src/.libs/ -lmatio
When I attempt to run my code (links fine) I get this error:
error while loading shared libraries: libmatio.so.4: cannot open shared object file: No such file or directory
libmatio.so.4 exists in the directory specified by the -L flag.
I built the library and it seems to go through make check
with only a handful writing errors (which is fine as I only need it for reading).
Things I've tried:
-l:libmatio.so.4.0.2
)LD_LIBRARY_PATH
/etc/ld.so.conf
and run sudo ldconfig
/etc/ld.so.conf.d
with the path and run sudo ldconfig
(When I run ldconfig -p | grep matio
nothing returns. Am I doing something wrong with ldconfig
?)
SO files can technically be opened with GNU Compiler Collection but these types of files aren't intended to be viewed or used like you might another type of file. Instead, they're just placed in an appropriate folder and used automatically by other programs via Linux's dynamic link loader.
If you want to open a shared-library file, you would open it like any other binary file -- with a hex-editor (also called a binary-editor). There are several hex-editors in the standard repositories such as GHex (https://packages.ubuntu.com/xenial/ghex) or Bless (https://packages.ubuntu.com/xenial/bless).
The error is actually telling you "no compatible library with that name exists in the library cache", not "no file with that filename exists on disk".
So, confusingly, this can happen when the shared object file is in the wrong format.
Ensure that it was built for the right platform by the right compiler! You can have a look with file
and verify that the dynamic link is failing using ldd
on your executable.
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