[libvirt] [PATCH] Include some extra headers needed for OpenBSD.

Jasper Lievisse Adriaanse jasper at humppa.nl
Tue Sep 4 16:52:02 UTC 2012


On Tue, Sep 04, 2012 at 10:45:41AM -0600, Eric Blake wrote:
> On 09/04/2012 10:23 AM, Jasper Lievisse Adriaanse wrote:
> > On Tue, Sep 04, 2012 at 09:18:20AM -0600, Eric Blake wrote:
> >> On 09/04/2012 08:57 AM, Jasper Lievisse Adriaanse wrote:
> >>> >From bafcb4ed2b90b5ba845ca6b61861e3caa548b16a Mon Sep 17 00:00:00 2001
> >>> From: Jasper Lievisse Adriaanse <jasper at humppa.nl>
> >>> Date: Tue, 4 Sep 2012 16:57:09 +0200
> >>> Subject: [PATCH] Include some extra headers needed for OpenBSD.
> >>>
> >>> ---
> >>>  src/util/virnetdevbridge.c |    9 +++++++++
> >>>  1 files changed, 9 insertions(+), 0 deletions(-)
> >>
> >> Please show the compiler errors that you got without these includes.  I
> >> can't help but wonder if you have instead uncovered a bug in the gnulib
> >> headers, but knowing which symbols were not declared makes a difference
> >> in answering that question.
> 
> I'd still like to know the compiler error you got when <sys/socket.h>
> was not present, but just guessing from the source code, I see one call
> of socket() (protected behind #if defined(HAVE_NET_IF_H) &&
> defined(SIOCBRADDBR), but maybe those are both true for OpenBSD?).  Even
> though I'm pushing, I would STILL like to know why.
Of course, here it is:

In file included from util/virnetdevbridge.c:35:
/usr/include/net/if.h:276: warning: 'struct sockaddr' declared inside
parameter list
/usr/include/net/if.h:276: warning: its scope is only this definition or
declaration, which is probably not what you want
/usr/include/net/if.h:280: warning: 'struct sockaddr' declared inside
parameter list
/usr/include/net/if.h:293: error: 'AF_MAX' undeclared here (not in a function)
/usr/include/net/if.h:606: error: field 'ifru_addr' has incomplete type
/usr/include/net/if.h:607: error: field 'ifru_dstaddr' has incomplete type
/usr/include/net/if.h:608: error: field 'ifru_broadaddr' has incomplete type
/usr/include/net/if.h:626: error: field 'ifra_addr' has incomplete type
/usr/include/net/if.h:627: error: field 'ifra_dstaddr' has incomplete type
/usr/include/net/if.h:629: error: field 'ifra_mask' has incomplete type
/usr/include/net/if.h:673: error: field 'addr' has incomplete type
/usr/include/net/if.h:674: error: field 'dstaddr' has incomplete type
In file included from /usr/include/net/if.h:692,
                 from util/virnetdevbridge.c:35:
/usr/include/net/if_arp.h:79: error: field 'arp_pa' has incomplete type
/usr/include/net/if_arp.h:80: error: field 'arp_ha' has incomplete type
Error while executing cc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib
-I../gnulib/lib -I../include -I../include -I../src/util -DIN_LIBVIRT
-I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -Wall
-W -Wformat-y2k -Wformat-security -Winit-self -Wmissing-include-dirs -Wunused
-Wunknown-pragmas -Wstrict-aliasing -Wshadow -Wpointer-arith
-Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes
-Wold-style-definition -Wmissing-noreturn -Wmissing-format-attribute
-Wredundant-decls -Wnested-externs -Winline -Winvalid-pch
-Wvolatile-register-var -Wdisabled-optimization -Wattributes
-Wdeprecated-declarations -Wdiv-by-zero -Wendif-labels -Wextra
-Wformat-extra-args -Wformat-zero-length -Wformat=2 -Wmultichar
-Wnormalized=nfc -Woverflow -Wpointer-to-int-cast -Wpragmas -Wtrampolines
-Wno-missing-field-initializers -Wno-sign-compare -Wno-format-nonliteral
-fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option
-funit-at-a-time -fipa-pure-const -I/usr/local/include/dbus-1.0
-I/usr/local/lib/dbus-1.0/include -O2 -pipe -MT
libvirt_util_la-virnetdevbridge.lo -MD -MP -MF
.deps/libvirt_util_la-virnetdevbridge.Tpo -c util/virnetdevbridge.c -fPIC
-DPIC -o .libs/libvirt_util_la-virnetdevbridge.o
gmake[3]: *** [libvirt_util_la-virnetdevbridge.lo] Error 1
gmake[3]: Leaving directory `/usr/obj/ports/libvirt-0.10.1/libvirt-0.10.1/src'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/usr/obj/ports/libvirt-0.10.1/libvirt-0.10.1/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/obj/ports/libvirt-0.10.1/libvirt-0.10.1'
gmake: *** [all] Error 2

> >> This line shouldn't be necessary; gnulib guarantees a working
> >> <sys/socket.h> on all architectures.
> > OK. Could you please push this one then?
> 
> Here's what I squashed in before pushing; I also added you to AUTHORS.
> Let me know if you prefer an alternate spelling or email address (the
> file is in UTF-8, if that matters).
Thanks, my name and e-mail as I sent them are ok.

> diff --git i/src/util/virnetdevbridge.c w/src/util/virnetdevbridge.c
> index 8559223..a29e4b2 100644
> --- i/src/util/virnetdevbridge.c
> +++ w/src/util/virnetdevbridge.c
> @@ -30,14 +30,7 @@
>  #include "intprops.h"
> 
>  #include <sys/ioctl.h>
> -
> -#ifdef HAVE_SYS_PARAM_H
> -# include <sys/param.h>
> -#endif
> -
> -#ifdef HAVE_SYS_SOCKET_H
> -# include <sys/socket.h>
> -#endif
> +#include <sys/socket.h>
> 
>  #ifdef HAVE_NET_IF_H
>  # include <net/if.h>
> 
> -- 
> Eric Blake   eblake at redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 



-- 
Cheers,
Jasper

"Stay Hungry. Stay Foolish"




More information about the libvir-list mailing list