I'm running eclipse on Ubuntu using a g++ compiler and I'm trying to run a sample program that utilizes xerces.
The build produced no errors however, when i attempted to run the program, I would receive this error:
error while loading shared libraries: libxerces-c-3.1.so: cannot open shared object file: No such file or directory
libxerces-c-3.1.so
is in the directory /opt/lib
which I have included as a library in eclipse. The file is there when I checked the folder. When I perform an echo $LD_LIBRARY_PATH
, /opt/lib
is also listed.
Any ideas into where the problem lies? Thanks.
An ldd libxerces-c-3.1.so
command yields the following output:
linux-vdso.so.1 => (0x00007fffeafff000) libnsl.so.1 => /lib/libnsl.so.1 (0x00007fa3d2b83000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007fa3d2966000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fa3d265f000) libm.so.6 => /lib/libm.so.6 (0x00007fa3d23dc000) libc.so.6 => /lib/libc.so.6 (0x00007fa3d2059000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fa3d1e42000) /lib64/ld-linux-x86-64.so.2 (0x00007fa3d337d000)
cannot open shared object file: No such file or directory The reason behind this error is that the libraries of the program have been installed in a place where dynamic linker cannot find it.
Once you've created a shared library, you'll want to install it. The simple approach is simply to copy the library into one of the standard directories (e.g., /usr/lib) and run ldconfig(8). Finally, when you compile your programs, you'll need to tell the linker about any static and shared libraries that you're using.
Shared libraries are compiled code which is intended to be shared among several different programs. They are distributed as . so files in /usr/lib/. A library exports symbols which are the compiled versions of functions, classes and variables.
Try running ldconfig
as root to see if it solves the problem.
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