Shared library annoyance with gcc-3_0-branch

H . J . Lu hjl@valinux.com
Mon Feb 19 10:10:00 GMT 2001


On Mon, Feb 19, 2001 at 10:01:37AM -0800, H . J . Lu wrote:
> On Tue, Feb 20, 2001 at 03:27:08AM +1100, Fergus Henderson wrote:
> > On 19-Feb-2001, Joseph S. Myers <jsm28@cam.ac.uk> wrote:
> > > On 19 Feb 2001, Eric W. Biederman wrote:
> > > 
> > > > The question seems more to be the case how do you get libgcc_s.so to
> > > > be installed in /lib (or at least where libc lives).  You need this
> > > 
> > > configure --with-slibdir=/lib
> > 
> > 1.  This needs to be documented prominently in the installation
> >     instructions.
> > 
> > 2.  I don't think that is enough to solve the multiple versions problem,
> >     is it?  Does that do all the usual things with symlinks and version
> >     numbers when installing libgcc_s.so?
> > 
> 
> glibc uses
> 
> # cd /lib
> # ls -l libm.so* libm-*
> -rwxr-xr-x    1 root     root       573299 Feb 13 15:08 libm-2.2.1.so
> lrwxrwxrwx    1 root     root           13 Feb  2 14:22 libm.so.6 -> libm-2.2.1.so
> 
> That is the real file is libm-${version}.so and the soname is symlink:
> 
> # ln -s libm-${version}.so ${libm_soname}
> 
> Installing a new shared libm won't override the existing one since
> ${version} should be different. ldconfig from glibc will make sure
> ${libm_soname} is linked to the most recent version of the real libm.
> Since the most recent version is 100% backward binary compatible with
> the previous ones, all the existing binaries linked against
> ${libm_soname} will work fine. For the static linker, we have
> 
> # ls -l /usr/lib/libm.so
> lrwxrwxrwx    1 root     root           19 Oct 19  1999 /usr/lib/libm.so -> ../../lib/libm.so.6
> 
> It is created manually once for one ${libm_soname}. I believe gcc
> should do the same for shared libgcc. That is libgcc_s-$version.so
> is the real file and ${libgcc_soname} should be a symlink.
> 

One more thing. Only when gcc is configured --with-slibdir=/lib, the
real shared libgcc and its soname should be installed under /lib.
Otherwise, the real shared libgcc and its soname should be installed
under $prefix/lib. libgcc_s.so should be a symlink:

# ln -s $prefix/lib/${libgcc_soname} $prefix/lib/gcc-lib/$platform/$version/libgcc_s.so

If you do that, you can have one libgcc_s-$version.so to support all
versions of gcc installed under $prefix. Of course, it assumes the
shared libgcc is 100% backward binary compatible with the previous
ones.


-- 
H.J. Lu (hjl@valinux.com)



More information about the Gcc mailing list