Author Topic: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW  (Read 1789 times)

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 572
The mutex added to DirectoryParamsPanel.cpp in a recent commit breaks compilation (mutex is not part of namespace std) in all MinGW versions except the posix-seh one, due to problems with win32 threads.

Of course the toolchain can be changed, but this forces recompiling (at least) wxWidgets and boost. Also, posix-seh version only exists for 64-bit MSW, so 32-bit users are stuck.

Can std::mutex be replaced with wxMutex?

EDIT: patch added
« Last Edit: June 02, 2020, 11:08:20 am by Miguel Gimenez »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12904
    • Travis build status
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #1 on: June 01, 2020, 09:16:22 pm »
Do you have link documenting these thing? I doubt this is the case, but I suppose everything could be expected by MinGW people.

I guess it is time to switch to llvm/clang+libc++ on windows...

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 572
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #2 on: June 01, 2020, 09:49:03 pm »
Quote
Do you have link documenting these thing?

I have some links with sparse information, for example this is about an older version but things have not changed.

https://stackoverflow.com/questions/14191566/c-mutex-in-namespace-std-does-not-name-a-type

I tested MinGW-W64 GCC-8.1.0 x86_64-win32-sjlj and MinGW-7.2.0, both failed. GCC-8.1.0 x86_64-posix-seh did compile succesfully.

Vadim Zeitlim from wxWidgets' team tested today MinGW-W64 GCC-9.3-win32 and compilation failed. His answer has a link to an ongoing discussion in MinGW-W64 mailing list.

https://github.com/wxWidgets/wxWidgets/commit/66c8437952f970a1a896d67c0ba6838591cf03b6#commitcomment-39582459

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12904
    • Travis build status
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #3 on: June 02, 2020, 12:50:04 am »
MinGW should be dumped...
https://gcc-mcf.lhmouse.com/ is something done by a mingw-w64 dev and he is not able to make it mainstream for 4 years.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2849
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #4 on: June 02, 2020, 11:30:42 am »
I am also hitting this problem ;(

Offline tomay3000

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #5 on: June 02, 2020, 01:10:17 pm »
Using llvm/clang+libc++ on windows https://github.com/mstorsjo/llvm-mingw I was able to compile wxWidgets but never Boost.
If you manage to compile Boost, please share your experience.
TIA.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12904
    • Travis build status
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #6 on: June 02, 2020, 09:45:47 pm »
Chrome and Firefox are build with clang now, so if they could be built, everything could be built.

@bluehazzard: I think you've tested this and haven't reported any problems. :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12904
    • Travis build status
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #7 on: June 03, 2020, 12:06:08 am »
Fixed in trunk. It is funny why the no-pch build succeeds without the inclusion of wx/thread.h :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2849
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #8 on: June 03, 2020, 09:09:59 am »
Quote
@bluehazzard: I think you've tested this and haven't reported any problems.
I have tested it on my other system, so probably there i use the right compiler... sry about that....

Offline sodev

  • Regular
  • ***
  • Posts: 405
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #9 on: June 03, 2020, 04:15:44 pm »
Fixed in trunk. It is funny why the no-pch build succeeds without the inclusion of wx/thread.h :(

The wonders of transitive includes. Still that shouldn't stop you to produce self-sufficient headers by including everything you use (or use some documented service-headers that pull in common includes), otherwise you will get trouble later when transitivity changes ;)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12904
    • Travis build status
Re: Use of std::mutex in ThreadSearch breaks compilation on (most) MinGW
« Reply #10 on: June 03, 2020, 07:27:40 pm »
... Still that shouldn't stop you to produce self-sufficient headers by including everything you use...
Too late...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]