[libvirt] Hard requirement on gcrypt.h?

Eric Blake eblake at redhat.com
Tue Feb 26 23:42:43 UTC 2013


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?

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"


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130226/1cb290c9/attachment-0001.sig>


More information about the libvir-list mailing list