Confusion about threadlibs?

walt wa1ter at myrealbox.com
Sun Jan 20 10:35:48 PST 2008



On Thu, 17 Jan 2008, Simon 'corecode' Schubert wrote:

> walt wrote:
> > > > Loaded symbols for /usr/lib/libthread_xu.so.2    <========== huh?
> > > >
> > > > Wait just a minute -- what is libthread_xu doing there?  I'm using
> > > > libc_r, not xu:

> > > somebody insists to link to libthread_xu.  maybe one of the libs, maybe
> > > the
> > > perl build itself.  try a ldd on all involved binaries.
> >
> > # readelf -d /usr/lib/libpthread.so
> > Dynamic section at offset 0x620 contains 20 entries:
> >   Tag        Type                         Name/Value
> >  0x00000001 (NEEDED)                     Shared library: [libthread_xu.so.2]
> >
> > Maybe?

> No, that's okay.  Nobody is using libpthread.so on execution, but only
> libpthread.so.0, so keep searching :)

Hmm.  Let me explain why I don't quite believe that.

The miniperl compiled during the build and the previously installed
/usr/pkg/bin/perl were *both* linked against lib_xu, even though
libpthread.so.0 was symlinked to libc_r.  (The only way I got perl
installed in the first place was to have libpthread.so.0 linked to
lib_xu, and afterwards I switched the link back to libc_r.)

As an experiment I symlinked libpthread.so.0 to libc_r.so and then
moved lib_xu out of the way so the loader couldn't find it.  Seems
to me this *should* work because libpthread.so is still pointing
to a valid threadlib (libc_r).  But it doesn't work:  trying to link
miniperl that way, I get complaints that 'pthread_atfork' is missing
and that symbol is defined only in lib_xu.

To test if it really is okay for libpthread.so to be linked against
lib_xu, I used hexedit to remove the reference to it in the actual
libpthread.so binary.  (Really, I edited the reference to point to
libbluetooth, just because the name is exactly the same length :o)

Now I can build perl using either threadlib, and neither miniperl
nor perl is linked (permanently) against lib_xu.

Could very well be that I just don't understand any of this, but
so far it seems to be working well.  Can you suggest any tests I
should do to see if my modified libpthread.so will cause problems?

Thanks for the help!





More information about the Bugs mailing list