Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory

I am trying to execute pg_dump on PostgreSQL 9.0.4 server running on Debian and I am getting the error below:

./pg_dump: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory  

libpq.so.5 is a link to libpq.so.5.3 as shown below

lrwxrwxrwx 1 root root     12 Jun 27 16:24 libpq.so.5 -> libpq.so.5.3 -rwxr-xr-x 1 root root 180749 Jun 21 02:43 libpq.so.5.3 

What is it that I am doing wrong?

like image 730
McKibet Avatar asked Oct 08 '12 12:10

McKibet


2 Answers

In which directory are these libpq files? You can try setting environment variable LD_LIBRARY_PATH to point to this directory or make sure it's in standard place.

Also, why isn't the libpq.so.5 link shown in the "as shown below" section? Maybe you should just run ldconfig?

like image 42
Michael Krelin - hacker Avatar answered Sep 16 '22 22:09

Michael Krelin - hacker


Try this:

1: Know the path of libpq.so.5

find / -name libpq.so.5 

Output example: /usr/pgsql-9.4/lib/libpq.so.5 If found nothing, check if you have already installed the suitable postgresql-libs for your postgresql version and your OS platform

2: Symbolic link that library in a "well known" library path like /usr/lib:

ln -s /usr/pgsql-9.4/lib/libpq.so.5 /usr/lib/libpq.so.5 

Attention: If your platform is 64 bit, you MUST also symbolic link to 64 bit libraries path:

ln -s /usr/pgsql-9.4/lib/libpq.so.5 /usr/lib64/libpq.so.5 

3: Be happy !

like image 125
Yahya Yahyaoui Avatar answered Sep 17 '22 22:09

Yahya Yahyaoui