openvr icon indicating copy to clipboard operation
openvr copied to clipboard

OpenVR compile fails due to missing std::recursive_mutex

Open LordOfDragons opened this issue 4 years ago • 1 comments

OpenVR can not be compiled using x86_64-w64-mingw32-g++ cross compiler due to missing classes:

/sources/extern/openvr/openvr-1.16.8/src/openvr_api_public.cpp:40:13: error: 'recursive_mutex' in namespace 'std' does not name a type
   40 | static std::recursive_mutex g_mutexSystem;
      |             ^~~~~~~~~~~~~~~
/sources/extern/openvr/openvr-1.16.8/src/openvr_api_public.cpp:12:1: note: 'std::recursive_mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
   11 | #include <mutex>
  +++ |+#include <mutex>
   12 | 
/sources/extern/openvr/openvr-1.16.8/src/openvr_api_public.cpp: In function 'uint32_t vr::VR_InitInternal2(vr::EVRInitError*, vr::EVRApplicationType, const char*)':
/sources/extern/openvr/openvr-1.16.8/src/openvr_api_public.cpp:58:23: error: 'recursive_mutex' is not a member of 'std'
   58 |  std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
      |                       ^~~~~~~~~~~~~~~
/sources/extern/openvr/openvr-1.16.8/src/openvr_api_public.cpp:58:23: note: 'std::recursive_mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
... (lots of these errors)```

LordOfDragons avatar Sep 07 '21 21:09 LordOfDragons

Problem can be fixed using https://github.com/meganz/mingw-std-threads which is though more of a work-around than a real fix. Doing this requires some changes on the CMakeFiles to work. I'll make a pull request with fixes to get mingw running.

LordOfDragons avatar Sep 09 '21 01:09 LordOfDragons