[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#227906: libc6: Failed assertion in ld.so



Daniel Jacobowitz wrote:

> > > The shared library you open, if it is correctly built, will reference
> > > shared libc.so.6, causing libc.so.6 to be dlopen'd into your
> > > application.  If it mismatches the included version of glibc unknown
> > > things will happen, and in the past, have happened.
> >
> > OTOH, I the library is built with static libc, there's no problem. Of
> > course, unless two statically linked copies of libc will decide to have a
> > fight -- and I don't know if they will.
>
> You didn't read what I said correctly.  The dlopened library will be
> _dynamically_, not statically, linked with libc.  So you end up with a
> static copy and a dynamic copy - boom.

In my experiment, I've created a library on which ldd says:

   bash-2.05b$ ldd lib.so
           statically linked

Or are you saing that even though library itself does not reference dynamic 
libraries, the fact that it's opened with dlopen will link it to libc 
dynamically, because that's how dlopen works?

> > > > 3. Should not the docs say that static linking to libc is not
> > > > possible if any dynamic libraries are used?
> > >
> > > If you had just statically linked to libc, then the result might have
> > > been different.  Playing with -Bstatic in this way is not a good way to
> > > accomplish it.
> >
> > So, essentially -Bstatic is not suitable for selecting between static and
> > dynamic versions of given library?
>
> It is for non-system libraries.  You are performing a dynamic link.
> -Bstatic -lfoo -Bdynamic is probably fine.  It's the trailing -Bstatic
> and assuming what that will do to any implicitly linked libraries that
> is illegal.

Okay. Thanks for exlanation!

- Volodya








Reply to: