Moving libs to /lib
tushar at linuxfromscratch.org
Sun Jan 9 11:50:59 PST 2005
Matthew Burgess wrote:
> OK, I'm working on zlib at the moment. Why do we shift everything to
> /lib and then rm /lib/libz.so and relink it to /usr/lib? Why not put
> all of zlib's dynamic libraries in /lib and be done with it? Is there
> something that expects to find /usr/lib/libz.so? If so why not just
> create a symlink? It seems really backwards putting everything in
> /lib and then immediately deleting it!
> For those wondering why we're shifting the libs around in the first
> place, the following binaries, which may be feasibly required during
> bootup, require zlib: ping, e2fsk.cramfs, mkfs.cramfs. As /usr may
> not be mounted when they're required, libz.so needs to be in /lib.
As per FHS, /lib only contains the essential libs (and kernel modules)
to boot up the system. During bootup libz.so is not needed, only
libz.so.x is needed. Hence libz.so.x*needs to be moved to /lib. libz.so
is only needed during compilation and hence not needed in /lib.
Additionally, if libz.a is in /usr/lib and libz.so is in /lib, when a
executable/library is being linked against libz, the compiler may find
the static lib before the shared lib and link statically against libz
(which is not what you want).
More information about the lfs-dev