Bug#72140: Setting up libraries too slow
On Sat, Sep 23, 2000 at 12:23:20AM +0200, Wichert Akkerman wrote:
> Previously Daniel Burrows wrote:
> > On the other hand -- if it's true that ldconfig is not strictly necessary for
> > programs to run, it may be sufficient (?) to perform the postinsts without
> > ldconfig, or with only updating the library links, and then do one big
> > ldconfig run at the end just to bring everything up-to-date for optimal
> > performance.
>
> I think there are some cases where it is needed to assure proper system
> integrity, which is why we have dependencies ay all..
I thought we had dependancies because certain programs wont run without
certain libraries installed?
Anyway, from the ld.so man page:
The necessary shared libraries needed by the program are
searched for in the following order
o Using the environment variable LD_LIBRARY_PATH
(LD_AOUT_LIBRARY_PATH for a.out programs). Except
if the executable is a setuid/setgid binary, in
which case it is ignored.
o From the cache file /etc/ld.so.cache which contains
a compiled list of candidate libraries previously
found in the augmented library path.
o In the default path /usr/lib, and then /lib.
ie. gkrellm uses a large number of libraries:
root@pyre[~]# ldd /usr/bin/gkrellm
libgtk-1.2.so.0 => /usr/lib/libgtk-1.2.so.0 (0x40019000)
libgdk-1.2.so.0 => /usr/lib/libgdk-1.2.so.0 (0x4013d000)
libgmodule-1.2.so.0 => /usr/lib/libgmodule-1.2.so.0 (0x40171000)
libgthread-1.2.so.0 => /usr/lib/libgthread-1.2.so.0 (0x40174000)
libglib-1.2.so.0 => /usr/lib/libglib-1.2.so.0 (0x40178000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4019a000)
libdl.so.2 => /lib/libdl.so.2 (0x401ad000)
libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x401b1000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x401b9000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x401c5000)
libm.so.6 => /lib/libm.so.6 (0x40267000)
libgdk_imlib.so.1 => /usr/lib/libgdk_imlib.so.1 (0x40284000)
libc.so.6 => /lib/libc.so.6 (0x402b2000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
root@pyre[~]# rm /etc/ld.so.cache
root@pyre[~]# /usr/bin/gkrellm
/usr/bin/gkrellm: error in loading shared libraries: libXi.so.6: cannot open
shared object file: No such file or directory
root@pyre[~]# ldd /usr/bin/gkrellm
libgtk-1.2.so.0 => /usr/lib/libgtk-1.2.so.0 (0x40014000)
libgdk-1.2.so.0 => /usr/lib/libgdk-1.2.so.0 (0x40138000)
libgmodule-1.2.so.0 => /usr/lib/libgmodule-1.2.so.0 (0x4016c000)
libgthread-1.2.so.0 => /usr/lib/libgthread-1.2.so.0 (0x4016f000)
libglib-1.2.so.0 => /usr/lib/libglib-1.2.so.0 (0x40173000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40195000)
libdl.so.2 => /lib/libdl.so.2 (0x401a8000)
libXi.so.6 => not found
libXext.so.6 => not found
libX11.so.6 => not found
libm.so.6 => /lib/libm.so.6 (0x401ad000)
libgdk_imlib.so.1 => /usr/lib/libgdk_imlib.so.1 (0x401ca000)
libc.so.6 => /lib/libc.so.6 (0x401f8000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
libXi.so.6 => not found
libXext.so.6 => not found
libX11.so.6 => not found
libXi.so.6 => not found
libXext.so.6 => not found
libX11.so.6 => not found
So libraries in /usr/lib and /lib are found without the cache.
It would be sufficient for a postinst script to simply set the
LD_LIBRARY_PATH, any libraries that might be needed will be found even if
ldconfig wasnt run:
root@pyre[~]# export LD_LIBRARY_PATH=/usr/X11R6/lib
root@pyre[~]# ldd /usr/bin/gkrellm
libgtk-1.2.so.0 => /usr/lib/libgtk-1.2.so.0 (0x40014000)
libgdk-1.2.so.0 => /usr/lib/libgdk-1.2.so.0 (0x40138000)
libgmodule-1.2.so.0 => /usr/lib/libgmodule-1.2.so.0 (0x4016c000)
libgthread-1.2.so.0 => /usr/lib/libgthread-1.2.so.0 (0x40170000)
libglib-1.2.so.0 => /usr/lib/libglib-1.2.so.0 (0x40173000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40195000)
libdl.so.2 => /lib/libdl.so.2 (0x401a8000)
libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x401ac000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x401b4000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x401c0000)
libm.so.6 => /lib/libm.so.6 (0x40262000)
libgdk_imlib.so.1 => /usr/lib/libgdk_imlib.so.1 (0x4027f000)
libc.so.6 => /lib/libc.so.6 (0x402ad000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
I think setting one envoromnment variable is slightly faster than running
ldconfig :)
Of course the cache can be updated eventually (at the end?) in order to
imporove performance..
PS. Anyone know what other distro's (redhat?) do? Installing rpm's seems
faster than .deb's, but I dont know if that has anything to do with this
issue.
Reply to: