Hi,
I'm presently trying to build DBD::Pg on Solaris. Perl, PostgreSQL and
friends are all installed under the prefix /opt/mycompany. Now I can
build DBD::Pg just fine, but it fails to ever run. This is because it
can't load the dependent shared library, libpq.so:
t/00basic...........NOK 2# Failed test (t/00basic.t at line 11)
# Tried to use 'DBD::Pg'.
# Error: Can't load
# '/opt/mycompany/build/tmp/DBD-Pg/DBD-Pg-1.43/blib/arch/auto/DBD/Pg/Pg.so'
# for module DBD::Pg: ld.so.1:
# /opt/mycompany/bin/perl: fatal: libpq.so.4: open
# failed: No such file or directory at
# /opt/mycompany/lib/perl5/5.8.6/i86pc-solaris/DynaLoader.pm
# line 230.
The problem is that the RPATH isn't being set correctly when it's
linked:
% elfdump -d blib/arch/auto/DBD/Pg/Pg.so | grep PATH
[4] RUNPATH 0xfbc /usr/sfw/lib
[5] RPATH 0xfbc /usr/sfw/lib
The linker line looks like this:
LD_RUN_PATH="/opt/mycompany/lib" gcc -G Pg.o dbdimp.o quote.o types.o \
-o blib/arch/auto/DBD/Pg/Pg.so -L/opt/mycompany/lib -lpq
After much reading of manual pages, I note that ld(1) states that
LD_RUN_PATH is ignored if a -R flag is also specified. And it turns out
that gcc is adding -R/usr/sfw/lib behind my back, when I run the linker
in verbose mode. So LD_RUN_PATH is being ignored.
Is there any way to get MakeMaker to specify "-R" instead of
LD_RUN_PATH?
Alternatively, is there any way to specify OTHERLDFLAGS on the command
line of "perl Makefile.PL" in order to specify it myself in my build
script?
Thanks,
-Dom
P.S. I can show full build logs if needed, but I hoped that this would
be enough information.