std::system_error when building simple OpenXR application without threading support
On some Linux systems, when running the following simple program:
#include <openxr/openxr.h>
#include <openxr/openxr_platform.h>
int main()
{
uint32_t numLayerProperties = 0;
xrEnumerateApiLayerProperties(0, &numLayerProperties, NULL);
}
If the C++ library linked to does not include threading support, and -lpthreads is not specified either when compiling, upon running, the OpenXR loader will throw std::system_error:
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
Aborted
The logging funcs in the OpenXR loader require threading, thus the entire OpenXR loader cannot run without proper threading support (as logging funcs cannot be disabled atm). However, the OpenXR loader does not give a clear error message describing the cause of the problem, thus some documentation in Monado warning users of this issue might be desirable.
While this issue is not directly related to Monado itself, it is a relevant issue for users who are trying to get OpenXR applications building and running with the OpenXR loader and Monado. Feel free to close this issue if deemed unnecessary- even as a closed issue, it may prove useful to users trying to get their applications up-and-running.