Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error loading shared libraries

Tags:

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) 
like image 385
user459811 Avatar asked Dec 23 '10 00:12

user459811


People also ask

Could not load library Cannot open shared object file no such file or directory?

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.

How do I load a shared library?

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.

What is shared library in Ubuntu?

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.


1 Answers

Try running ldconfig as root to see if it solves the problem.

like image 109
ipk Avatar answered Oct 29 '22 15:10

ipk