[lxc-devel] [PATCH] Link against pthread when not on bionic.

Dwight Engen dwight.engen at oracle.com
Mon Feb 18 21:10:30 UTC 2013


On Mon, 18 Feb 2013 15:46:24 -0500
Stéphane Graber <stgraber at ubuntu.com> wrote:

> On 02/18/2013 03:40 PM, Daniel Lezcano wrote:
> > On 02/18/2013 06:23 PM, Stéphane Graber wrote:
> >> dpkg spotted that we're not explicitly linking against pthread
> >> even though we use some of its symbols (sem_*).
> > 
> > uh ? wait.
> > 
> > We shouldn't link against the lib pthread.
> > 
> > I don't think sem_* is a symbol coming from the pthread library.

Also see commit 5f29734f. I believe we found that nm showed sem_* to be
coming from libpthread and not librt, in spite of the fact that I've
seen some (older?) man pages that say "Link with -lrt or -pthread".

> > 
> > Could you give the output of dpkg ?
> 
> From "man sem_open":
>        Link with -pthread.
> 
> dpkg-shlibdeps output:
> dpkg-shlibdeps: warning: symbol sem_post used by
> debian/liblxc0/usr/lib/x86_64-linux-gnu/liblxc.so.0.9.0.alpha3 found
> in none of the libraries
> dpkg-shlibdeps: warning: symbol sem_open used by
> debian/liblxc0/usr/lib/x86_64-linux-gnu/liblxc.so.0.9.0.alpha3 found
> in none of the libraries
> dpkg-shlibdeps: warning: symbol sem_close used by
> debian/liblxc0/usr/lib/x86_64-linux-gnu/liblxc.so.0.9.0.alpha3 found
> in none of the libraries
> dpkg-shlibdeps: warning: symbol sem_init used by
> debian/liblxc0/usr/lib/x86_64-linux-gnu/liblxc.so.0.9.0.alpha3 found
> in none of the libraries
> dpkg-shlibdeps: warning: symbol sem_timedwait used by
> debian/liblxc0/usr/lib/x86_64-linux-gnu/liblxc.so.0.9.0.alpha3 found
> in none of the libraries
> dpkg-shlibdeps: warning: symbol sem_destroy used by
> debian/liblxc0/usr/lib/x86_64-linux-gnu/liblxc.so.0.9.0.alpha3 found
> in none of the libraries
> dpkg-shlibdeps: warning: symbol sem_wait used by
> debian/liblxc0/usr/lib/x86_64-linux-gnu/liblxc.so.0.9.0.alpha3 found
> in none of the libraries
> 
> 
> Looking at pthread.so it appears to provide:
> sem_init
> sem_destroy
> sem_open
> sem_close
> sem_unlink
> sem_getvalue
> sem_wait
> sem_trywait
> sem_timedwait
> sem_post
> 
> >>
> >> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> >> ---
> >>  src/lxc/Makefile.am | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
> >> index 8974ca9..a0077aa 100644
> >> --- a/src/lxc/Makefile.am
> >> +++ b/src/lxc/Makefile.am
> >> @@ -115,7 +115,7 @@ liblxc_so_LDFLAGS = \
> >>  liblxc_so_LDADD = $(CAP_LIBS) $(APPARMOR_LIBS) $(SECCOMP_LIBS)
> >>  
> >>  if !IS_BIONIC
> >> -liblxc_so_LDADD += -lutil -lrt
> >> +liblxc_so_LDADD += -lutil -lrt -lpthread
> >>  endif
> >>  
> >>  bin_SCRIPTS = \
> > 
> 
> 





More information about the lxc-devel mailing list