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?