[Development] QT_GCC_MAJOR_VERSION and building with clang...

René J.V. Bertin rjvbertin at gmail.com
Fri Dec 6 17:42:38 CET 2019


Hi,

I just noticed this on Linux, after building Qt 5.12.6 with clang 5.0.2 :

```
> cat /opt/local/libexec/qt512/mkspecs/qconfig.pri
QT_ARCH = x86_64      
QT_BUILDABI = x86_64-little_endian-lp64
QT.global.enabled_features = shared rpath c++11 c++14 c++1z c99 c11 thread future concurrent pkg-config
QT.global.disabled_features = cross_compile framework appstore-compliant debug_and_release simulator_and_device build_all force_asserts separate_debug_info static
QT_CONFIG += shared rpath release c++11 c++14 c++1z concurrent dbus reduce_exports release_tools stl
CONFIG += shared release
QT_VERSION = 5.12.6
QT_MAJOR_VERSION = 5
QT_MINOR_VERSION = 12 
QT_PATCH_VERSION = 6
QT_GCC_MAJOR_VERSION = 3
QT_GCC_MINOR_VERSION = 2
QT_GCC_PATCH_VERSION = 1
QT_CLANG_MAJOR_VERSION = 5
QT_CLANG_MINOR_VERSION = 0 
QT_CLANG_PATCH_VERSION = 2
QT_EDITION = OpenSource
```

This was after I got this error from an attempt to build QtWebEngine 5.12.6 with /usr/bin/c++ which points to GCC 8:

```
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. 

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:

```
> cat /opt/Qt/5/5.12.4/gcc_64/mkspecs/qconfig.pri
QT_ARCH = x86_64
QT_BUILDABI = x86_64-little_endian-lp64
QT.global.enabled_features = shared rpath c++11 c++14 c99 c11 thread future concurrent pkg-config separate_debug_info
QT.global.disabled_features = cross_compile framework appstore-compliant debug_and_release simulator_and_device build_all c++1z force_asserts static
QT_CONFIG += shared rpath release c++11 c++14 concurrent dbus reduce_exports reduce_relocations separate_debug_info stl  
CONFIG += shared release
QT_VERSION = 5.12.4
QT_MAJOR_VERSION = 5
QT_MINOR_VERSION = 12
QT_PATCH_VERSION = 4
QT_GCC_MAJOR_VERSION = 5
QT_GCC_MINOR_VERSION = 3
QT_GCC_PATCH_VERSION = 1
QT_EDITION = OpenSource
QT_LICHECK =
QT_RELEASE_DATE = 2019-06-13
```

which is just wrong even if there should be less unforeseen effects when building with a newer version of the same compiler (in an ideal world).

R.


More information about the Development mailing list