[pkg-gnupg-maint] Bug#926984: Bug#926984: gnupg2 FTBFS with gcc-9: dirmngr/dns.h:1058:24: error: lvalue required as unary '&' operand

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Apr 15 23:24:14 BST 2019


Control: tags 926984 + moreinfo

Hi Helmut--

On Sat 2019-04-13 09:25:50 +0200, Helmut Grohne wrote:
> gnupg2 fails to build from source with gcc-9, here is the relevant part
> of a cross build log:
>
> | aarch64-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../../dirmngr -I..  -DLOCALEDIR=\"/usr/share/locale\" -DGNUPG_BINDIR="\"/usr/bin\"" -DGNUPG_LIBEXECDIR="\"/usr/lib/gnupg\"" -DGNUPG_LIBDIR="
> | \"/usr/lib/aarch64-linux-gnu/gnupg\"" -DGNUPG_DATADIR="\"/usr/share/gnupg\"" -DGNUPG_SYSCONFDIR="\"/etc/gnupg\"" -DGNUPG_LOCALSTATEDIR="\"/var\""       -Wdate-time -D_FORTIFY_SOURCE=2
> | -std=gnu99       -I/usr/include/p11-kit-1 -Wall -Wno-pointer-sign -Wpointer-arith -g -O2 -fdebug-prefix-map=/tmp/buildd/gnupg2/gnupg2-2.2.13=. -fstack-protector-strong -Wformat -Werror
> | =format-security -c -o dns-stuff.o ../../dirmngr/dns-stuff.c
> | In file included from ../../dirmngr/dns-stuff.c:57:
> | ../../dirmngr/dns-stuff.c: In function 'libdns_res_open':
> | ../../dirmngr/dns.h:1058:24: error: lvalue required as unary '&' operand
> |  1058 | #define dns_opts(...) (&dns_quietinit((struct dns_options)DNS_OPTS_INIT(__VA_ARGS__)))
> |       |                        ^
> | ../../dirmngr/dns-stuff.c:719:23: note: in expansion of macro 'dns_opts'
> |   719 |                       dns_opts (.socks_host     = &libdns.socks_host,
> |       |                       ^~~~~~~~
> | make[4]: Leaving directory '/tmp/buildd/gnupg2/gnupg2-2.2.13/build/dirmngr'
> | make[4]: *** [Makefile:995: dns-stuff.o] Error 1
> | make[3]: Leaving directory '/tmp/buildd/gnupg2/gnupg2-2.2.13/build'
> | make[3]: *** [Makefile:616: all-recursive] Error 1
> | make[2]: Leaving directory '/tmp/buildd/gnupg2/gnupg2-2.2.13/build'
> | make[2]: *** [Makefile:536: all] Error 2
> | dh_auto_build: cd build && make -j1 returned exit code 2
> | make[1]: Leaving directory '/tmp/buildd/gnupg2/gnupg2-2.2.13'
> | make[1]: *** [debian/rules:55: override_dh_auto_build-arch] Error 2
> | make: *** [debian/rules:35: binary-arch] Error 2
> | dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2
>
> This problem also affects OE and Khem Raj has created a fix already:
>
> https://patchwork.openembedded.org/patch/157377/
>
> Can you cherry-pick that patch?

I'd prefer to have specific patches included in the bug report if
possible, i don't know whether those other servers will go down.

As i understand it, the patch is just this one change below:

--------
From 0df5800cc2e720aad883a517f7d24a9722fe5845 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem at gmail.com>
Date: Thu, 20 Dec 2018 17:37:48 -0800
Subject: [PATCH] Woverride-init is not needed with gcc 9

Fixes

    ../../gnupg-2.2.12/dirmngr/dns.h:525:16: error: lvalue required as unary '&' operand
    dns_rr_i_init(&dns_quietinit((struct dns_rr_i){ 0, __VA_ARGS__ }), (P))

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 dirmngr/dns.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dirmngr/dns.h b/dirmngr/dns.h
index 30d0b45..98fe412 100644
--- a/dirmngr/dns.h
+++ b/dirmngr/dns.h
@@ -154,7 +154,7 @@ DNS_PUBLIC int *dns_debug_p(void);
 
 #define dns_quietinit(...) \
 	DNS_PRAGMA_PUSH DNS_PRAGMA_QUIET __VA_ARGS__ DNS_PRAGMA_POP
-#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4
+#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4 && __GNUC__ < 9)
 #define DNS_PRAGMA_PUSH _Pragma("GCC diagnostic push")
 #define DNS_PRAGMA_QUIET _Pragma("GCC diagnostic ignored \"-Woverride-init\"")
 #define DNS_PRAGMA_POP _Pragma("GCC diagnostic pop")
--------

but i don't understand how the change works, or how it affects the build
process that it says is failing.  The change just seems to be saying
"don't bother ignoring the -Woverride-init warning" on gcc 9 or later.

How does that effect the lvalue of a unary & command?

Also, the chnage from Khem Raj (in cc here) says "Upstream-Status:
pending", but i don't see it in the upstream bug tracker or revision
control here: https://dev.gnupg.org/ and i haven't seen any messages
from Khem on the upstream GnuPG mailing lists.

I'd be happy to advocate for this change upstream, and/or to put it in
debian if i understood it, but at the moment, i'm at a loss.  Could we
get more explanation?

    --dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-gnupg-maint/attachments/20190415/72ebff9a/attachment.sig>


More information about the pkg-gnupg-maint mailing list