When building the Fortran runtime on MinGW, clock_gettime is currently used. That function is provided by the pthread library on that platform. That means that all programs that link libFortranRuntime also require to be linked with pthread on that platform.
There is already a code path (for MSVC) that doesn't use clock_gettime in the implementation of the Fortran library.
Use the same code path also on MinGW by undefining CLOCKID.