gpg-agent fails to build on Cygwin.
Closed, ResolvedPublic

Assigned To
Authored By
collinfunk
May 27 2025, 6:41 AM

Description

On Cygwin from gpg master running ./configure --sysconfdir=/etc --enable-maintainer-mode && make the build fails with the following:

Making all in agent
make[2]: Entering directory '/home/collin/gnupg/agent'
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DGNUPG_BINDIR="\"/usr/local/bin\"" -DGNUPG_LIBEXECDIR="\"/usr/local/libexec\"" -DGNUPG_LIBDIR="\"/usr/local/lib/gnupg\"" -DGNUPG_DATADIR="\"/usr/local/share/gnupg\"" -DGNUPG_SYSCONFDIR="\"/etc/gnupg\"" -DGNUPG_LOCALSTATEDIR="\"/usr/local/var\""              -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wformat -Wno-format-y2k -Wformat-security -W -Wno-sign-compare -Wno-format-zero-length -Wno-missing-field-initializers -Wdeclaration-after-statement -Wlogical-op -Wvla -Wno-pointer-sign -Wpointer-arith -g -O2 -MT gpg_agent-command-ssh.o -MD -MP -MF .deps/gpg_agent-command-ssh.Tpo -c -o gpg_agent-command-ssh.o `test -f 'command-ssh.c' || echo './'`command-ssh.c
In file included from command-ssh.c:55:
agent.h: In function ‘agent_tpm2d_ecc_kem’:
agent.h:694:56: warning: unused parameter ‘shadow_info’ [-Wunused-parameter]
  694 | agent_tpm2d_ecc_kem (ctrl_t ctrl, const unsigned char *shadow_info,
      |                                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
command-ssh.c: In function ‘start_command_handler_ssh’:
command-ssh.c:3962:19: error: ‘SOCKET’ undeclared (first use in this function)
 3962 |   syshd.u.sock = (SOCKET)sock_client;
      |                   ^~~~~~
command-ssh.c:3962:19: note: each undeclared identifier is reported only once for each function it appears in
command-ssh.c:3962:26: error: expected ‘;’ before ‘sock_client’
 3962 |   syshd.u.sock = (SOCKET)sock_client;
      |                          ^~~~~~~~~~~
      |                          ;
make[2]: *** [Makefile:843: gpg_agent-command-ssh.o] Error 1
make[2]: Leaving directory '/home/collin/gnupg/agent'
make[1]: *** [Makefile:634: all-recursive] Error 1

This is because on Cygwin, HAVE_SOCKET gets defined in winsock2.h. But when building for Cygwin it is correct to use the POSIX-like APIs that it defines.

Therefore, this code should be hidden behind HAVE_SOCKET && HAVE_W32_SYSTEM.

Revisions and Commits

Event Timeline

You know that Cygwin is not supported but if that is the only place it should not arm to fix it.

• werner claimed this task.

Please re-open if you find other Cygwin related build problems.

Thanks, that was the only issue building there.