Page MenuHome GnuPG

EOPNOTSUPP is not defined in's MinGW, fails compilation of libgpg-error-1.44
Testing, NormalPublic


The system headers of's MinGW don't define EOPNOTSUPP, which is used in libgpg-error-1.44.
This fails the compilation.
Attached please find patches to 2 files to fix that.

Related Objects

Event Timeline

gniibe triaged this task as Normal priority.
gniibe added a project: gpgrt.
gniibe added a subscriber: gniibe.

Please specify your MinGW version.

Generated code-to-errno.h should include <winsock2.h> and when it defines WSAEOPNOTSUPP, it should work.

So, I wonder what's going on.

This is with's MinGW, version 5.4.x.

As for the problem: I don't know enough about the architecture of the library to pinpoint the cause, but I hope seeing the actual compilation error messages I saw before the change would help you see the root cause:

     libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"d:/usr/share/locale\" -Id:/usr/include -O2 -gdwarf-4 -g3 -Wall -Wpointer-arith -Wno-psabi -MT libgpg_error_la-w32-estream.lo -MD -MP -MF .deps/libgpg_error_la-w32-estream.Tpo -c
     w32-estream.c  -DDLL_EXPORT -DPIC -o .libs/libgpg_error_la-w32-estream.o
     w32-estream.c: In function 'func_w32_pollable_seek':
     w32-estream.c:1015:23: error: 'EOPNOTSUPP' undeclared (first use in this function); did you mean 'WSAEOPNOTSUPP'?
      1015 |   _gpg_err_set_errno (EOPNOTSUPP);
	   |                       ^~~~~~~~~~
	   |                       WSAEOPNOTSUPP
     w32-estream.c:1015:23: note: each undeclared identifier is reported only once for each function it appears in
     w32-estream.c: In function 'func_w32_pollable_ioctl':
     w32-estream.c:1041:23: error: 'EOPNOTSUPP' undeclared (first use in this function); did you mean 'WSAEOPNOTSUPP'?
      1041 |   _gpg_err_set_errno (EOPNOTSUPP);
	   |                       ^~~~~~~~~~
	   |                       WSAEOPNOTSUPP
     Makefile:998: recipe for target `libgpg_error_la-w32-estream.lo' failed

Let me know if I can provide more details about this.

gniibe added a project: Restricted Project.Mar 25 2022, 3:43 AM

Thank you for the error output.

I applied the second part of your patch. That's enough and correct.

The first part of your patch is irrelevant, because it changes the other case;
The code in code-to-errno.c does: gpg-error's error code -> errno -> error string. If applied, the error message for GPG_ERR_EOPNOTSUPP were changed to the one of ENOSYS, that's not good.

werner changed the task status from Open to Testing.Thu, Sep 22, 10:58 AM
werner removed a project: Restricted Project.