Open MNRK01 opened 3 years ago
It looks like this to me. This is not a bug, but a deliberate action by the gcc developers not to use mingwstd under the pretext of using newer languages than C++11/14. Nobody's interested in improving mingwstd because there are no funds for it. In newer languages there are new functions that are not compatible with linux with windows. Did I manage to compile something with boost? Yes I compiled boost 1.77.0 beta with libwebp2. Is it working properly? Who knows that. https://github.com/Jamaika1/mingw_std_threads/ I do not take any responsibility for the given link.
Hi,
Thanks for making https://github.com/Jamaika1/mingw_std_threads/ available. The thread part now works well with gcc 11.1 based on limited testing of the code in my original report.
However, I quickly ran into an issue trying to compile libicu which boost/regex needs optionally. The error is distilled down to the definition of class mutex
being protected by #ifdef _GLIBCXX_HAS_THREADS
in std_mutex.h. Since I am compiling gcc with win32 thread model, gthreads is not available to me and running:
printf '#include <mutex>\nstd::mutex test_mutex;int main(){return 0;}' | g++ -x c++ -E -dM - | grep -i THREAD
confirms that I don't have _GLIBCXX_HAS_THREADS
defined.
I think that @Jamaika1's approach to the headers makes sense to me to avoid the namespace clash issues referenced above. It does appear that there is work needed to improve the code so that all the mingw-std-threads headers work well.
I should have pointed out in my initial report that I run the Powershell script Generate-StdLikeHeaders.ps1
under utility_scripts
to use mingw-std-threads, i.e. I don't use CMake. Not sure if that is relevant to my error report.
I appreciate your work very much.
My mistake is that I defined it together. When we use MINGWSTD we don't use _GLIBCXX_HAS_GTHREADS. I split definitions.
The most modified in GCC is definition
It works much better now. I can build libicu and boost. I'm continuing to test other C++11 code. It looks like you no longer need to modify type_traits which is great news.
Is there any hope of backporting your code structure into this mingw-std-threads repo? Also, your code is setup for upstreaming into mingw-w64. Is that a possibility?
Thanks for working on it!
Hi,
I have been trying to compile this code from boost 1.76.0 with mingw-w64 gcc 11:
I get the following error with gcc 11.1, but not with gcc 10.3 or other earlier gcc 10:
It seems this error is new to gcc 11. Commenting out
using mingw_stdthread::thread
on line 330 of mingw.thread.h allows me to get past this error, but causes downstream errors when building boost as one can expect.I'll say that I m surprised that it appears no one else has seen this issue with mingw-w64 gcc 11. I'm wondering if this is on my end. I build my own gcc with scripts from mingw-builds.
Thank you for making mingw-std-threads available and also for any help that you can provide on this issue.