[lfs-support] Link to libbz2.so

Bruce Dubbs bruce.dubbs at gmail.com
Fri Aug 24 10:23:39 PDT 2012

Feuerbacher, Alan wrote:

>>> In the LFS book, version SVN-20120824, section 6.19.Bzip2-1.0.6,
>> there
>>> is a line near the end:
>>> ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
>>> The problem I've experienced is that when bzip2 fires up after
>>> this compilation step, it can't find the library libbz2.so.1.0 .
>>> When I make another link like this:
>>> ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so.1.0
>>> everything works fine when bzip2 is executed, i.e., libbz2.so.1.0
>>> is found.
>> The file should be in /lib, not /usr/lib.  You may have to run
>> ldconfig first.  The link should not be needed.
>> $ ldd /bin/bzip2 linux-gate.so.1 (0xffffe000) libbz2.so.1.0 =>
>> /lib/libbz2.so.1.0 (0xb778b000) libc.so.6 => /lib/libc.so.6
>> (0xb75da000) /lib/ld-linux.so.2 (0xb77b4000)

> Thanks. Does that mean that the entry showing /usr/lib/libbz2.so in
> the LFS book should really be /lib/libbz2.so ?

No.  The .so files are used for the ld command when a program is being 
linked.  That should be in /usr/lib.  The .so.1 (or .so.x.y) files can 
be in /usr/lib or /lib, but programs and libraries that may be needed 
before /usr is mounted (if it is separate from the root partition) 
should be in /lib (or /bin,/sbin).  ldd loads the program for execution 
and will look for libbz2.so.1.0 in /lib.  In this case we have:

   /lib/libbz2.so.1.0 -> libbz2.so.1.0.6
   /usr/lib/libbz2.so -> ../../lib/libbz2.so.1.0

If you have static libraries (disliked by some of out devs), it shoudl 
be in /usr/lib, e.g. /usr/lib/libbz2.a.

Note, there are efforts under way to remove /bin, /sbin, and /lib and 
put everything in /usr.  We may do that for LFS 7.3.

   -- Bruce

More information about the lfs-support mailing list