Re: Dynamic library loader search path



"Gregory" <g_greg@xxxxxxxxxxxxxxx> writes:

Loader searches for dynamic libraries in directories specified in
$LD_LIBRARY_PATH environment variables. However it's not all, loader
also searches in directories in $LD_LIBRARY_PATH augmented with many
sub-paths like lib/i686/mmx, tls, mmx, i686 and so on. Where do these
sub-paths come from ?

These are compiled into ld-linux.so.2 -- it goes over all the search
directories, and for each appends each "capability string". Look
in elf/dl-load.c open_path().

The capability strings are filled by _dl_important_hwcaps() in
sysdeps/generic/dl-sysdep.c and (AFAICT) you can't modify any of
this without rebuilding glibc.

Is it possible to configure them or even cancel them ?

No (AFAICT).

The problem I encountered is that loader first searches within
directories suffixed with all these sub-passes and only then in the
directory itself. This highly increases dynamic library search time.

How many directories *are* you searching?

Unless your LD_LIBRARY_PATH contains 1000s of directories (or you
are searching directories on a slow NFS server), I don't see how
searcing 4 times as many would "highly increase search time".

If you are searching many directories, a better solution might be
to either dlopen() with absolute path, or collect all your libraries
into a single directory (with symlinks).

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.