MSYS2-packages
MSYS2-packages copied to clipboard
machine/_threads.h missing
The standard C11 header threads.h provided by the package msys2-runtime-devel is not usable in msys2 due to missing header machine/_threads.h
For example the following program :
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& !defined(__STDC_NO_THREADS__)
#include <threads.h>
#endif
$ gcc -c -std=c11 thread.c
In file included from thread.c:4:0:
/usr/include/threads.h:30:10: fatal error: machine/_threads.h: No such file or directory
#include <machine/_threads.h>
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Maybe defining the macro __STDC_NO_THREADS__ in some system headers to says that the header threads.h is not available is good enough.
same problem
Same problem, September 3, 2023. Was this never resolved?
Works for me:
Markus@Markus-PC MSYS ~
$ cat thread.c
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& !defined(__STDC_NO_THREADS__)
#include <threads.h>
#endif
Markus@Markus-PC MSYS ~
$ gcc -c -std=c11 thread.c
Markus@Markus-PC MSYS ~
$
Works for me too:
saukrs@DESKTOP-O7JE7JE MINGW64 ~/src/c-tests/testing-headers-threads.h
$ cat thread.c
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& !defined(__STDC_NO_THREADS__)
#include <threads.h>
#endif
saukrs@DESKTOP-O7JE7JE MSYS ~/src/c-tests/testing-headers-threads.h
$ gcc -c -std=c11 thread.c
saukrs@DESKTOP-O7JE7JE MSYS ~/src/c-tests/testing-headers-threads.h
$ echo $MSYSTEM
MSYS
saukrs@DESKTOP-O7JE7JE MSYS ~/src/c-tests/testing-headers-threads.h
$ uname -a
MSYS_NT-10.0-19044 DESKTOP-O7JE7JE 3.4.8.x86_64 2023-08-18 23:11 UTC x86_64 Msys
PS. And surely it doesn't in MINGW environment:
saukrs@DESKTOP-O7JE7JE MINGW64 ~/src/c-tests/testing-headers-threads.h
$ gcc -c -std=c11 thread.c
thread.c:4:14: fatal error: threads.h: No such file or directory
4 | #include <threads.h>
| ^~~~~~~~~~~
compilation terminated.
saukrs@DESKTOP-O7JE7JE MINGW64 ~/src/c-tests/testing-headers-threads.h
$ echo $MSYSTEM
MINGW64
(Saying just in case)