2
Error:  Can't load '/home/oracle/.cpan/build/DBD-Pg-2.16.1/blib/arch/auto/DBD/Pg/Pg.so' for module DBD::Pg: libpq.so.5: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.

Did anyone have similar error while instaling DBD::Pg perl module ? what can I do to fix it ?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Gandalf StormCrow
  • 25,788
  • 70
  • 174
  • 263
  • 1
    Sounds like you don't have Postgres installed or DBD::Pg can't find the library. btw... Could u change the tag to "postgresql" – draegtun Jan 21 '10 at 15:48
  • I have postgre installed I've connected to the database.. I've set global variables HOME, LIB and one other I can't remeber the name .. right now – Gandalf StormCrow Jan 21 '10 at 15:58

4 Answers4

4

You should go under perl to solve these dynamic linking problems. Use strace program &> out, and then grep for libpq.so.5. My guess is your libpq.so.5 is in the wrong location, or your DynaLoader is misconfigured. Read the docs on @dl_library_path.

You can see what your search path is with this (the strace will also show it trying to find the .so by checking each directory):

perl -MDynaLoader -le'print for @DynaLoader::dl_library_path;'

Make sure your libpq.5.so falls in one of those. The strace will also show if the kernel is returning an error to DynaLoader that it is cloaking; moreover, it will certainly tell you everything DynaLoader knows.

Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
0

The libpq.so.5 file is missing, which indicates that you do not have the Postgresql client library installed. On Ubuntu this file is provided by the libpq5 package.

Brian Showalter
  • 4,321
  • 2
  • 26
  • 29
0

Make sure the path to the PostgreSQL library is in either ld.so.conf or in a file in ld.so.conf.d and re-run "sudo ldconf" (or sudo /sbin/ldconf). That's taken care of this issue when I've encountered it in the past.

Matthew Wood
  • 16,017
  • 5
  • 46
  • 35
0

I know lots of people have answered your question but I thought I'd add one more thing. Makefile.PL locates the postgres libraries by executing pg_config. If this can't be found on your path, then you will find this sort of error. Interestingly though, it looks for the headers in the same way. Try running pg_config from your terminal and see what the output is. If it's not found in your path, locate it, add to your path and try to build DBD::Pg again

Nic Gibson
  • 7,051
  • 4
  • 31
  • 40