When compiling under the original MSYS/MinGW environment (downloaded from www.mingw.org, i.e. NOT MinGW-w64/MSYS2, as I need Windows XP support), a compilation error is thrown from the "gdb/ser-mingw.c" file: ../../gdb-7.12.1/gdb/ser-mingw.c: In function 'int ser_windows_read_prim(serial*, size_t)': ../../gdb-7.12.1/gdb/ser-mingw.c:346:30: error: 'ERROR_IO_PENDING' was not declared in this scope if (GetLastError () != ERROR_IO_PENDING ^~~~~~~~~~~~~~~~ ../../gdb-7.12.1/gdb/ser-mingw.c: In function 'int ser_windows_write_prim(serial*, const void*, size_t)': ../../gdb-7.12.1/gdb/ser-mingw.c:368:30: error: 'ERROR_IO_PENDING' was not declared in this scope if (GetLastError () != ERROR_IO_PENDING ^~~~~~~~~~~~~~~~ make[3]: *** [ser-mingw.o] Error 1 Note: The host is "mingw32" and the target is "sh-elf". PROPOSED CORRECTION: I solved this bug by adding the following code snippet directly in the "gdb/ser-mingw.c" file: #ifndef ERROR_IO_PENDING // In MinGW (original project, for MinGW-w64 I don't know), this code is defined in that header file. #include <winerror.h> #endif After that modification, the compilation of gdb-7.12.1 with host "mingw32" and targetting "sh-elf" is successful.
Created attachment 11208 [details] Fix to allow MinGW/MSYS compilation of gdb-7.12.1
Comment on attachment 11208 [details] Fix to allow MinGW/MSYS compilation of gdb-7.12.1 --- ser-mingw.c 2017-01-21 13:46:47 +0000 +++ ser-mingw.c.patch 2018-08-24 08:30:27 +0000 @@ -31,6 +31,10 @@ #include "command.h" +#ifndef ERROR_IO_PENDING +#include <winerror.h> +#endif + void _initialize_ser_windows (void); struct ser_windows_state
Created attachment 11209 [details] Patch to allow MinGW/MSYS compilation of gdb-7.12.1
Thanks for the patch. The gdb project doesn't review patches in bugzilla; instead they must be sent to the gdb-patches list. See the contribution checklist for details: https://sourceware.org/gdb/wiki/ContributionChecklist
Thanks for your feedback. I confirm that gdb-7.12.1 is compiling fine under MSYS/MinGW with this little patch applied. I'll submit the patch to the list as requested.
I just submitted the patch now. I hope I respected all the guidelines of the list.
What's the status of this?
Sorry, long time no see. The bug will not be fixed as 7.12.1 is an old release. But the thing is, this bug is still here in 8.2.
(In reply to SiZiOUS from comment #3) > Comment on attachment 11208 [details] > Fix to allow MinGW/MSYS compilation of gdb-7.12.1 > > --- ser-mingw.c 2017-01-21 13:46:47 +0000 > +++ ser-mingw.c.patch 2018-08-24 08:30:27 +0000 > @@ -31,6 +31,10 @@ > > #include "command.h" > > +#ifndef ERROR_IO_PENDING > +#include <winerror.h> > +#endif > + > void _initialize_ser_windows (void); > > struct ser_windows_state That shouldn't be necessary, winerror.h should be included by windows.h (indirectly, via winbase.h).
*** Bug 23583 has been marked as a duplicate of this bug. ***
Did anybody ever get to the bottom of this? One approach would be to attach the preprocessed source here. The question is why this isn't defined by the windows.h includes.
Waiting for response.