in reply to adding RPATH to Sybase.so

I think you're out of luck with adding to LDDLFLAGS, but you could try setting

WriteMakefile( ... dynamic_lib => { OTHERLDFLAGS => '-Wl,-rpath,/usr/local/dept/lib' +}, ... );

in Makefile.PL — which should achieve the same effect.  OTHERLDFLAGS is being inserted a little later on the linker command line, i.e.  $(LD)  $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) ..., but that's not a problem, as it doesn't matter at which position the rpath option occurs.

Replies are listed 'Best First'.
Re^2: adding RPATH to Sybase.so
by jklowden (Novice) on Jan 13, 2010 at 17:11 UTC

    The story is there's no general answer. If LDDLFLAGS is overridden on the command line (LDDLFLAGS=-R/yada/yada) the value replaces what would ordinarily be there, because it overrides the value set by the hash passed to WriteMakefile in Makefile.PL. That is, WriteMakefile examines @ARGV for variable=value pairs and takes what it finds as overrides. (Observed behavior; I can't find the source code.)

    To extend LDDLFLAGS, one would have to know how Makefile.PL sets it. I don't know of any way to do that except by examining the sources. (Afaik there's no MakeMaker option to print variable values, although I suppose -qp could be passed to make(1) to do that instead.)

    Peeking inside Makefile.PL, one can easily see that LDDLFLAGS is set to the contanenation "-L$Sybase/lib" and $Config::Config{lddlflags}. So the hack would be something like: perl Makefile.PL LDDLFLAGS=$(perl -e'use Config; print qq("-L$ENV{SYBASE}/lib $Config{lddlflags} -R/yada")') which I guess is OK.

    Extending your suggestion, I added a new --other_dlflags option to Makefile.PL and sent a patch to Michael Peppler. Perhaps 1.10 will be a little easier to use. :-)