On Fri, Apr 11, 2008 at 6:43 PM, <[EMAIL PROTECTED]> wrote:
> This problem happened to me when I have packed newer version of the
> external lib but there was an older version of the same lib installed
> on the target host. The Dynaloader loads the older one first and
> then my executable dies because older version of that external lib is
> not supported by packed perl wrapper module.
> How to pass a list of directories to look for the external shared
> libs as an option to pp utility ( like the LD_LIBRARY_PATH) which
> will modify Dynaloader config ?
I can't reproduce this (with PAR::Packer 0.977 and Perl 5.10.0 on Linux),
at least not with the following simple example (XML::Parser::Expat is not
essential, I just needed a module that links to an external shared library,
libexpat.so.1 in this case):
$ pp -o foo.exe -l /usr/lib/libexpat.so.1 -e 'use XML::Parser::Expat;
print "hullo\n"'
$ strace -f -o truss -v -e trace=process,file -s 500 ./foo.exe
hullo
check that libexpat.so.1 has been packaged:
$ unzip -l foo.exe
...
538 04-12-08 12:48 script/main.pl
39 04-12-08 12:48 script/ppeiNuP.pl
134348 07-24-07 23:03 shlib/i486-linux-gnu-thread-multi/libexpat.so.1
and looking at truss:
6510
execve("/tmp/par-schupp/cache-5ed44847437f00b719fe3e1ea87ca31da183e7b8/foo.exe",
["./foo.exe"],
[..."LD_LIBRARY_PATH=/tmp/par-schupp/cache-5ed44847437f00b719fe3e1ea87ca31da183e7b8",...])
= 0
so LD_LIBRARY_PATH is correctly set to look into PAR's cache first.
And the search for libexpat.so.1 proceeds like this (note that 166b167d.{bs,so}
is Expat.{bs,so} as renamed by PAR::Packer):
6510
stat64("/tmp/par-schupp/cache-5ed44847437f00b719fe3e1ea87ca31da183e7b8/166b167d.bs",
0x97600c0) = -1 ENOENT (No such file or directory)
6510
open("/tmp/par-schupp/cache-5ed44847437f00b719fe3e1ea87ca31da183e7b8/166b167d.so",
O_RDONLY) = 7
6510
open("/tmp/par-schupp/cache-5ed44847437f00b719fe3e1ea87ca31da183e7b8/libexpat.so.1",
O_RDONLY) = 7
i.e. libexpat.so.1 has been loaded from the cache directory (and _not_
from /usr/lib)
AFAIK, external shared libraries are _not_ loaded by Dynaloader directly,
it only dlopen's the perl glue library, Expat.so in this example. The system
runtime loader then detects that Expat.so depends on libexpat.so.1
$ readelf -d /usr/lib/perl5/auto/XML/Parser/Expat/Expat.so
Dynamic section at offset 0x16bf8 contains 22 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libexpat.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000c (INIT) 0x28a4
0x0000000d (FINI) 0x15644
...
and loads it according to the LD_LIBRARY_PATH in effect.
Perhaps your glue library has absolute paths in the NEEDED tags
or has an RPATH tag (which may take precedence over LD_LIBRARY_PATH)?
Cheers, Roderich