For some reason, _GLIBCXX_GTHREAD_USE_WEAK is not disabled by default, and at least __gthread_once is broken on DS in my test (so std::call_once is unusable). By changing __gthrw_(pthread_once) to pthread_once in its defintion, it works. Nevertheless, the __gthrw_ wrapper should never be used (as it adds one redundant level of logical indirection for nothing) even though other gthread APIs might still work.
I have not looked into it deeply but noticed a suspicious condition defined( __MINGW32__) || defined(_GLIBCXX___DEVKITARM__) in gthread headers. Yes, rg _GLIBCXX___DEVKITARM__ /opt/devkitpro shows there are multiple instances in my installation (probably from the same libgcc source, I guess). What is _GLIBCXX___DEVKITARM__? Shouldn't it just be __DEVKITARM__?
Despite figuring out the exact set of headers actually used, the workaround is straitforward by adding -D_GLIBCXX_GTHREAD_USE_WEAK=0 in the compiler options for all translation units probably including these headers. I've tried and it works.
For some reason,
_GLIBCXX_GTHREAD_USE_WEAKis not disabled by default, and at least__gthread_onceis broken on DS in my test (sostd::call_onceis unusable). By changing__gthrw_(pthread_once)topthread_oncein its defintion, it works. Nevertheless, the__gthrw_wrapper should never be used (as it adds one redundant level of logical indirection for nothing) even though other gthread APIs might still work.I have not looked into it deeply but noticed a suspicious condition
defined( __MINGW32__) || defined(_GLIBCXX___DEVKITARM__)in gthread headers. Yes,rg _GLIBCXX___DEVKITARM__ /opt/devkitproshows there are multiple instances in my installation (probably from the same libgcc source, I guess). What is_GLIBCXX___DEVKITARM__? Shouldn't it just be__DEVKITARM__?Despite figuring out the exact set of headers actually used, the workaround is straitforward by adding
-D_GLIBCXX_GTHREAD_USE_WEAK=0in the compiler options for all translation units probably including these headers. I've tried and it works.