http://www.perlmonks.org?node_id=801645

dwhite20899 has asked for the wisdom of the Perl Monks concerning the following question:

I was running Perl 5.8 on OSX 10.5 with PostgreSQL 8.3.7.
I upgraded to OSX 10.6, which brought Perl 5.10 with it.
I made sure the modules I need were installed in 5.10.
I installed DBD-Pg-2.15.1 and DBI-1.609.

When I run this code

#!/usr/bin/perl -w use strict; use DBI; use DBD::Pg; use vars qw( @ImagesList ); my $dbh = DBI->connect("dbi:Pg:dbname='wonkaDB';host='192.168.1.1'", + 'willy', 'pwd0ompa') ; if ( !$dbh ) { die "ERROR: Cannot connect to database.\n\n"; } print "connected to database.\n"; my $sql_cmd = "select image from media_state where attempted IS +NULL limit 7 "; my $sth = $dbh->prepare($sql_cmd); $sth->execute() or die "Execute for media_state has failed.\n"; if ($sth->rows > 0 ) { my @fet_row = $sth->fetchrow_array; while ( @fet_row = $sth->fetchrow_array) { push(@ImagesList, $fet_row[0]); } } else { print("No images found in media_state table\n"); } $dbh->disconnect(); print join("\n",@ImagesList); exit;
I get this error
dyld: lazy symbol binding failed: Symbol not found: _PQconnectdb Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/aut +o/DBD/Pg/Pg.bundle Expected in: flat namespace dyld: Symbol not found: _PQconnectdb Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/aut +o/DBD/Pg/Pg.bundle Expected in: flat namespace Trace/BPT trap
I searched around, tried some environment variable suggestions, reinstalled Postgres, uninstalled and reinstalled modules yet still get that PQconnectdb error.

What am I missing, here? This isn't rocket surgery.

Update: I'm going to go wander off and see what's in 32 and 64 bit territory. Will report back later...

Update (later): I uninstalled PostgreSQL, uninstalled the DBD and DBI modules; then installed PostgreSQL 8.3.7 from source again (it recognized 64-bit) and DBI and DBD::Pg, and everything works. Looking at the logs, I don't see anything different from Friday's installs, but it's happy now. (I'm not happy, but I guess I don't count.)

Replies are listed 'Best First'.
Re: PQconnectdb issue in DBI, using OSX 10.6, Perl 5.10, PostgreSQL 8.3
by bichonfrise74 (Vicar) on Oct 16, 2009 at 21:55 UTC
    Did you get any errors while you were installing DBD::Pg?
      No, it was nice and clean. That adds to the frustration.