[Development] QThread::create mandatory in Qt 6?

Cristian Adam cristian.adam at qt.io
Mon Nov 16 20:03:08 CET 2020


> -----Original Message-----
> From: Development <development-bounces at qt-project.org> On Behalf Of
> Thiago Macieira
> Sent: Monday, 16 November 2020 17:34
> To: development at qt-project.org
> Subject: Re: [Development] QThread::create mandatory in Qt 6?
> 
> On Sunday, 15 November 2020 23:55:24 PST Allan Sandfeld Jensen wrote:
> > > ✗ clang-cl with MS STL  (currently broken)
> >
> > It is? I often use this when building qtwebengine for Windows. Been
> > advocating for an automated test for a while.
> 
> Tony, what environment exactly were you using? How is winlibs.com
> different from the standard MS STL?
> 

Winlibs is shipping GCC MinGW and Clang built for the GNU MinGW target.

$ gcc --version
gcc (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 10.2.0

$ clang --version
(built by Brecht Sanders) clang version 11.0.0
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: c:\winlibs\bin

$ clang-cl --version
(built by Brecht Sanders) clang version 11.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: c:\winlibs\bin

Note that if you have clang-cl it doesn't mean that it will work with the GNU MinGW target. Clang-cl requires the MSVC target, and at the  moment we don't have the 
mkspec mapping to win32-clang-msvc in the CMake code. 

To make this work it requires a few changes to the build system because of how the compiler is identified (both Clang and MSVC, requires special handling in the CMake code)

Qt 6 at the moment can be complied with Clang, which will map the mkspec win32-clang-g++.

LLVM.org is shipping their Windows binaries built for the MSVC target:

$ clang --version
clang version 11.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: c:\Program Files\LLVM\bin

$ clang-cl --version
clang version 11.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: c:\Program Files\LLVM\bin

If you are using Clang it doesn't mean that you need to have the GNU MinGW target, you will end up with binaries depending on MSVCP140.dll and VCRUNTIME140.dll.

Qt6 should in theory work if you set up:

1. "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64 
2. set PATH=c:\Program Files\LLVM\bin;%PATH%
3. set CC=clang
4. set CXX=clang
5. <configure Qt6> 
6. <build Qt6>

For a Clang with a GNU MinGW standalone target option we could use 
https://github.com/mstorsjo/llvm-mingw, which is open source, but it uses libc++ instead of libstdc++, which might be not so well supported on Windows.

$ clang --version
clang version 11.0.0 (https://github.com/llvm/llvm-project.git 176249bd6732a8044d457092ed932768724a6f06)
Target: i686-w64-windows-gnu
Thread model: posix
InstalledDir: c:\llvm-mingw\bin

$ clang-cl --version
'clang-cl' is not recognized as an internal or external command,
operable program or batch file

Note that both winlibs and llvm-mingw do not have Python support enabled for the debugger and cannot be used with Qt Creator.

Cheers,
Cristian.



More information about the Development mailing list