On Apr 12, 6:03 am, [EMAIL PROTECTED] (Roderich Schupp) wrote: > 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): > Hi Roderich,
The executable was built with perl 5.8.6. The external library was libxml2 and I've unset LD_LIBRARY_PATH and strace showed it as: "LD_LIBRARY_PATH=/tmp/par-netadmin/cache- ed41b9f9ecb8047fb149dc3bb6cffa5d265bb21d" The library is there: 10880 stat64("/tmp/par-netadmin/cache- ed41b9f9ecb8047fb149dc3bb6cffa5d265bb21d/libxml2.so.2", {st_dev=makedev(3, 3), st_ino=426018, st_mode=S_IFREG|0644, st_nlink=1, st_uid=2301, st_gi d=1750, st_blksize=4096, st_blocks=1896, st_size=965792, st_atime=2008/01/11-11:43:10, st_mtime=2008/01/11-11:43:10, st_ctime=2008/04/14-16:24:57}) = 0 But it failed to find it: 10880 stat64("/tmp/par-netadmin/cache- ed41b9f9ecb8047fb149dc3bb6cffa5d265bb21d/8f7ed037.bs", 0x8126dc0) = -1 ENOENT (No such file or directory) 10880 open("/tmp/par-netadmin/cache- ed41b9f9ecb8047fb149dc3bb6cffa5d265bb21d/8f7ed037.so", O_RDONLY) = 9 10880 open("/usr/lib/tls/i686/mmx/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) 10880 stat64("/usr/lib/tls/i686/mmx", 0xbfff8e3c) = -1 ENOENT (No such file or directory) 10880 open("/usr/lib/tls/i686/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) 10880 stat64("/usr/lib/tls/i686", 0xbfff8e3c) = -1 ENOENT (No such file or directory) 10880 open("/usr/lib/tls/mmx/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) 10880 stat64("/usr/lib/tls/mmx", 0xbfff8e3c) = -1 ENOENT (No such file or directory) 10880 open("/usr/lib/tls/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) 10880 stat64("/usr/lib/tls", 0xbfff8e3c) = -1 ENOENT (No such file or directory) 10880 open("/usr/lib/i686/mmx/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) 10880 stat64("/usr/lib/i686/mmx", 0xbfff8e3c) = -1 ENOENT (No such file or directory) 10880 open("/usr/lib/i686/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) 10880 stat64("/usr/lib/i686", 0xbfff8e3c) = -1 ENOENT (No such file or directory) 10880 open("/usr/lib/mmx/libxml2.so.2", O_RDONLY) = -1 ENOENT (No such file or directory) 10880 stat64("/usr/lib/mmx", 0xbfff8e3c) = -1 ENOENT (No such file or directory) 10880 open("/usr/lib/libxml2.so.2", O_RDONLY) = 9 It found libxml2 only locally. --Max > $ 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