Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.13.1
-
None
-
-
04f6073da2eb9af1d0728aa688c906b682a44801 (qt/qtbase/5.14)
Description
When trying to build Qt-5.13.1 with Intel compilers I would get the following error:
>> 82 /dev/shm/gpjohnsn/spack-stage-qt-5.13.1-szivpolegsx2j6hslwuyqkudeufbfhaw/spack-src/qtbase/include/QtCore/5.1 3.1/QtCore/private/../../../../../src/corelib/global/qnumeric_p.h(250): error: argument is incompatible with formal parameter 83 { return __builtin_mul_overflow(v1, v2, r); } 84 ^ 85 >> 86 /dev/shm/gpjohnsn/spack-stage-qt-5.13.1-szivpolegsx2j6hslwuyqkudeufbfhaw/spack-src/qtbase/include/QtCore/5.1 3.1/QtCore/private/../../../../../src/corelib/global/qnumeric_p.h(240): error: argument is incompatible with formal parameter 87 { return __builtin_add_overflow(v1, v2, r); }
This is due to the version of GCC that was loaded, gcc-4.8.5 in this case, which does not have support for overflow builtins. I worked around this with the following patch:
--- a/qtbase/src/corelib/global/qnumeric_p.h 2019-08-31 03:29:31.000000000 -0500 +++ b/qtbase/src/corelib/global/qnumeric_p.h 2020-01-06 14:23:40.719851927 -0600 @@ -231,7 +231,7 @@ // size_t. Implementations for 8- and 16-bit types will work but may not be as // efficient. Implementations for 64-bit may be missing on 32-bit platforms. -#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) || (defined(Q_CC_INTEL) && !defined(Q_OS_WIN))) || QT_HAS_BUILTIN(__builtin_add_overflow) +#if (defined(Q_CC_GNU) && (Q_CC_GNU >= 500) && !defined(Q_CC_INTEL) || (defined(Q_CC_INTEL) && (Q_CC_INTEL >= 1800) && (Q_CC_GNU >= 500) && !defined(Q_OS_WIN))) || QT_HAS_BUILTIN(__builtin_add_overflow) // GCC 5, ICC 18, and Clang 3.8 have builtins to detect overflows template <typename T> inline
that checks the version of GCC with or without an Intel compiler present, as well as verifying that the version of the Intel compiler supports overflow builtins when present. This should apply to 5.14 as well. Another part of this is that the platform will have to be set to intel-icc or the following error is seen:
Project ERROR: failed to parse default search paths from compiler output
if linux-g++ is used.