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

Natanael Copa ncopa at alpinelinux.org
Tue Feb 19 09:05:58 UTC 2013


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])
+
 # Check for some functions
 AC_CHECK_LIB(util, openpty)
 AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent])







More information about the lxc-devel mailing list