[lxc-devel] [PATCH] add -lrt back for liblxc.so link

Dwight Engen dwight.engen at oracle.com
Fri Feb 22 15:54:41 UTC 2013


On Thu, 21 Feb 2013 17:53:51 -0500
Stéphane Graber <stgraber at ubuntu.com> wrote:

> On 02/21/2013 05:26 PM, Dwight Engen wrote:
> > On Thu, 21 Feb 2013 16:58:36 -0500
> > Stéphane Graber <stgraber at ubuntu.com> wrote:
> > 
> >> On 02/21/2013 04:37 PM, Dwight Engen wrote:
> >>> got link error liblxc.so: undefined reference to `clock_gettime'
> >>> clock_gettime is used by lxclock.c and is indeed in librt.
> >>>
> >>> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
> >>> ---
> >>>  src/lxc/Makefile.am | 4 ++++
> >>>  1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
> >>> index aba2e67..5497fab 100644
> >>> --- a/src/lxc/Makefile.am
> >>> +++ b/src/lxc/Makefile.am
> >>> @@ -168,6 +168,10 @@ AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
> >>>  endif
> >>>  LDADD=liblxc.so @CAP_LIBS@ @APPARMOR_LIBS@ @SECCOMP_LIBS@
> >>>  
> >>> +if !IS_BIONIC
> >>> +LDADD += -lrt
> >>> +endif
> >>> +
> >>>  lxc_attach_SOURCES = lxc_attach.c
> >>>  lxc_cgroup_SOURCES = lxc_cgroup.c
> >>>  lxc_checkpoint_SOURCES = lxc_checkpoint.c
> >>>
> >>
> >> Can we do that with a statement in configure.ac similar to that for
> >> sem_open instead of using !IS_BIONIC?
> > 
> > Yeah, I looked at that, but I wasn't sure what other library to put
> > in the search with rt? On bionic does clock_gettime come from
> > libc? ... and would we just put AC_SEARCH_LIBS(sem_open, [rt c]) ?
> > I don't have bionic to try it out :)
> 
> clock_gettime is part of libc on bionic, so adding something like:
> AC_SEARCH_LIBS(clock_gettime, [rt])
> 
> Should do it. I confirmed that lxc still builds on android with that.

Yep, that works here also. New patch follows.




More information about the lxc-devel mailing list