When trying to start a certain program, I got the following error message:

error while loading shared libraries: foo.so.0: cannot open shared object file: No such file or directory

Therefore I built the required library and installed it under the directory /usr/local/lib/. However, after building the library, there were only the files foo.so, foo.so.1 and foo.so.1.0.8 under /usr/local/lib/. So I created an additional symbolic link to foo.so.1.0.8 named foo.so.0. I checked that /usr/local/lib is included in some file under /etc/ld.so.conf.d/ and started sudo ldconfig.

Unfortunately ldconfig seems to ignore my self-created symbolic link. ldconfig -v prints only the following line:

foo.so.1 -> foo.so.1.0.8

ldconfig -p prints only the following two lines:

foo.so.1 (libc6,x86-64) => /usr/local/lib/foo.so.1

foo.so (libc6,x86-64) => /usr/local/lib/foo.so

There is not a blind bit of the file foo.so.0. What do I have to do?

  • What are you trying to install / run and how did you install it? Sounds as if you installed a package outside of apt (apt-get or the software center).
    – Panther
    Commented Feb 18, 2014 at 23:30
  • I downloaded and built an Open MPI release as I have to run a program which requires it. Commented Feb 18, 2014 at 23:36
  • did you try installing openmpi from the repos ? sudo apt-get install openmpi-bin ? Otherwise , link to what you installed please.
    – Panther
    Commented Feb 18, 2014 at 23:37
  • I downloaded the tarball from the official website and did the following: open-mpi.org/faq/?category=building#easy-build Commented Feb 18, 2014 at 23:41
  • 2
    I can not tell from what you posted, it is hard to follow foo and foo.0 without knowing what you are doing and output of a few commands such as ls and also the exact error message you are getting.
    – Panther
    Commented Feb 18, 2014 at 23:55

2 Answers 2


TL:DR: Use a version (or build) of the program that supports the installed library version, if possible.

As bodhi.zazen says, it's hard to know quite what's going on without the specific exact commands you ran and the output. However, foo.so.0 and foo.so.1 should not be expected to be compatible.

To make a program compiled to use major version 0 of a library work with major version 1, it's advisable to rebuild (recompile and relink) the program. Furthermore, the interface a library provides to programs may change, and often does change, across major versions, so this is only sometimes practical.

Usually it is instead better to install a newer version of the program that supports the library version you want to use, if possible.

Alternatively, if you can install the old version of the library alongside the new one, that may also get the program to work. (If you're sure no other program uses the currently installed version of the library, then you could uninstall it before installing the old one. If it's provided by an Ubuntu package then you would do this by uninstalling that package. Different major versions of a library often do support being installed at the same time, though.)

In cases where you cannot installed the library version the program needs and you're willing to accept serious instability and unpredictable behavior from program, it's occasionally possible to get it to work with the new library by making a copy, naming it like the old library, and editing the version information inside it with a hex editor. I have done this before, but I have never seriously relied on software that was made to work in this way, and you shouldn't either.

This answer is deliberately general. Without more details about what program needs the library, how the program is (or can be) installed, and what versions of the library it supports, it's probably not possible to give more detailed advice.


From what I remember in ubuntu, just adding symlinks in /usr/local/lib may not be sufficient. We need update ld.so.conf entry corresponding to this to let ldconfig know what symlinks it has to create for us.

Like bodhi.zazen mentioned, installing from apt is simpler, because apt would very likely setup ld.so.conf files as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .