[libvirt] Hard requirement on gcrypt.h?

Daniel P. Berrange berrange at redhat.com
Wed Feb 27 10:19:19 UTC 2013


On Tue, Feb 26, 2013 at 04:42:43PM -0700, Eric Blake wrote:
> On 02/25/2013 06:14 PM, Eugene Marcotte wrote:
> > On Mon, 2013-02-25 at 17:42 -0700, Eric Blake wrote:
> >> On 02/25/2013 05:38 PM, Eugene Marcotte wrote:
> >>> Hi,
> >>>
> >>> I'm building libvirt for the first time and figuring out what libraries
> >>> are required to get the simplest possible thing working.
> >>>
> >>> Is there a hard requirement on gcrypt? I got libvirt past the configure
> >>> script but the build failed on gcrypt.h. It looks like the include for
> >>> it could be moved inside the #if WITH_GNUTLS section of libirt.c, if I
> >>> understand what configure.ac is trying to set up.
> 
> Ah, I see now - the file in question is src/libvirt.c - the typo of
> libirt.c threw me off.
> 
> >>
> >> Can you show the exact compiler error message you received?  You are
> >> correct that this header is non-standard, and should be properly ifdef'd
> >> before we try to use it.
> >>
> > 
> > make[3]: Entering directory `/home/emarcotte/src/libvirt/src'
> >   CC       libvirt_driver_la-libvirt.lo
> > libvirt.c:34:20: fatal error: gcrypt.h: No such file or directory
> > compilation terminated.
> 
> Other than the broken #include, it looks like the rest of the file
> protects all use of *gcr* and *GCR* under the WITH_GNUTLS conditional;
> and no other file seemed to be impacted.
> 
> > 
> > Of course, installing gcrypt-devel fixes it, but I would have expected
> > configure to fail. I can try to add an explicit check for gcrypt.h if
> > it's required. 
> 
> I think we are guaranteed that gcrypt.h exists if gnutls is properly
> installed, even if it is a transitive dependency.  Does this patch fix
> it for you?

We used to be, but as of gnutls-3.0 they switched to use libnettle
instead of libgcrypt. This will affect libvirt in Fedora rawhide,
so we need to do some work either split the checks, or if we want
to only keep a gnutls check, we need to conditionally use nettle
instead of gcrypt. I'm tending towards the latter, since it is nice
not to link to multiple crypto libraries which do the same thing.

> 
> diff --git i/src/libvirt.c w/src/libvirt.c
> index 8a28e4a..0a21dea 100644
> --- i/src/libvirt.c
> +++ w/src/libvirt.c
> @@ -2,7 +2,7 @@
>   * libvirt.c: Main interfaces for the libvirt library to handle
> virtualization
>   *           domains from a process running in domain 0
>   *
> - * Copyright (C) 2005-2006, 2008-2012 Red Hat, Inc.
> + * Copyright (C) 2005-2006, 2008-2013 Red Hat, Inc.
>   *
>   * This library is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU Lesser General Public
> @@ -31,7 +31,6 @@
>  #include <unistd.h>
>  #include <sys/wait.h>
>  #include <time.h>
> -#include <gcrypt.h>
> 
>  #include <libxml/parser.h>
>  #include <libxml/xpath.h>
> @@ -56,6 +55,7 @@
>  #include "intprops.h"
>  #include "virconf.h"
>  #if WITH_GNUTLS
> +# include <gcrypt.h>
>  # include "rpc/virnettlscontext.h"
>  #endif
>  #include "vircommand.h"

ACK to this anyway since it doesn't make things worse

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list