programs:program_can_t_find_shared_library_at_run-time

This is an old revision of the document!


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.

Then run to update the linker cache.

ldconfig

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.

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. If you just tell me the path where your libxyz file is.

Add the directory containing the symbolic link to your LD_LIBRARY_PATH environment variable.

Solution 2

Try running ldconfig as root.

ldconfig

This program makes a registry of available libraries used for runtime library loading. The trick is that the library has to be in a place that ldconfig expects to see it, which depends on the distribution. The list of library directories is usually in /etc/ld.so.conf or somewhere similar.

programs/program_can_t_find_shared_library_at_run-time.1483572106.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki