openvr
openvr copied to clipboard
OpenVR compile fails due to missing std::recursive_mutex
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)```
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.