[libvirt] cygwin: #include netinet/inet.h -- needed only on cygwin

When doing './autogen.sh --with-sasl --with-libvirtd=no' on cygwin, I needed to #include netinet/in.h for a successful build. Now authentication using SASL works. Signed-off-by: Stefan Berger <stefanb@us.ibm.com> diff --git a/src/remote/qemu_protocol.h b/src/remote/qemu_protocol.h index b822187..8d806fc 100644 --- a/src/remote/qemu_protocol.h +++ b/src/remote/qemu_protocol.h @@ -6,6 +6,9 @@ #ifndef _RP_QEMU_H_RPCGEN #define _RP_QEMU_H_RPCGEN +#ifdef __CYGWIN__ +# include <netinet/in.h> +#endif #include <rpc/rpc.h> diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h index afe9287..113818d 100644 --- a/src/remote/remote_protocol.h +++ b/src/remote/remote_protocol.h @@ -6,6 +6,9 @@ #ifndef _RP_H_RPCGEN #define _RP_H_RPCGEN +#ifdef __CYGWIN__ +# include <netinet/in.h> +#endif #include <rpc/rpc.h>

On Tue, Aug 17, 2010 at 12:14:47PM -0400, Stefan Berger wrote:
When doing './autogen.sh --with-sasl --with-libvirtd=no' on cygwin, I needed to #include netinet/in.h for a successful build. Now authentication using SASL works.
Hmm, this is the sort of thing that GNULIB usually fixes for us. What is the compile error without this patch present ? Ideally we can get GNULIB to fix it Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 08/17/2010 12:25 PM, Daniel P. Berrange wrote:
On Tue, Aug 17, 2010 at 12:14:47PM -0400, Stefan Berger wrote:
When doing './autogen.sh --with-sasl --with-libvirtd=no' on cygwin, I needed to #include netinet/in.h for a successful build. Now authentication using SASL works. Hmm, this is the sort of thing that GNULIB usually fixes for us. What is the compile error without this patch present ? Ideally we can get GNULIB to fix it
It complains about an incomplete datatype due to sockaddr_in being used in rpc/svc.h (xp_raddr in SVCXPRT struct). Stefan
Daniel

On 08/17/2010 10:48 AM, Stefan Berger wrote:
On 08/17/2010 12:25 PM, Daniel P. Berrange wrote:
On Tue, Aug 17, 2010 at 12:14:47PM -0400, Stefan Berger wrote:
When doing './autogen.sh --with-sasl --with-libvirtd=no' on cygwin, I needed to #include netinet/in.h for a successful build. Now authentication using SASL works. Hmm, this is the sort of thing that GNULIB usually fixes for us. What is the compile error without this patch present ? Ideally we can get GNULIB to fix it
Well, gnulib does not yet offer any replacements for the <rpc/....h> headers, in part because they are not standardized by POSIX. That's certainly a larger task than just working around it for now in libvirt. The real question here is whether cygwin's <rpc/rpc.h> is broken because it is not self-sufficient, or whether the compile error is due to something else that libvirt is doing. Which is why the actual compile message is important (so I went and reproduced this setup - it took me more than an hour to get to the failure point)...
It complains about an incomplete datatype due to sockaddr_in being used in rpc/svc.h (xp_raddr in SVCXPRT struct).
I could not reproduce the failure with the latest cygwin: cygwin 1.7.6-1 OK libsasl2-devel 2.1.23-1 OK libxml2-devel 2.7.7-1 OK sunrpc 4.0-3 OK What versions do you have installed? (Not sure if I have any other relevant installed packages that I didn't list here). More particularly, I see that cygwin's <rpc/svc.h> has a blind reference to sockaddr_in inside struct SVCXPRT, but libvirt includes the master file <rpc/rpc.h> which includes <rpc/types.h> prior to <rpc/svc.h>; and <rpc/types.h> includes <netinet/in.h>.
+++ b/src/remote/qemu_protocol.h @@ -6,6 +6,9 @@ #ifndef _RP_QEMU_H_RPCGEN #define _RP_QEMU_H_RPCGEN
+#ifdef __CYGWIN__ +# include <netinet/in.h> +#endif #include <rpc/rpc.h>
If we decide to apply this, then lose the #ifdef __CYGWIN__. There's nothing wrong with making this #include unconditional, particularly since POSIX is clear that sockaddr_in may be defined in several headers (<arpa/inet.h>, <netdb.h>), but only must be defined in <netinit/in.h>, and since gnulib guarantees that <netinet/in.h> will exist. glibc's implementation is a bit looser and provides sockaddr_in in more places, but that's no excuse for us to depend on that laziness. But since I think upgrading the installation on your end will clear up the compilation problem, I'm inclined to NAK this patch. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 08/17/2010 12:12 PM, Eric Blake wrote:
Ideally we can get GNULIB to fix it
Well, gnulib does not yet offer any replacements for the <rpc/....h> headers, in part because they are not standardized by POSIX. That's certainly a larger task than just working around it for now in libvirt.
I could not reproduce the failure with the latest cygwin: cygwin 1.7.6-1 OK
An additional note - cygwin only integrated native rpc support as of 1.7.4; if you are using something older, then you must have been using a bolt-on package. But the general gnulib philosophy with regards to cygwin tends to be that if a bug is cygwin-specific and has been fixed upstream in cygwin, it is easier to tell people to upgrade to the latest cygwin than to write a hack for a one-off version of an open platform (bug fixes for more closed platforms, like mingw or MacOS, where we have less control over how fast or even if a patch is likely to be forth-coming, take priority). -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

libvir-list-bounces@redhat.com wrote on 08/17/2010 02:12:44 PM:
libvir-list
On 08/17/2010 10:48 AM, Stefan Berger wrote:
On 08/17/2010 12:25 PM, Daniel P. Berrange wrote:
On Tue, Aug 17, 2010 at 12:14:47PM -0400, Stefan Berger wrote:
When doing './autogen.sh --with-sasl --with-libvirtd=no' on cygwin, I needed to #include netinet/in.h for a successful build. Now authentication using SASL works. Hmm, this is the sort of thing that GNULIB usually fixes for us. What is the compile error without this patch present ? Ideally we can get GNULIB to fix it
Well, gnulib does not yet offer any replacements for the <rpc/....h> headers, in part because they are not standardized by POSIX. That's certainly a larger task than just working around it for now in libvirt.
The real question here is whether cygwin's <rpc/rpc.h> is broken because it is not self-sufficient, or whether the compile error is due to something else that libvirt is doing. Which is why the actual compile message is important (so I went and reproduced this setup - it took me more than an hour to get to the failure point)...
It complains about an incomplete datatype due to sockaddr_in being used in rpc/svc.h (xp_raddr in SVCXPRT struct).
I could not reproduce the failure with the latest cygwin: cygwin 1.7.6-1 OK libsasl2-devel 2.1.23-1 OK libxml2-devel 2.7.7-1 OK sunrpc 4.0-3 OK
What versions do you have installed? (Not sure if I have any other relevant installed packages that I didn't list here).
I had done updates just yesterday... Now I did a reinstall on the sunrpc 4.0-3 I already had and the rpc/types.h changed and it does now have the include of netinet/in.h as well. This of course makes the patch unnecessary. Stefan

On 08/17/2010 06:43 PM, Stefan Berger wrote:
I could not reproduce the failure with the latest cygwin: cygwin 1.7.6-1 OK libsasl2-devel 2.1.23-1 OK libxml2-devel 2.7.7-1 OK sunrpc 4.0-3 OK
What versions do you have installed? (Not sure if I have any other relevant installed packages that I didn't list here).
I had done updates just yesterday... Now I did a reinstall on the sunrpc 4.0-3 I already had and the rpc/types.h changed and it does now have the include of netinet/in.h as well. This of course makes the patch unnecessary.
Ouch - that's a cygwin packaging bug. Two different packages providing the same headers is a recipe for disaster, since it then depends on which order you install the various packages. I've reported it upstream: http://cygwin.com/ml/cygwin-apps/2010-08/msg00151.html -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Stefan Berger
-
Stefan Berger