]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix build issues with mingw toolchain
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 6 May 2024 05:07:07 +0000 (07:07 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 6 May 2024 16:44:54 +0000 (18:44 +0200)
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 <mutex> 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 <mutex> in gdb/complaints.c when STD_CXX_THREAD
is defined.

Additionally make the configure script try to #include <mutex>
to automatically select --disable-threading when the header file
is not able to compile.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/complaints.c
gdb/configure
gdbserver/configure
gdbsupport/common.m4
gdbsupport/configure

index debafde794b8af58c9b03203106bffeec90daba1..07c0f7e52e501e7adc5fc7fcfd4fbb0de1409750 100644 (file)
@@ -24,7 +24,9 @@
 #include "top.h"
 #include "gdbsupport/selftest.h"
 #include <unordered_map>
+#if CXX_STD_THREAD
 #include <mutex>
+#endif
 
 /* Map format strings to counters.  */
 
index c3d5cf7ed63d6089749c60b4186617933c1a4e6f..98cd488a7374311d5e001ba3d4dc02e6e4a972dd 100755 (executable)
@@ -20854,6 +20854,7 @@ else
     # endif
     #endif     /* __MINGW32__ || __CYGWIN__ */
     #include <thread>
+    #include <mutex>
     void callback() { }
 int
 main ()
index 026d250cc73265c5f65706e4c6641f04bcffc1ff..2da525ebf3baabdef39c53a3582c40051b40531c 100755 (executable)
@@ -9561,6 +9561,7 @@ else
     # endif
     #endif     /* __MINGW32__ || __CYGWIN__ */
     #include <thread>
+    #include <mutex>
     void callback() { }
 int
 main ()
index 240ec008f2a4d5073716aca530ae7d516c4ef839..bef396445ba2d7455802104a4a3a8fa6f964f1b3 100644 (file)
@@ -114,6 +114,7 @@ AC_DEFUN([GDB_AC_COMMON], [
     # endif
     #endif     /* __MINGW32__ || __CYGWIN__ */
     #include <thread>
+    #include <mutex>
     void callback() { }]],
   [[std::thread t(callback);]])],
                                gdb_cv_cxx_std_thread=yes,
index ae991250ce4c0e7415c32f8f85abc8b53a108fbb..a218b06ce2807b7d64b1d433e0f36bdcadb12516 100755 (executable)
@@ -12335,6 +12335,7 @@ else
     # endif
     #endif     /* __MINGW32__ || __CYGWIN__ */
     #include <thread>
+    #include <mutex>
     void callback() { }
 int
 main ()