0

I am trying to run a program in a server with Linux Ubuntu 3.16.0-31-generic and it gives me the following error:

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

I have searched through the internet to find a solution, and I see people talking about setting the LD_LIBRARY_PATH somehow. Most of the ways to do it required sudo, but I don't have administrator permission, so I cannot use it.

Would this indeed this solve the problem? And if yes, how could I set it?

1
  • 1
    You should be more specific about what you are doing. Most software is installed through your distribution's repositories and are expected to work out of the box without any hack. You are apparently doing something nonstandard and as such you should describe it in detail. Commented May 31, 2015 at 17:41

1 Answer 1

4

You shouldn't need permission to set this ENV (see the section on 'environment variables') variable.

And because the shared object is missing when running vs. installing an application, you shouldn't need to set this at all. You are missing a package that includes libmpich.so. Seek out and install anything from your "deb" package repository that includes the libmpich.so shared object(s). Try the following to find it/them.

$ apt-cache search mpich

Now back to the question;

There are a few ways to accomplish this. Set it yourself for the entire session, set it permanently, or tell the compiler only during compile time.

The quickest and least intrusive (regarding changing OS environment variables) is to set it for the compile procedure:

$ LD_LIBRARY_PATH=/lib:/lib64:/usr/lib:/usr/lib64 run-binary-command

Or you can set it for the current session like so:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/lib64:/usr/lib:/usr/lib64

And to set it forever:

$ echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/lib64:/usr/lib:/usr/lib64' >> ~/.profile
2
  • 1
    Use : for path separator, not ;. Otherwise you will get errors like -bash: /lib64/: Is a directory. Consult ld.so manual for valid environment variable settings.
    – yaegashi
    Commented May 31, 2015 at 14:48
  • Shoot, good catch! Updated.
    – jas-
    Commented May 31, 2015 at 14:56

You must log in to answer this question.

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