bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libvirt 0.9.9 doesn't build on OpenBSD 5.0-current (i386)


From: Bruno Haible
Subject: Re: libvirt 0.9.9 doesn't build on OpenBSD 5.0-current (i386)
Date: Sat, 04 Feb 2012 14:50:39 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Jiri B wrote:
> any news?
> 
> I sent requested file
> 
> http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00258.html

Thanks for the reminder. The allocator.i file reveals that the fd_set
type is being used in /usr/include/unistd.h:255 but it is only defined
later, in /usr/include/sys/select.h.

In the meantime, I got access to an OpenBSD 5.0 machine. I could reproduce
the problem with a gnulib testdir for the modules

  unistd stdlib pthread signal sys_select allocator mkstemp pthread_sigmask

Analyzing the chain of includes

In file included from ./unistd.h:44,
                 from ./stdlib.h:90,
                 from ./pthread.h:38,
                 from ./signal.h:65,
                 from ./sys/select.h:58,
                 from /usr/include/sys/types.h:224,
                 from ./sys/types.h:28,
                 from /usr/include/stdlib.h:41,
                 from ./stdlib.h:35,
                 from allocator.c:4:
/usr/include/unistd.h:255: error: expected declaration specifiers or '...' 
before 'fd_set'

The include from stdlib.h to unistd.h can hardly be avoided:

#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined 
GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined 
__WIN32__) && ! defined __CYGWIN__)
/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
/* On MacOS X 10.5, only <unistd.h> declares mkstemps.  */
/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
/* But avoid namespace pollution on glibc systems and native Windows.  */
# include <unistd.h>
#endif

Also the include from pthread.h to stdlib.h can hardly be avoided
(or at least, I'm not included to touch pthread.h right now).

Also the include from signal.h to pthread.h can hardly be avoided:

/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
   pthread_sigmask in <pthread.h>, not in <signal.h>.
   But avoid namespace pollution on glibc systems.*/
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
    && ((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || 
defined __OpenBSD__ || defined __osf__ || defined __sun) \
    && ! defined __GLIBC__
# include <pthread.h>
#endif

But the include from sys/select.h to signal.h seems like overkill,
especially if invoked from sys/types.h. I'm applying this fix.


2012-02-04  Bruno Haible  <address@hidden>

        sys_select: Avoid syntax error on OpenBSD 5.0.
        * lib/sys_select.in.h: Include <signal.h> only after the include_next
        <sys/select.h>, not before.
        Reported by Jiri B <address@hidden>.

--- lib/sys_select.in.h.orig    Sat Feb  4 14:38:47 2012
+++ lib/sys_select.in.h Sat Feb  4 14:38:38 2012
@@ -51,12 +51,6 @@
    in <signal.h> where it belongs.  */
 #include <sys/types.h>
 
-/* Get definition of 'sigset_t'.
-   But avoid namespace pollution on glibc systems.  */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <signal.h>
-#endif
-
 #if @HAVE_SYS_SELECT_H@
 
 /* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
@@ -81,6 +75,14 @@
 
 #endif
 
+/* Get definition of 'sigset_t'.
+   But avoid namespace pollution on glibc systems.
+   Do this after the include_next (for the sake of OpenBSD 5.0) but before
+   the split double-inclusion guard (for the sake of Solaris).  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <signal.h>
+#endif
+
 #ifndef address@hidden@_SYS_SELECT_H
 #define address@hidden@_SYS_SELECT_H
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]