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

Dwight Engen dwight.engen at oracle.com
Tue Feb 19 15:28:34 UTC 2013


On Tue, 19 Feb 2013 10:02:37 -0500
Stéphane Graber <stgraber at ubuntu.com> wrote:

> On 02/19/2013 09:19 AM, Serge Hallyn wrote:
> > Quoting Natanael Copa (ncopa at alpinelinux.org):
> >> On Mon, 18 Feb 2013 21:40:42 +0100
> >> Daniel Lezcano <daniel.lezcano at free.fr> 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.
> >>
> >> Seems to be with uClibc:
> >>
> >> ncopa-desktop:~$ nm -D /lib/libpthread.so.0.9.32 | grep sem_
> >> 000000000000d168 T __new_sem_destroy
> >> 000000000000a914 T __new_sem_getvalue
> >> 000000000000a414 T __new_sem_init
> >> 000000000000c219 T sem_close
> >> 000000000000d168 W sem_destroy
> >> 000000000000a914 W sem_getvalue
> >> 000000000000a414 W sem_init
> >> 000000000000c744 T sem_open
> >> 0000000000006db0 T sem_post
> >> 0000000000006e00 T sem_timedwait
> >> 0000000000006f80 T sem_trywait
> >> 00000000000095c8 T sem_unlink
> >> 0000000000006fb0 T sem_wait
> >>
> >> How about let autoconf detect what to link against?
> >>
> >> @@ -274,6 +274,9 @@ AC_CHECK_HEADERS([sys/signalfd.h pty.h
> >> sys/capability.h sys/ # Check for some syscalls functions
> >>  AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
> >>  
> >> +# find library for sem_*
> >> +AC_SEARCH_LIBS(sem_open, [pthread rt])
> > 
> > I like it.  thanks.
> 
> Won't that cause lxc to link against pthread on most distros which
> based on the previous e-mails is something we want to avoid?

If libpthread is where the symbols are, I don't think we have much
choice? I think Daniel's concern is that by linking with pthread it may
cause users to think liblxc.so is thread safe, when it is not. A
question that pops to mind is "how far from thread safe is liblxc?"
FWIW the sem_open man page on Fedora 18 only says "Link with -pthread".

> I guess we'd want [rt pthread], though as was discussed earlier, it's
> very likely that this will fail as for some reason the tools don't see
> that librt contains the sem_* symbols.
> 
> >> +
> >>  # Check for some functions
> >>  AC_CHECK_LIB(util, openpty)
> >>  AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])
> >>
> >>
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> Everyone hates slow websites. So do we.
> >> Make your web apps faster with AppDynamics
> >> Download AppDynamics Lite for free today:
> >> http://p.sf.net/sfu/appdyn_d2d_feb
> >> _______________________________________________
> >> Lxc-devel mailing list
> >> Lxc-devel at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/lxc-devel
> > 
> > ------------------------------------------------------------------------------
> > Everyone hates slow websites. So do we.
> > Make your web apps faster with AppDynamics
> > Download AppDynamics Lite for free today:
> > http://p.sf.net/sfu/appdyn_d2d_feb
> > _______________________________________________
> > Lxc-devel mailing list
> > Lxc-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/lxc-devel
> > 
> 
> 





More information about the lxc-devel mailing list