[lfs-support] Link to libbz2.so

Feuerbacher, Alan AFeuerbacher at ALLEGROMICRO.com
Fri Aug 24 11:59:24 PDT 2012

> -----Original Message-----
> From: lfs-support-bounces at linuxfromscratch.org [mailto:lfs-support-
> bounces at linuxfromscratch.org] On Behalf Of Bruce Dubbs
> Sent: Friday, August 24, 2012 1:24 PM
> To: LFS Support List
> Subject: Re: [lfs-support] Link to libbz2.so
> 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

Again, thanks for your comments. However, my system doesn't behave the way I would expect, in terms of what you've said. Here is what I have in /lib and /usr/lib :

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

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

If I do something trivial with bzip2 it works fine:

$ pwd
$ bzip2 --version
bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010.
   Copyright (C) 1996-2010 by Julian Seward.
. . .

But if I remove the link /usr/lib/libbz2.so.1.0 it quits working:

$ rm libbz2.so.1.0
$ bzip2 --version
bzip2: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory

Any idea what's going on?

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

I have that.
> 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.

Interesting. I'm just a beginner with LFS, so what I know about where these programs are placed is mostly from LFS sources. The LFS book talks about the FileSystem Hierarchy Standard (FHS). Do the contemplated changes reflect a change in this standard, or only in what LFS folks are doing?


More information about the lfs-support mailing list