views:

258

answers:

1

I'm running 64-bit Solaris 10, and I have self-compiled Perl 5.10 and Postgresql 8.4.1 installed in /usr/local, both 64 bits. Solaris came with 32-bit Postgresql 8.1.4 installed in /usr, but it is not running. When I attempt to install DBD::Pg, it hits a problem because the libpq.so it finds is the 32-bit one in /usr/lib rather than the 64-bit one in /usr/local/pgsql/lib.

# /usr/local/bin/cpanp -i DBD::Pg
Installing DBD::Pg (2.15.1)
...
ld: fatal: file /usr/lib/libpq.so: wrong ELF class: ELFCLASS32

My first thought was to remove the bundled Postgres, but I've read advice against that. I'm sure everything would work if I started over with 32-bit Perl, but I'd prefer to stick with what I have.

I noticed in the CPAN output that the makefile sets LD_RUN_PATH=/usr/lib prior to linking. That seems like something that should change, but I don't know how to change it (since it's all automated by CPAN), and I don't know what other side effects such a change might have. It looks like the correct directory, /usr/local/pgsql/lib, isn't on the path at all, so maybe just making that visible would resolve the problem even without hiding the 32-bit version, but I don't know how to do that, either.

How can I get this module compiled in the environment I have, or how can I change my environment so the module will compile as-is?

+3  A: 

From http://cpansearch.perl.org/src/TURNSTEP/DBD-Pg-2.15.1/Makefile.PL

In brief:

By default Makefile.PL uses App::Info to find the location of the PostgreSQL library and include directories. However, if you want to control it yourself, define the environment variables POSTGRES_INCLUDE and POSTGRES_LIB, or define just POSTGRES_HOME. Note that if you have compiled PostgreSQL with SSL support, you must define the POSTGRES_LIB environment variable and add "-lssl" to it, like this:

export POSTGRES_LIB="/usr/local/pgsql/lib -lssl"
Alexandr Ciornii
Setting `POSTGRES_HOME=/usr/local/pgsql` worked great. No need to remove 32-bit Postgres. Thanks.
Rob Kennedy