Bug 104654 - Errors in gthread.d when building against MinGW-w64 with --enable-threads=posix
Summary: Errors in gthread.d when building against MinGW-w64 with --enable-threads=posix
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: d (show other bugs)
Version: 11.2.1
: P3 normal
Target Milestone: ---
Assignee: Iain Buclaw
URL: https://github.com/brechtsanders/winl...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-23 07:49 UTC by Brecht Sanders
Modified: 2022-02-23 07:59 UTC (History)
0 users

See Also:
Host: x86_64-w64-mingw32
Target: x86_64-w64-mingw32
Build: x86_64-w64-mingw32
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brecht Sanders 2022-02-23 07:49:19 UTC
When building GCC (recently tried 11.2 snapshot 20220219) against MinGW-w64 with --enable-threads=posix the following D compiler errors occur:

r:\winlibs64-11.2.0ucrt\gcc-11-20220219\libphobos\libdruntime\gcc\gthread.d:46:30: error: undefined identifier 'PTHREAD_ONCE_INIT', did you mean variable 'GTHREAD_ONCE_INIT'?
   46 |     enum GTHREAD_ONCE_INIT = PTHREAD_ONCE_INIT;
      |                              ^
r:\winlibs64-11.2.0ucrt\gcc-11-20220219\libphobos\libdruntime\gcc\gthread.d:44:29: error: undefined identifier 'pthread_key_t'
   44 |     alias __gthread_key_t = pthread_key_t;
      |                             ^
r:\winlibs64-11.2.0ucrt\gcc-11-20220219\libphobos\libdruntime\gcc\gthread.d:45:30: error: undefined identifier 'pthread_once_t'
   45 |     alias __gthread_once_t = pthread_once_t;
      |                              ^

From what I gather things like pthread_key_t and pthread_once_t should probably be defined in libphobos/libdruntime/core/sys/posix/sys/types.d and PTHREAD_ONCE_INIT in libphobos/libdruntime/core/sys/posix/pthread.d

I noticed in libphobos/libdruntime/core/sys/posix/sys/types.d there is no specific version() case for Windows/MinGW with POSIX threads.