programname: error in loading shared libraries: lib xxx..so. x: cannot open shared object file: No such file or directory." /> programname: error in loading shared libraries: lib xxx..so. x: cannot open shared object file: No such file or directory." />
LinuxDevCenter.com
oreilly.comSafari Books Online.Conferences.
BooksAll ArticlesSafari BookshelfO'Reilly GearFree Newsletters

FAQS
 FAQs
Apache FAQ
Linux FAQ
XML FAQ

Log in to particpate





TECH JOBS


   Linux FAQ > 10. Frequently Encountered Error Messages
Question:  10.23. programname: error in loading shared libraries: lib xxx..so. x: cannot open shared object file: No such file or directory.
Answer:

A message like this, when the program that you're trying to run uses shared libraries, usually means one of two things: the program was either compiled on a machine that had a different set of libraries or library paths than yours; or you've upgraded your libraries but not the program.

Executable programs that are linked with dynamic libraries, expect the full pathname of each of the library files it requires. So do the shared libraries, if they rely on other libraries. This is so the shared object dependencies remain as unambiguous as possible, and also as a security measure.

Short of recompiling the executable file for the libraries on the system—probably the most desirable alternative in the long run—you can try to determine which libraries the executable file needs with the command: "ldd programname." The output will be a list of the shared libraries on the system that the program needs to run, as well as the missing libraries. You can then add the library packages, or if the libraries already exist in a different directory, you can create a symbolic link so the program can find it. For example, if the program requires /usr/lib/libncurses.so.2, and your machine has /lib/libncurses.so.2, you can create a link where the program expects to find the library; e.g.:

# cd /usr/lib && ln -s /lib/libncurses.so.2 .


You should note, however, that creating library links like these should be considered a security risk, and the additional links you create will not be compatible with future upgrades. It's simply a quick fix for backward compatibility.

Also, it may take some guesswork to determine in exactly which of the system library directories the program expects to find a shared library file, because ldd will not list the paths of libraries it can't find. A program most likely will tell the run-time linker, /lib/ld.so, to look for shared libraries in /lib, /usr/lib, /usr/local/lib, or /usr/X11R6/lib, if it's an X client. But that doesn't mean that libraries can't be installed elsewhere. It helps to have some idea of the original library configuration before proceeding.

Also be sure to run ldconfig after creating the symbolic link, so that ld.so has an updated view of the system's libraries. You should also make certain that all of the library directories are listed in /etc/ld.so.conf, and perhaps in the LD_LIBRARY_PATH environment variable.


This FAQ is from Linux Frequently Asked Questions with Answers, maintained by Robert Kiesling

Sponsored by:

Contact UsMedia KitPrivacy PolicyPress NewsJobs @ O'Reilly
Copyright © 2000-2006 O’Reilly Media, Inc. All Rights Reserved.
All trademarks and registered trademarks appearing on the O'Reilly Network are the property of their respective owners.
For problems or assistance with this site, email