I’ve been struggling for a couple weeks now to try to get LLVM 13 to build on Windows, but I just cannot seem to get it to work. I’ve tried a bunch of times changing out various things including trying different compilers, specifically clang 13 itself using the binaries from the LLVM website as well as various different MinGW compilers. Here’s a summary of my latest attempt:
package | command | version |
---|---|---|
LLVM repository | git tag 13.0.0 | |
CMake | cmake-gui |
3.21.4 |
ninja | ninja -C build |
1.10.2 |
gcc/g++ | mingw-w64 x86_64-8.1.0-win32-sjlj-rt_v6-rev0 from the Mingw-builds sourceforge | |
Windows | Windows 10 64 bit version 2004 |
CMake option | value |
---|---|
CMAKE_BUILD_TYPE | Release |
LLVM_ENABLE_PROJECTS | clang;clang-tools-extra;lld;lldb |
LLVM_ENABLE_RUNTIMES | libcxx;libcxxabi |
CMAKE_C_COMPILER | C:\Program Files\mingw-w64\x86_64-8.1.0-win32-sjlj-rt_v6-rev0\mingw64\bin\gcc.exe |
CMAKE_CXX_COMPILER | C:\Program Files\mingw-w64\x86_64-8.1.0-win32-sjlj-rt_v6-rev0\mingw64\bin\g++.exe |
CMAKE_MAKE_PROGRAM | C:/PROGRA~1/NINJA-~1/ninja.exe |
However when I try to build I get error: 'mutex' is not a member of 'std'
along with note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
on a bunch of different files.
Since new users can’t upload files here I’ve used pastebin to post my CMake output and my CMakeCache, both from that latest attempt.
And since I can only link two files, here’s my ninja output:
Z:\Projects\llvm-project>ninja -C build
ninja: warning: bad deps log signature or version; starting over
ninja: Entering directory `build'
[28/5864] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj
C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\G__~1.EXE -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IZ:/Projects/llvm-project/build/lib/Support -IZ:/Projects/llvm-project/llvm/lib/Support -IZ:/Projects/llvm-project/build/include -IZ:/Projects/llvm-project/llvm/include -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wmisleading-indentation -ffunction-sections -fdata-sections -O2 -DNDEBUG -UNDEBUG -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\CodeGenCoverage.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.obj -c Z:/Projects/llvm-project/llvm/lib/Support/CodeGenCoverage.cpp
In file included from Z:/Projects/llvm-project/llvm/lib/Support/CodeGenCoverage.cpp:17:
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:29:12: error: 'recursive_mutex' in namespace 'std' does not name a type
std::recursive_mutex impl;
^~~~~~~~~~~~~~~
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:29:7: note: 'std::recursive_mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:19:1:
+#include <mutex>
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:29:7:
std::recursive_mutex impl;
^~~
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::lock()':
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:35:11: error: 'impl' was not declared in this scope
impl.lock();
^~~~
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:35:11: note: suggested alternative: 'fmal'
impl.lock();
^~~~
fmal
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::unlock()':
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:48:11: error: 'impl' was not declared in this scope
impl.unlock();
^~~~
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:48:11: note: suggested alternative: 'fmal'
impl.unlock();
^~~~
fmal
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h: In member function 'bool llvm::sys::SmartMutex<mt_only>::try_lock()':
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:62:18: error: 'impl' was not declared in this scope
return impl.try_lock();
^~~~
Z:/Projects/llvm-project/llvm/include/llvm/Support/Mutex.h:62:18: note: suggested alternative: 'fmal'
return impl.try_lock();
^~~~
fmal
[40/5864] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.obj
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.obj
C:\PROGRA~1\MINGW-~1\X86_64~1.0-W\mingw64\bin\G__~1.EXE -DGTEST_HAS_RTTI=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IZ:/Projects/llvm-project/build/lib/Support -IZ:/Projects/llvm-project/llvm/lib/Support -IZ:/Projects/llvm-project/build/include -IZ:/Projects/llvm-project/llvm/include -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wmisleading-indentation -ffunction-sections -fdata-sections -O2 -DNDEBUG -UNDEBUG -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.obj -MF lib\Support\CMakeFiles\LLVMSupport.dir\CrashRecoveryContext.cpp.obj.d -o lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.obj -c Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp
In file included from Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:16:
Z:/Projects/llvm-project/llvm/include/llvm/Support/thread.h: In static member function 'static unsigned int llvm::thread::hardware_concurrency()':
Z:/Projects/llvm-project/llvm/include/llvm/Support/thread.h:109:17: error: 'std::thread' has not been declared
return std::thread::hardware_concurrency();
^~~~~~
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp: At global scope:
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:27: error: 'mutex' is not a member of 'std'
static ManagedStatic<std::mutex> gCrashRecoveryContextMutex;
^~~~~
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:27: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:19:1:
+#include <mutex>
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:27:
static ManagedStatic<std::mutex> gCrashRecoveryContextMutex;
^~~~~
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:27: error: 'mutex' is not a member of 'std'
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:27: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:32: error: template argument 1 is invalid
static ManagedStatic<std::mutex> gCrashRecoveryContextMutex;
^
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:32: error: template argument 2 is invalid
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:88:32: error: template argument 3 is invalid
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp: In static member function 'static void llvm::CrashRecoveryContext::Enable()':
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:140:24: error: 'mutex' is not a member of 'std'
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^~~~~
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:140:24: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:140:24: error: 'mutex' is not a member of 'std'
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:140:24: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:140:29: error: template argument 1 is invalid
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:140:34: error: invalid type argument of unary '*' (have 'int')
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^~~~~~~~~~~~~~~~~~~~~~~~~~
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:140:31: warning: unused variable 'L' [-Wunused-variable]
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp: In static member function 'static void llvm::CrashRecoveryContext::Disable()':
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:149:24: error: 'mutex' is not a member of 'std'
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^~~~~
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:149:24: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:149:24: error: 'mutex' is not a member of 'std'
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:149:24: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:149:29: error: template argument 1 is invalid
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:149:34: error: invalid type argument of unary '*' (have 'int')
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^~~~~~~~~~~~~~~~~~~~~~~~~~
Z:/Projects/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:149:31: warning: unused variable 'L' [-Wunused-variable]
std::lock_guard<std::mutex> L(*gCrashRecoveryContextMutex);
^
[41/5864] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.obj
ninja: build stopped: subcommand failed.
Any help getting a working LLVM with libc++ and a clang that supports libc++ and modules would be much appreciated. Thoughts?