Bug#402318: libc6-dev: /usr/include/semaphore.h can't be used without pthread.h
Package: libc6-dev
Version: 2.3.6.ds1-9
Severity: wishlist
Hi,
There is an issue with the /usr/include/semaphore.h file and what
the manpages are saying for sem_open(3) and POSIX specifications
for the semaphore.h file.
In a nutshell, with the libc6-dev package, one can't do
the (basic) following :
#include <semaphore.h>
Without having included pthread.h before. That breaks a few
.c files that would have compiled without any error on other POSIX
systems with the following message :
In file included from test.c:10:
/usr/include/semaphore.h:34: error: field '__sem_lock' has incomplete
type
(where line 10 of test.c is "#include <semaphore.h>").
Maybe should we inlcude pthread.h in /usr/include/semaphore.h ?
Another solution would be to fix the manpages (ie: sem_open(3))
who are just requiring semaphore.h by adding an #include <pthread.>
line.
For the record, users who find this bug while trying
to compile POSIX-semaphore enabled source code can fix
it by adding "#include <pthread.h>" before "#include <semaphore.h>"
Thanks,
Florian Le Goff <florian.le-goff@poxx.net>
-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-3-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages libc6-dev depends on:
ii libc6 2.3.6.ds1-9 GNU C Library: Shared libraries
ii linux-kernel-headers 2.6.18-6 Linux Kernel Headers for developme
Versions of packages libc6-dev recommends:
ii gcc [c-compiler] 4:4.1.1-13 The GNU C compiler
ii gcc-3.3 [c-compiler] 1:3.3.6-13 The GNU C compiler
ii gcc-4.0 [c-compiler] 4.0.3-7 The GNU C compiler
ii gcc-4.1 [c-compiler] 4.1.1-20 The GNU C compiler
-- no debconf information
Reply to: