This is an old revision of the document!
Table of Contents
Programs - Program can't find Shared Library at run-time
Error received when trying to run a program, such as error while loading shared libraries.
Symlinks on libraries work fine, as long as the final target they trace to exists and is accessible.
Possible solutions include:
- Create a symlink to libxyz* in a directory listed in /etc/ld.so.conf (or /lib or /usr/lib).
- Copy libxyz* to a directory listed in /etc/ld.so.conf (or /lib or /usr/lib) (defaults).
- Add the directory containing libxyz* to /etc/ld.so.conf.
- Set LD_LIBRARY_PATH=/directory/path/to/libid3* before running your program.
- Recompile program statically. (It will work, but don't bother.)
After any of the first 3, rerun ldconfig so the linker cache is updated. You can then run ldconfig -v to verify it's resolvable.
Create a symlink to the library path
ln -s /usr/local/lib/libxyz.so libxyz.so
Then update the linker cache.
ldconfig
The runtime linker (usually /lib/ld.so or /lib/ld-linux.so with some version number in it) checks all of its configured directories for the library, and then links them in every time the program starts.
Copy the library file to a directory listed in /etc/ld.so.conf
Copy the library file, such as libxyz*, to a directory listed in /etc/ld.so.conf (or /lib or /usr/lib) (defaults)
cat /etc/ld.so.conf
displays
include /etc/ld.so.conf.d/*.conf
Some Linux systems have the /etc/ld.so.conf file point directly to some directories, such as /usr/local/lib. Ubuntu however references a seperate directory /etc/ld.so.conf.d where is reads in any *.conf file. Simply create a new confile file with an extension ending in .conf. Populate this file with the path that contains the library file.
Then update the linker cache.
ldconfig
The runtime linker (usually /lib/ld.so or /lib/ld-linux.so with some version number in it) checks all of its configured directories for the library, and then links them in every time the program starts.
Add the directory containing libxyz* to /etc/ld.so.conf
cp libxyz.so /usr/local/lib
vi /etc/ld.so.conf
and add this line
- /etc/ld.so.conf
/usr/local/lib
Then update the linker cache.
ldconfig
The runtime linker (usually /lib/ld.so or /lib/ld-linux.so with some version number in it) checks all of its configured directories for the library, and then links them in every time the program starts.
Update your **LD_LIBRARY_PATH** environment variable
Add the directory containing the symbolic link to your LD_LIBRARY_PATH environment variable.
Run the following before running your program.
set LD_LIBRARY_PATH=/directory/path/to/libxyz*