Recognising libraries.

Richard Hainsworth richard at rusrating.ru
Sat Dec 11 09:48:58 UTC 2010


> Use strace on the process to see under what paths it is looking for
> your libraries. Look for a bunch of stat() and open() calls to
> filenames ending with your library name (eg: libag_core).
>
> You might also want to check that your ldconfig is set up properly
> (for libraries you've installed yourself, distros are usually pretty
> good about that kind of thing). Run ldconfig -p to print a full
> listing of the candidates in the cache.
Recap: trying to access two libs within rakudo/parrot, viz., libag_core 
and libag_gui. Both generated from same tarball, both installed in 
/usr/local/lib

Ran ldconfig under sudo. Checked output of ldconfig -p, and both shown 
as being in /usr/local/lib.

Ran strace on rakudo test file that tries to access libag_core and 
libag_gui (see program and edited traced dump below).

Essentially parrot checks /usr/local/lib for libag_core, but does NOT 
check /usr/local/lib for libag_gui and so cannot find it.

This is looking less like a lib configuration problem and more like a 
parrot bug. What can I do next to help locate problem?

perl6 program (lib_test.p6):
#!perl6
my $lib;
for <libag_core lib_gui> {

   $lib = pir::loadlib__Ps($_);

   .print; print(' -> ',$lib);
   ' NOT'.print unless $lib;
   say ' located';
}

edited tdump generated by
strace perl6 ./lib-test > tdump 2>&1

I deleted perl6 parts, highlighted with extra lines where 
/usr/local/lib/libag_core is found, deleted irrelevant failed directory 
search

tdump:
<snip>

stat64("dynext/libag_core.so", 0xbfe10fb0) = -1 ENOENT (No such file or 
directory)
stat64("/home/richard/development/rakudo/parrot_install/dynext/libag_core.so", 
0xbfe10fb0) = -1 ENOENT (No such file or directory)
stat64("/home/richard/development/rakudo/parrot_install/lib/2.10.1-devel/dynext/libag_core.so", 
0xbfe10fb0) = -1 ENOENT (No such file or directory)
stat64("libag_core.so", 0xbfe11000)     = -1 ENOENT (No such file or 
directory)
open("/home/richard/development/rakudo/parrot_install/lib/libag_core.so", O_RDONLY) 
= -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=93231, ...}) = 0
mmap2(NULL, 93231, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb722f000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or 
directory)


open("/usr/local/lib/libag_core.so", O_RDONLY) = 3


read(3, 
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0g\0\0004\0\0\0"..., 
512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=221955, ...}) = 0
mmap2(NULL, 196900, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 
0) = 0x497000
mmap2(0x4c5000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2d) = 0x4c5000
mmap2(0x4c7000, 292, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4c7000
close(3)                                = 0
mprotect(0x4c5000, 4096, PROT_READ)     = 0
munmap(0xb722f000, 93231)               = 0
write(1, "libag_core", 10libag_core)              = 10
write(1, " -> ", 4 -> )                     = 4
write(1, "libag_core", 10libag_core)              = 10
write(1, " located", 8 located)                 = 8
write(1, "\n", 1
)                       = 1
stat64("dynext/lib_gui.so", 0xbfe10fb0) = -1 ENOENT (No such file or 
directory)
stat64("/home/richard/development/rakudo/parrot_install/dynext/lib_gui.so", 
0xbfe10fb0) = -1 ENOENT (No such file or directory)
stat64("/home/richard/development/rakudo/parrot_install/lib/2.10.1-devel/dynext/lib_gui.so", 
0xbfe10fb0) = -1 ENOENT (No such file or directory)
stat64("lib_gui.so", 0xbfe11000)        = -1 ENOENT (No such file or 
directory)
open("/home/richard/development/rakudo/parrot_install/lib/lib_gui.so", 
O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=93231, ...}) = 0
mmap2(NULL, 93231, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb722f000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or 
directory)
open("/lib/tls/i686/sse2/cmov/lib_gui.so", O_RDONLY) = -1 ENOENT (No 
such file or directory)
stat64("/lib/tls/i686/sse2/cmov", 0xbfe10a04) = -1 ENOENT (No such file 
or directory)
open("/lib/tls/i686/sse2/lib_gui.so", O_RDONLY) = -1 ENOENT (No such 
file or directory)
stat64("/lib/tls/i686/sse2", 0xbfe10a04) = -1 ENOENT (No such file or 
directory)
open("/lib/tls/i686/cmov/lib_gui.so", O_RDONLY) = -1 ENOENT (No such 
file or directory)

<snip> <lots and lots of lib directories>

open("/usr/lib/i486-linux-gnu/lib_gui.so", O_RDONLY) = -1 ENOENT (No 
such file or directory)
stat64("/usr/lib/i486-linux-gnu", 0xbfe10a04) = -1 ENOENT (No such file 
or directory)
munmap(0xb722f000, 93231)               = 0
stat64("dynext/lib_gui", 0xbfe10fb0)    = -1 ENOENT (No such file or 
directory)
stat64("/home/richard/development/rakudo/parrot_install/dynext/lib_gui", 
0xbfe10fb0) = -1 ENOENT (No such file or directory)
stat64("/home/richard/development/rakudo/parrot_install/lib/2.10.1-devel/dynext/lib_gui", 
0xbfe10fb0) = -1 ENOENT (No such file or directory)
stat64("lib_gui", 0xbfe11000)           = -1 ENOENT (No such file or 
directory)
write(1, "lib_gui", 7lib_gui)                  = 7
write(1, " -> ", 4 -> )                     = 4
write(1, " NOT", 4 NOT)                     = 4
write(1, " located", 8 located)                 = 8
write(1, "\n", 1
)                       = 1

<snip>


More information about the parrot-dev mailing list