[Development] QT_GCC_MAJOR_VERSION and building with clang...

Thiago Macieira thiago.macieira at intel.com
Fri Dec 6 18:04:35 CET 2019


On Friday, 6 December 2019 08:42:38 PST René J.V. Bertin wrote:
> QT_GCC_MAJOR_VERSION = 3
> QT_GCC_MINOR_VERSION = 2
> QT_GCC_PATCH_VERSION = 1

This is wrong. Clang reports GCC 4.2.1, not 3.2.1.

> QT_CLANG_MAJOR_VERSION = 5
> QT_CLANG_MINOR_VERSION = 0
> QT_CLANG_PATCH_VERSION = 2

This Clang is way too old. If you have GCC from 2018, please use Clang from 
2018 too (that would be Clang 7 minimum).

> Using gcc version 4.2, but at least gcc version 5 is required to build Qt
> WebEngine. QtWebEngine will not be built.
> ```
> 
> I think that what happens here is that Qt records the GCC version that is
> reported by clang, which has long been way too old.

The problem is that it checked the GCC version before checking whether it was 
Clang. Either it does not support building with Clang (it's a possibility) or 
there's a mistake in the code.

QtWebEngine code is fragile because of the large Chromium import, which 
supports only a few platforms. You may need to use GCC after all. GCC still 
produces better code than Clang these days. And GCC 8 definitely produces 
better code than Clang 5.

> This kind of information shouldn't be hardcoded at the time Qt is built but
> determined on the fly by qmake, if not only because system compilers can be
> upgraded independently from the Qt installation. Not to mention Qt installs
> from the official installers; I see this in mine:

We already do that. The information is obtained for every qmake parent project 
run.

/tmp/qttest $ qmake
Info: creating stash file /tmp/qttest/.qmake.stash
/tmp/qttest $ cat .qmake.stash 
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 9
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 1
QMAKE_CXX.COMPILER_MACROS = \
    QT_COMPILER_STDCXX \
    QMAKE_GCC_MAJOR_VERSION \
    QMAKE_GCC_MINOR_VERSION \
    QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
    /usr/include/c++/9 \
    /usr/include/c++/9/x86_64-suse-linux \
    /usr/include/c++/9/backward \
    /usr/lib64/gcc/x86_64-suse-linux/9/include \
    /usr/local/include \
    /usr/lib64/gcc/x86_64-suse-linux/9/include-fixed \
    /usr/x86_64-suse-linux/include \
    /usr/include
QMAKE_CXX.LIBDIRS = \
    /usr/lib64/gcc/x86_64-suse-linux/9 \
    /usr/lib64 \
    /lib64 \
    /usr/x86_64-suse-linux/lib \
    /lib \
    /usr/lib
/tmp/qttest $ gmake distclean
rm -f moc_predefs.h
rm -f main.o
rm -f *~ core *.core
rm -f qttest 
rm -f .qmake.stash
rm -f Makefile
/tmp/qttest $ qmake -spec linux-clang
Info: creating stash file /tmp/qttest/.qmake.stash
/tmp/qttest $ cat .qmake.stash       
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_CLANG_MAJOR_VERSION = 9
QMAKE_CXX.QMAKE_CLANG_MINOR_VERSION = 0
QMAKE_CXX.QMAKE_CLANG_PATCH_VERSION = 0
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 4
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 1
QMAKE_CXX.COMPILER_MACROS = \
    QT_COMPILER_STDCXX \
    QMAKE_CLANG_MAJOR_VERSION \
    QMAKE_CLANG_MINOR_VERSION \
    QMAKE_CLANG_PATCH_VERSION \
    QMAKE_GCC_MAJOR_VERSION \
    QMAKE_GCC_MINOR_VERSION \
    QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
    /usr/include/c++/9 \
    /usr/include/c++/9/x86_64-suse-linux \
    /usr/include/c++/9/backward \
    /usr/local/include \
    /usr/lib64/clang/9.0.0/include \
    /usr/include
QMAKE_CXX.LIBDIRS = \
    /usr/lib64/clang/9.0.0 \
    /usr/lib64/gcc/x86_64-suse-linux/9 \
    /usr/lib64 \
    /lib64 \
    /usr/x86_64-suse-linux/lib \
    /usr/lib \
    /lib


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Development mailing list