_WIN32_WINNT redefined?

i.nixman@autistici.org i.nixman@autistici.org
Wed Nov 2 08:14:41 GMT 2022


host: x86_64-w64-mingw32
target: x86_64-w64-mingw32

I'm trying to build GDB using GCC that I built myself.
the GCC was patched and configured the way when std-threads implemented 
by libgcc using WINAPI directly, without winpthreads.
the compiler works, as far as I can test it.

but I have faced with a trouble with building GDB using the compiler.
the trouble looks like this:
In file included from 
                  from ../src/gdb-11.2/gdbsupport/thread-pool.cc:24:
error: '__gthread_cond_t' does not name a type; did you mean 
   163 |     __gthread_cond_t* native_handle() noexcept { return 
&_M_cond; }
       |     ^~~~~~~~~~~~~~~~

the problem is a consequence of the fact that `_WIN32_WINNT` is 
redefined somewhere to another value that is less than necessary.
but when I pass `-D_WIN32_WINNT=0x0601` for CFLAGS/CXXFLAGS - the 
trouble is gone.

the mingw-w64-api was configured with 
`--with-default-win32-winnt=0x0601` and I can confirm the `_WIN32_WINNT` 
is actually set to the correct value.
moreover, using the compiler I can successfully build a simple program 
that uses `std::thread` without the need to pass `-D_WIN32_WINNT=0x0601` 

so my question is: could it be so the `_WIN32_WINNT` macro is reassigned 
somewhere in GDB sources?


More information about the Gdb mailing list