Mutex error at the compilation of cmake

Recently I have compiled and installed GCC-12.2.0 in RISCV Linux. Then I was going for compilation of CMAKE application for RISCV but unfortunately it was given the following error.
ERROR :

In file included from /home/BDFS/packages/cmake-3.25.1/Source/cmQtAutoGenerator.cxx:3:
/home/BDFS/packages/cmake-3.25.1/Source/cmQtAutoGenerator.h:57:18: error: 'mutex' in namespace 'std' does not name a type
   57 |     mutable std::mutex Mutex_;
      |                  ^~~~~
/home/BDFS/packages/cmake-3.25.1/Source/cmQtAutoGenerator.h:19:1: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
   18 | #include "cmQtAutoGen.h"
  +++ |+#include <mutex>
   19 |
[ 47%] Building CXX object Source/CMakeFiles/CMakeLib.dir/cmQtAutoGenInitializer.cxx.o
[ 47%] Building CXX object Source/CMakeFiles/CMakeLib.dir/cmQtAutoMocUic.cxx.o
/home/BDFS/packages/cmake-3.25.1/Source/cmQtAutoGenerator.cxx: In member function 'void cmQtAutoGenerator::Logger::Info(cmQtAutoGen::GenT, std::string_view) const':
/home/BDFS/packages/cmake-3.25.1/Source/cmQtAutoGenerator.cxx:63:26: error: 'mutex' is not a member of 'std'
   63 |     std::lock_guard<std::mutex> lock(this->Mutex_);
      |                          ^~~~~

Thanks,
Rushikesh Jadhav.

That header is already included. Does <mutex> and std::mutex work at all in a small minimal example?

@brad.king Do we have RISC-V testing at all? I see that Debian has riscv64 builds of CMake already, though I haven’t spelunked for patches they may have.

Small minimal code also gives the same error (error: ‘mutex’ in namespace ‘std’ does not name a type). Any solution for this error?

It looks like your toolchain is not set up properly to me; I’d investigate that first. Did you enable pthreads support?

Yes, I was enable pthreads with --enable-threads=posix option.

Then something else would seem to be up. Are there pre-compiled toolchains available to test with as a comparison?