Re: Building today's snapshot of GDB with MinGW

Tom de Vries
2020-07-27T10:05:56Z

On 7/27/20 11:49 AM, Tom de Vries wrote:
> On 7/3/20 5:25 PM, Joel Brobecker wrote:
>>> I can submit a change, but it would be difficult for me to try it, and
>>> regenerate configure in general (I don't have the right version of
>>> Autotools installed). Would it be okay to send a change and ask
>>> someone to do the rest?
>>
>> No problem; if you send me the configure.xxx change, I can re-run
>> autoconf et al, and send you a diff with the regenerated files.
>> We can do that as a private exchange to avoid bothering everyone
>> else for that part.
>>
>
> Hi,
>
> [ I suppose this is the last message related to commit 05a6b8c28b "Don't
> unnecessarily redefine 'socklen_t' type in MinGW builds.". ]
>
> I ran into a build breaker related to this commit:
> ...
> src/gdb/ser-tcp.c:65:13: error: conflicting declaration ‘typedef int
> socklen_t’
> 65 | typedef int socklen_t;
> | ^~~~~~~~~
> In file included from ../gnulib/import/unistd.h:40,
> from
> /home/vries/gdb_versions/devel/src/gdb/../gnulib/import/pathmax.h:42,
> from
> /home/vries/gdb_versions/devel/src/gdb/../gdbsupport/common-defs.h:120,
> from /home/vries/gdb_versions/devel/src/gdb/defs.h:28,
> from /home/vries/gdb_versions/devel/src/gdb/ser-tcp.c:20:
> /usr/include/unistd.h:277:21: note: previous declaration as ‘typedef
> __socklen_t socklen_t’
> 277 | typedef __socklen_t socklen_t;
> | ^~~~~~~~~
> ...
>

Hmm, this looks fishy:
...
/* Define to 1 if you have the <sys/sockets.h> header file. */

#undef HAVE_SYS_SOCKETS_H

/* Define to 1 if you have the <sys/socket.h> header file. */

#undef HAVE_SYS_SOCKET_H
...

Anyway, in configure.ac, the check for HAVE_SYS_SOCKET_H comes before
the check for HAVE_SOCKLEN_T, but in configure, that order is reversed,
which is the root cause for the breakage.

It looks like AC_CHECK_HEADERS accumulated checks for different header
files, and that that caused the order reversal.

Thanks,
- Tom