[libvirt] BSD gcrypt warnings [was: [PATCH] build: mark conditionally unused variables]

Roman Bogorodskiy bogorodskiy at gmail.com
Sat May 11 14:27:26 UTC 2013


  Eric Blake wrote:

> On 05/02/2013 09:32 PM, Roman Bogorodskiy wrote:
> >>>
> >>> Can you actually compile it successfully without '--disable-werror'?
> >>
> >> Looks like I skipped a few files:
> >>
> >> $ ./config.status --version | head -n3
> >> libvirt config.status 1.0.5
> >> configured by ./configure, generated by GNU Autoconf 2.68,
> >>   with options "'-C' 'CFLAGS=-g' '--without-network'"
> >>
> >> Maybe I should try again and see how omitting --without-network fares.
> >>
> >>>
> >>> It fails for me because of gcrypt.h:
> >>>
> >>> http://people.freebsd.org/~novel/misc/libvirt_gcrypt_warns.txt
> >>
> >>
> >>   CC       libvirt_driver_la-libvirt.lo
> >> cc1: warnings being treated as errors
> >> In file included from libvirt.c:58:
> >> /usr/local/include/gcrypt.h:1336: warning: 'gcry_ac_io_mode_t' is
> >> deprecated [-Wdeprecated-declarations]
> 
> Okay, I updated my Ports repository on my FreeBSD vm, and I'm seeing
> this same sort of failure failure with gcc 4.2.1 and gcrypt 1.5.2 (wow -
> Fedora rawhide still only ships with gcrypt 1.5.1).
> 
> > 
> > I'm using gcrypt 1.5.0.
> > 
> > Relevant part of gcrypt.h:
> > 
> > 1333 typedef struct gcry_ac_io
> > 1334 {
> > 1335   /* This is an INTERNAL structure, do NOT use manually.  */
> > 1336   gcry_ac_io_mode_t mode _GCRY_ATTR_INTERNAL;
> > 1337   gcry_ac_io_type_t type _GCRY_ATTR_INTERNAL;
> > 1338   union
> 
> The sad part is that we aren't even using the deprecated symbols - their
> mere inclusion in the installed header is provoking the problems.  It
> looks like newer gcc is a bit more tolerant (that is, this is a
> shortcoming of FreeBSD's use of an older compiler).
> 
> > ....
> > 
> > gcc version 4.2.1 20070831 patched [FreeBSD]
> > 
> 
> I'm trying to come up with the best workaround (perhaps disabling
> -Wdeprecated-declarations if gcrypt.h exists but provokes compiler
> warnings).

I have tried this fix and it works for me:

diff --git a/configure.ac b/configure.ac
index 53f78de..4a813cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1090,6 +1090,10 @@ if test "x$with_gnutls" != "xno"; then
     dnl it explicitly for the calls to gcry_control/check_version
     GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
 
+    dnl We're not using gcrypt deprecated features so define GCRYPT_NO_DEPRECATED
+    dnl to avoid deprecated warnings
+    GNUTLS_CFLAGS="$GNUTLS_CFLAGS -DGCRYPT_NO_DEPRECATED"
+
     with_gnutls=yes
   fi


Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130511/0c6e4a01/attachment-0001.sig>


More information about the libvir-list mailing list