From: Bernd Edlinger Date: Mon, 6 May 2024 05:07:07 +0000 (+0200) Subject: Fix build issues with mingw toolchain X-Git-Tag: gdb-15-branchpoint~170 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45e83f865876e42d22cf4bc242725bb4a25a12e3;p=thirdparty%2Fbinutils-gdb.git Fix build issues with mingw toolchain With a x86_64-pc-mingw32 toolchain there is a build issue whether or not the --disable-threading option is used. The problem happens because _WIN32_WINNT is defined to 0x501 before #include which makes the compilation abort due to missing support for __gthread_cond_t in std_mutex.h, which is conditional on _WIN32_WINNT >= 0x600. Fix the case when --disable-threading is used, by only including in gdb/complaints.c when STD_CXX_THREAD is defined. Additionally make the configure script try to #include to automatically select --disable-threading when the header file is not able to compile. Approved-By: Tom Tromey --- diff --git a/gdb/complaints.c b/gdb/complaints.c index debafde794b..07c0f7e52e5 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -24,7 +24,9 @@ #include "top.h" #include "gdbsupport/selftest.h" #include +#if CXX_STD_THREAD #include +#endif /* Map format strings to counters. */ diff --git a/gdb/configure b/gdb/configure index c3d5cf7ed63..98cd488a737 100755 --- a/gdb/configure +++ b/gdb/configure @@ -20854,6 +20854,7 @@ else # endif #endif /* __MINGW32__ || __CYGWIN__ */ #include + #include void callback() { } int main () diff --git a/gdbserver/configure b/gdbserver/configure index 026d250cc73..2da525ebf3b 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -9561,6 +9561,7 @@ else # endif #endif /* __MINGW32__ || __CYGWIN__ */ #include + #include void callback() { } int main () diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4 index 240ec008f2a..bef396445ba 100644 --- a/gdbsupport/common.m4 +++ b/gdbsupport/common.m4 @@ -114,6 +114,7 @@ AC_DEFUN([GDB_AC_COMMON], [ # endif #endif /* __MINGW32__ || __CYGWIN__ */ #include + #include void callback() { }]], [[std::thread t(callback);]])], gdb_cv_cxx_std_thread=yes, diff --git a/gdbsupport/configure b/gdbsupport/configure index ae991250ce4..a218b06ce28 100755 --- a/gdbsupport/configure +++ b/gdbsupport/configure @@ -12335,6 +12335,7 @@ else # endif #endif /* __MINGW32__ || __CYGWIN__ */ #include + #include void callback() { } int main ()