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

Re: dh_shlibdeps: bogus? warnings when linking against pthread

On Sun, Oct 19, 2008 at 03:39:20PM +0000, Gregor Jasny wrote:
> Hi,
> when I build the libv4l package [1] the following warning is emitted:
> >dpkg-shlibdeps: warning: dependency on libpthread.so.0 could be avoided 
> >if "debian/libv4l-0/usr/lib/libv4l1.so.0 
> >debian/libv4l-0/usr/lib/libv4l2.so.0" were not uselessly linked against 
> >it (they use none of its symbols).
> But libv4l1 and libv4l2 are using the pthread_mutex_* funtions:
> >gjasny@Rincewind:~/src/debian/exp/libv4l$ objdump -T 
> >debian/libv4l-0/usr/lib/libv4l1.so.0
> >debian/libv4l-0/usr/lib/libv4l1.so.0:     file format elf64-x86-64
> > ...
> >0000000000000000      DF *UND*  0000000000000751  GLIBC_2.2.5 
> >pthread_mutex_lock
> >0000000000000000      DF *UND*  000000000000000a  GLIBC_2.2.5 
> >pthread_mutex_unlock
> >...
> The weird thing is that this symbol is defined in libc and also in 
> libpthread:
> >$ objdump -T /lib/libc.so.6 |grep mutex_lock
> >00000000000dae50 g    DF .text  0000000000000027  GLIBC_2.2.5 
> >pthread_mutex_lock
> >$ objdump -T /lib/libpthread.so.0 |grep mutex_lock
> >0000000000008490 g    DF .text  0000000000000751  GLIBC_2.2.5 
> >pthread_mutex_lock
> >0000000000008490 g    DF .text  0000000000000751  GLIBC_2.2.5 
> >__pthread_mutex_lock
> Can anyone shed some light on this issue?

Glibc has stubs for many of the pthread functions, that do nothing when
libpthread isn't loaded. This way, code has not runtime performance for
using mutexes and locking when there is no thread used.

If your library only uses the stuff that the libc has stubs for, then
you don't want to force linking against libpthread, as it will bring a
performance penalty for mono-threaded programs.
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpmN88mtJZ_j.pgp
Description: PGP signature

Reply to: