I'm a little confused as to what's happening here, when I'm our shared computer I can run our program, but when I ssh in from my house to restart it I get an exception
$ ./jsonparser
./jsonparser: error while loading shared libraries: libjansson.so.4: cannot open shared object file: No such file or directory
Is there some other way I should launch the app?
libjansson is installed to /usr/local/lib:
$ ls /usr/local/lib
libjansson.a libjansson.la libjansson.so libjansson.so.4 libjansson.so.4.6.0
Maybe /usr/local/lib is not in your Library pathg ( LD_LIBRARY_PATH I guess )? Or maybe there is a dependency for libjansson.so.4 is not resolved? By using ldd ./jsonparser ldd tries to load all dependent .so-file. Hopefully this will give you some more information about your issue.
Related
I am using clang-9 with mysql-connector-c++8.
After mysql-connector-c++ upgrade from 1.1.12 to 8.x and running function in my app: get_driver_instance() an exception is being thrown:
"Couldn't load library libmysqlclient_r.so: libmysqlclient_r.so: cannot open shared object file"
What I've tried so far:
ldd on my newly compiled binary, but my newly compiled binary does not link against libmysqlclient_r.so.
strace -f my binary, but no info about loading this library
removed /etc/ld.so.cache and rebuilt it with ldconfig, than recompiled my software
updatedb && locate \*\.so | xargs ldd and the same for \*\.so\.\*, but no file is showing it is linked with libmysqlclient_r.so
There are no errors during compilation. I've got out of ideas what might be wrong. What might I do to diagnose it further?
Runtime dlopen calls will not produce any output in ldd, but you can convince ld.so to print when a library is loaded by whom by setting the environment variable LD_DEBUG=files.
I tried to run a program that requires log4cpp,
I got following error when I try to run the program
error while loading shared libraries: liblog4cpp.so.4: cannot open shared object file: No such file or directory
I have set the library path in $LD_LIBRARY_PATH and these are the files in my /usr/local/lib directory:
liblog4cpp.a
liblog4cpp.so
liblog4cpp.so.5.0.6
liblog4cpp.la
liblog4cpp.so.5
pkgconfig
What could be the problem here ?
Thanks!
Use
ldd [program name]
so see what's actually loaded (assuming you are on a Unix system since you use LD_LIBRARY_PATH).
I have a problem with GLEW Library, I have a Linux system and I compiled a program with GLFW and GLEW but if I start my program it causes problems.
It outputs this:
./Test: error while loading shared libraries: libGLEW.so.2.0: cannot open shared object file: No such file or directory
I wrote a bash script with following code:
#!/bin/sh
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/Dokumente/Libraries/glfw-3.2.1-build/src/libglfw.so.3:~/Dokumente/Libraries/glew-2.0.0/lib/libGLEW.so.2.0
export LD_LIBRARY_PATH
./Test
But it doesn't work. It outputs the same error and I am sure the path is right
What can I do?
You can also allow loading of .so's from the same folder the executable is at "Windows Style" by setting the rpath with patchelf:
patchelf --set-rpath '$ORIGIN' your_program_binary
If you want to do this is up to you, of course. ;)
I have just solved the problem:
I put all Libraries into /usr/local/lib and change the LD_LIBRARY_PATH to this
I'm using xerces(http://xerces.apache.org) lib to parse a XML file in C++, so I downloaded the source code, ran a ./configure, make, make install, so when I execute
g++ -o parser parser.cpp
and I execute ./parser, I get:
./parser: error while loading shared libraries: libxerces-c-3.1.so: cannot open shared object file. No such file or directory.
When I search into /usr/lib or /lib I can't find where libxerces-c-3.1.so did go, nor where libxerces-c-3.1.so is. Does someone know how could I solve that problem?
Did you try running ldconfig command?
ldconfig examples
The only thing that I can think of is some issue with symbolic links, if it has crossed linking successfully.
Related question :https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s
I have a project organized as
\bin\cmain
\lib\libxmlrpc_client++.a
\lib\libxmlrpc_client++.so.4
\lib\libxmlrpc_client++.so.4.16
My c program cmain need to dynamically link clib.so.4. While I compile the code, I use -L.../lib to indicate directory lib and use -lxmlrpc_client++. However, my code get error while loading shared libraries:
libxmlrpc_client++.so.4: cannot open shared object file: No such file or directory
Any ideas to fix this?
PS: Problem solved, a good reference to the problem: http://gcc.gnu.org/ml/gcc-help/2005-12/msg00017.html
You need to tell the dynamic linker where to look for the libraries. Assuming this is some sort of UNIX/Linux system, this can be done either via setting the LD_LIBRARY_PATH environment variable before executing the program:
export LD_LIBRARY_PATH=/path/to/lib
./run-my-program
or by setting the run-time linker path during compile time:
gcc -L/path/to/lib -Wl,-rpath,/path/to/lib -lxmlrpc_client++ ...
./run-my-program
Both approaches have problems. Google for "why LD_LIBRARY_PATH is bad". The command-line options for setting the run-time linker path varies from one compiler to another.
You should use -Llib instead of -L..
Is that softlink broken? ls -l, make sure your pointing to the correct file.
Example Error :
[root#localhost ~]# ./conn 127.0.0.1 6379 opencc ./conn: error while
loading shared libraries: libhiredis.so.1.0.3-dev: cannot open shared
object file: No such file or directory
Solution
The problem was the libhiredis wasn't in the ldconfig path. While the build process was correct and it copied everything to the correct directory ldconfig did not know about its location.
You can use ldconfig -p to see all library ldconfig currently know about.
You can add the path to ldconfig with
sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
&
sudo ldconfig