On Thu, Aug 04, 2016 at 04:22:50PM +0100, Guillaume Munch wrote: > Le 04/08/2016 à 10:19, Enrico Forestieri a écrit : > > > > This does not compile with mingw (g++ 4.9.2): > > > > ../../src/graphics/PreviewLoader.cpp:101:4: error: ‘call_once’ was not > > declared in this scope > > }); > > ^ > > > > > Finding infos about this was complicated because mingw does not appear > to be very well documented. Also I did not find instructions for > cross-compiling with Mingw using Ubuntu/Debian's mingw-w64 packages in > the INSTALL files (despite there being two entries for mingw). I would > be very curious to know how you do it, independently (useful for > instance for being able to test on Windows ourselves). But I think I now > understand what is going on.
I am simply cross-compiling from cygwin following the usual way: configure --host=i686-w64-mingw32 --build=i686-pc-cygwin ... I have never tried it on linux, but it should be the same, provided you have the necessary tools and libraries. I compile this way a native Windows version from time to time, mostly for checking Windows specific bugs. > There seems to be two incompatible implementations of threads for mingw > on windows: pthreads and win32. The definition of call_once in <mutex> > is guarded by _GLIBCXX_HAS_GTHREADS, which, if I understand correctly, > means it is only available with pthreads. The cygwin cross-compiler is based on winpthreads, which is described as "MinGW-w64 POSIX threads for Win32 target", but there is no trace of _GLIBCXX_HAS_GTHREADS or call_once in the headers. > Pthreads appears to be a heavier abstraction layer but is more compliant > towards C++. Actually, it seems that the win32 threads make no effort at > implementing the <thread> and <mutex> headers. It looks to me that there > is a choice to make, to support compilation with pthreads instead of > win32 threads, this being a cross-platform solution. > > * Can you manage to make it work by enabling pthreads? This is not possible because the compiler itself has to be configured for using a specific threading model, and the cygwin cross-compiler uses winpthreads. > * If so, are LyX devs ready to officially deny support for mingw + win32 > threads? Note that in this case I will not be able to compile a native Windows version of LyX (I am not going to install MSVC) and will not be able to investigate Windows specific bugs. -- Enrico