Page MenuHome GnuPG

dirmngr/dns.c files to compile due to type-mismatch caused by missing _XOPEN_SOURCE on Solaris and derivatives
Open, Needs TriagePublic

Description

Making all in dirmngr
make[2]: Entering directory '/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1_build/dirmngr'
x86_64-pc-solaris2.11-gcc -DHAVE_CONFIG_H -I. -I/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr -I..  -DLOCALEDIR=\"/gentoo/prefix64/usr/share/locale\" -DGNUPG_BINDIR="\"/gentoo/prefix64/usr/bin\"" -DGNUPG_LIBEXECDIR="\"/gentoo/prefix64/usr/libexec\"" -DGNUPG_LIBDIR="\"/gentoo/prefix64/usr/lib/gnupg\"" -DGNUPG_DATADIR="\"/gentoo/prefix64/usr/share/gnupg\"" -DGNUPG_SYSCONFDIR="\"/gentoo/prefix64/etc/gnupg\"" -DGNUPG_LOCALSTATEDIR="\"/gentoo/prefix64/var/lib\""         -std=gnu99 -I/gentoo/prefix64/usr/include -I/gentoo/prefix64/usr/include -I/gentoo/prefix64/usr/include -I/gentoo/prefix64/usr/include -I/gentoo/prefix64/usr/include   -Wall -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -O2 -pipe -c -o dns.o /gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c: In function ‘dns_te_initnames’:
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c:4589:36: error: passing argument 3 of ‘dns_te_initname’ from incompatible pointer type [-Wincompatible-pointer-types]
 4589 |         dns_te_initname(local, fd, &getsockname);
      |                                    ^~~~~~~~~~~~
      |                                    |
      |                                    int (*)(int,  struct sockaddr * restrict,  void *)
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c:4573:81: note: expected ‘int (*)(socket_fd_t,  struct sockaddr *, socklen_t *)’ {aka ‘int (*)(int,  struct sockaddr *, unsigned int *)’} but argument is of type ‘int (*)(int,  struct sockaddr * restrict,  void *)’
 4573 | static void dns_te_initname(struct sockaddr_storage *ss, int fd, int (* STDCALL f)(socket_fd_t, struct sockaddr *, socklen_t *)) {
      |                                                                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c:4590:37: error: passing argument 3 of ‘dns_te_initname’ from incompatible pointer type [-Wincompatible-pointer-types]
 4590 |         dns_te_initname(remote, fd, &getpeername);
      |                                     ^~~~~~~~~~~~
      |                                     |
      |                                     int (*)(int,  struct sockaddr * restrict,  void *)
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c:4573:81: note: expected ‘int (*)(socket_fd_t,  struct sockaddr *, socklen_t *)’ {aka ‘int (*)(int,  struct sockaddr *, unsigned int *)’} but argument is of type ‘int (*)(int,  struct sockaddr * restrict,  void *)’
 4573 | static void dns_te_initname(struct sockaddr_storage *ss, int fd, int (* STDCALL f)(socket_fd_t, struct sockaddr *, socklen_t *)) {
      |                                                                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c: In function ‘dns_trace_sys_connect’:
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c:4834:50: error: passing argument 3 of ‘dns_te_initname’ from incompatible pointer type [-Wincompatible-pointer-types]
 4834 |         dns_te_initname(&te.sys_connect.src, fd, &getsockname);
      |                                                  ^~~~~~~~~~~~
      |                                                  |
      |                                                  int (*)(int,  struct sockaddr * restrict,  void *)
/gentoo/prefix64/var/tmp/portage/app-crypt/gnupg-2.5.1/work/gnupg-2.5.1/dirmngr/dns.c:4573:81: note: expected ‘int (*)(socket_fd_t,  struct sockaddr *, socklen_t *)’ {aka ‘int (*)(int,  struct sockaddr *, unsigned int *)’} but argument is of type ‘int (*)(int,  struct sockaddr * restrict,  void *)’
 4573 | static void dns_te_initname(struct sockaddr_storage *ss, int fd, int (* STDCALL f)(socket_fd_t, struct sockaddr *, socklen_t *)) {
      |                                                                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:1047: dns.o] Error 1

This is GCC-14, compiling gnupg-2.5.1.

The problem as far as I can see is due to (socklen_t) being defined as (void *) instead of (unsigned int *). Reason for this on Solaris and derivatives such as OpenIndiana, is that XPG4_2 is not enabled. This in turn happens because _XOPEN_SOURCE is unset and thus sys/feature_tests.h does not enable XPG4_2.

Defining _XOPEN_SOURCE=500 makes the build succeed (even though it should probably be 600 -- https://gist.github.com/jperkin/b08f9108daf8d0ac695067d71f882a9d) so perhaps the configure check for _XOPEN_SOURCE needs additions for this scenario?

The problem is present since at least 2.4.5.

% cat /etc/release 
             OpenIndiana Hipster 2024.04 (powered by illumos)
        OpenIndiana Project, part of The Illumos Foundation (C) 2010-2024
                        Use is subject to license terms.
                           Assembled 26 April 2024
% gcc --version
gcc (Gentoo 14.2.0 p4) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Details

Version
2.5.1

Event Timeline

grobian renamed this task from dirmngr/dns.c files to compile due to type-mismatch caused by -std=c99 on Solaris and derivatives to dirmngr/dns.c files to compile due to type-mismatch caused by missing _XOPEN_SOURCE on Solaris and derivatives.Nov 3 2024, 11:44 AM