Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Xaviou on November 24, 2022, 01:41:55 pm

Title: Unable to build CB with MinGW-8.1.0 (Clangd_Client error)
Post by: Xaviou on November 24, 2022, 01:41:55 pm
Hi.

Since last nightly build, I have problems building CodeBlocks with all plugins (the Clangd_Client fails every times)
I tried with both wx-3.1.7 and wx3.2.1, with recents updated of the C::B's sources (rev13062), and with both 32 and 64 bits, but there is no way to make the build finish correctly.

Here is the last attempt result with 32 bits MinGW-8.1.0 and wxWidgets-3.2.1 :
Code
-------------- Build: default in Clangd_Client-wx32 (compiler: GNU GCC Compiler)---------------

Running target pre-build steps
cmd /c @echo TARGET_OUTPUT_DIR: ..\..\..\devel32\share\CodeBlocks\plugins\
cmd /c @echo TARGET_OUTPUT_FILENAME: clangd_client.dll
TARGET_OUTPUT_DIR: ..\..\..\devel32\share\CodeBlocks\plugins\
cmd /c @ECHO TARGET_DEVEL_DIR:
TARGET_OUTPUT_FILENAME: clangd_client.dll
cmd /c @ECHO CB_TRUNK: Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\..\..\..\..\
TARGET_DEVEL_DIR:
CB_TRUNK: Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\..\..\..\..\
g++.exe -Wall -std=gnu++11 -m32 -g -O2 -pipe -mthreads -fmessage-length=0 -fexceptions -DHAVE_W32API_H -DBUILDING_PLUGIN -D__WXMSW__ -DWXUSINGDLL -DNOPCH -DwxUSE_UNICODE -D_WIN32 -DCC_NO_COLLAPSE_ITEM -DcbDEBUG -Wno-deprecated-declarations -DwxDEBUG_LEVEL=0 -I..\..\..\include -I..\..\..\sdk\wxscintilla\include -I..\..\..\include\tinyxml -Isrc -Isrc\LSPclient -Isrc\winprocess -Isrc\winprocess\asyncprocess -Isrc\winprocess\misc -IZ:\wxWidgets\CB_wx32x\include -IZ:\wxWidgets\CB_wx32x\lib\gcc_dll32\mswu -c Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\src\ClangLocator.cpp -o ..\..\..\.objs32\plugins\contrib\clangd_client\src\ClangLocator.o
g++.exe -Wall -std=gnu++11 -m32 -g -O2 -pipe -mthreads -fmessage-length=0 -fexceptions -DHAVE_W32API_H -DBUILDING_PLUGIN -D__WXMSW__ -DWXUSINGDLL -DNOPCH -DwxUSE_UNICODE -D_WIN32 -DCC_NO_COLLAPSE_ITEM -DcbDEBUG -Wno-deprecated-declarations -DwxDEBUG_LEVEL=0 -I..\..\..\include -I..\..\..\sdk\wxscintilla\include -I..\..\..\include\tinyxml -Isrc -Isrc\LSPclient -Isrc\winprocess -Isrc\winprocess\asyncprocess -Isrc\winprocess\misc -IZ:\wxWidgets\CB_wx32x\include -IZ:\wxWidgets\CB_wx32x\lib\gcc_dll32\mswu -c Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\src\codecompletion\ccoptionsdlg.cpp -o ..\..\..\.objs32\plugins\contrib\clangd_client\src\codecompletion\ccoptionsdlg.o
g++.exe -Wall -std=gnu++11 -m32 -g -O2 -pipe -mthreads -fmessage-length=0 -fexceptions -DHAVE_W32API_H -DBUILDING_PLUGIN -D__WXMSW__ -DWXUSINGDLL -DNOPCH -DwxUSE_UNICODE -D_WIN32 -DCC_NO_COLLAPSE_ITEM -DcbDEBUG -Wno-deprecated-declarations -DwxDEBUG_LEVEL=0 -I..\..\..\include -I..\..\..\sdk\wxscintilla\include -I..\..\..\include\tinyxml -Isrc -Isrc\LSPclient -Isrc\winprocess -Isrc\winprocess\asyncprocess -Isrc\winprocess\misc -IZ:\wxWidgets\CB_wx32x\include -IZ:\wxWidgets\CB_wx32x\lib\gcc_dll32\mswu -c Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\src\codecompletion\ccoptionsprjdlg.cpp -o ..\..\..\.objs32\plugins\contrib\clangd_client\src\codecompletion\ccoptionsprjdlg.o
g++.exe -Wall -std=gnu++11 -m32 -g -O2 -pipe -mthreads -fmessage-length=0 -fexceptions -DHAVE_W32API_H -DBUILDING_PLUGIN -D__WXMSW__ -DWXUSINGDLL -DNOPCH -DwxUSE_UNICODE -D_WIN32 -DCC_NO_COLLAPSE_ITEM -DcbDEBUG -Wno-deprecated-declarations -DwxDEBUG_LEVEL=0 -I..\..\..\include -I..\..\..\sdk\wxscintilla\include -I..\..\..\include\tinyxml -Isrc -Isrc\LSPclient -Isrc\winprocess -Isrc\winprocess\asyncprocess -Isrc\winprocess\misc -IZ:\wxWidgets\CB_wx32x\include -IZ:\wxWidgets\CB_wx32x\lib\gcc_dll32\mswu -c Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\src\codecompletion\cctreectrl.cpp -o ..\..\..\.objs32\plugins\contrib\clangd_client\src\codecompletion\cctreectrl.o
In file included from Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\src\codecompletion\codecompletion.h:22,
                 from Z:\wxWidgets\CodeBlocks\src\plugins\contrib\clangd_client\src\codecompletion\ccoptionsdlg.cpp:41:
src\LSPclient/client.h:418:14: error: 'thread' in namespace 'std' does not name a type
         std::thread* m_pJsonReadThread = nullptr;
              ^~~~~~
src\LSPclient/client.h:418:9: note: 'std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
src\LSPclient/client.h:45:1:
+#include <thread>
 
src\LSPclient/client.h:418:9:
         std::thread* m_pJsonReadThread = nullptr;
         ^~~

The error is very strange, as the needed header (thread) is already included.

Is this a known thing or not ?
Am I doing something wrong ?

Regards
Xav'
Title: Re: Unable to build CB with MinGW-8.1.0 (Clangd_Client error)
Post by: Miguel Gimenez on November 24, 2022, 02:17:04 pm
MinGW-64 8.1.0 has versions without support for std::thread, std::mutex and others, look inside your <thread> for more information.

This happened time ago with std::mutex, using wxMutex fixed it; probably using wxThread here would be more compatible.

EDIT: see this (https://stackoverflow.com/questions/37358856/does-mingw-w64-support-stdthread-out-of-the-box-when-using-the-win32-threading), for example.
Title: Re: Unable to build CB with MinGW-8.1.0 (Clangd_Client error)
Post by: Xaviou on November 24, 2022, 07:37:17 pm
Hi, and thank you for your answer.

MinGW-64 8.1.0 has versions without support for std::thread, std::mutex and others, look inside your <thread> for more information.
That's it.

I switched to MinGW-12.2.0 (MSYS2) and all went fine.

Regards
Xav'
Title: Re: Unable to build CB with MinGW-8.1.0 (Clangd_Client error)
Post by: gerwin on November 27, 2022, 03:14:05 am
In my notes from a month ago, I narrowed it down to this:

CodeBlocks SVN r12991
- Building with MinGW 8.4.0 fails.
  g++.exe dislikes option -stc++11 here, especially together with -mthreads. Silent fail, no error code or message.
- Building with MinGW 10.3 (PThread version) Succeeds.