Qt 5.0.1 build failure on linux with Gcc-4.8.0 and c++11 turned on.



  • Hello,
    I'm trying to build Qt-5.0.1 on 64bit linux with GCC-4.8.0 enabling c++11. Compilation is failing with bunch of errors.

    kernel/qtimerinfo_unix.cpp:98:30: error: redeclaration ‘constexpr T qAbs(const T&) [with T = timeval]’ differs in ‘constexpr’
    timeval qAbs(const timeval &t)
    ^
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:27: error: from previous declaration ‘constexpr T qAbs(const T&) [with T = timeval]’
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    kernel/qtimerinfo_unix.cpp: In function ‘constexpr T qAbs(const T&) [with T = timeval]’:
    kernel/qtimerinfo_unix.cpp:109:1: error: body of constexpr function ‘constexpr T qAbs(const T&) [with T = timeval]’ not a return-statement
    }
    ^
    ... and so on

    Compilation is fine when c++11 is turned off. What am I missing here ?

    Thanks,
    Surya


  • Lifetime Qt Champion

    Hi and welcome to DevNet,

    Have a look at this "thread":http://qt-project.org/forums/viewthread/26312/ it contains some indication about your problem



  • i'm compiling QT 5.0.2 on linux , how can help me with this error ?

    g++ -c -include .pch/release-shared/Qt5Core -m64 -pipe -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -O2 -std=c++0x -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_NO_USING_NAMESPACE -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DELF_INTERPRETER="/lib64/ld-linux-x86-64.so.2" -DQT_USE_ICU -DPCRE_HAVE_CONFIG_H -DHB_EXPORT=Q_CORE_EXPORT -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -I../../mkspecs/linux-g++-64 -I. -I../../include -I../../include/QtCore -I../../include/QtCore/5.0.2 -I../../include/QtCore/5.0.2/QtCore -Iglobal -I../3rdparty/pcre -I../3rdparty/md5 -I../3rdparty/md4 -I.moc/release-shared -o .obj/release-shared/qtimerinfo_unix.o kernel/qtimerinfo_unix.cpp
    kernel/qtimerinfo_unix.cpp:98:30: error: redeclaration ‘constexpr T qAbs(const T&) [with T = timeval]’ differs in ‘constexpr’
    timeval qAbs(const timeval &t)
    ^
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:27: error: from previous declaration ‘constexpr T qAbs(const T&) [with T = timeval]’
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    kernel/qtimerinfo_unix.cpp: In function ‘constexpr T qAbs(const T&) [with T = timeval]’:
    kernel/qtimerinfo_unix.cpp:109:1: error: body of constexpr function ‘constexpr T qAbs(const T&) [with T = timeval]’ not a return-statement
    }
    ^
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h: In instantiation of ‘constexpr T qAbs(const T&) [with T = timeval]’:
    kernel/qtimerinfo_unix.cpp:147:44: required from here
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:55: error: no match for ‘operator>=’ (operand types are ‘const timeval’ and ‘int’)
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:55: note: candidates are:
    In file included from ../../include/QtCore/qpair.h:1:0,
    from ../../include/QtCore/../../src/corelib/tools/qmap.h:48,
    from ../../include/QtCore/qmap.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qvariant.h:49,
    from ../../include/QtCore/qvariant.h:1,
    from global/qt_pch.h:66:
    ../../include/QtCore/../../src/corelib/tools/qpair.h:98:24: note: template<class T1, class T2> bool operator>=(const QPair<T, U>&, const QPair<T, U>&)
    Q_INLINE_TEMPLATE bool operator>=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qpair.h:98:24: note: template argument deduction/substitution failed:
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:55: note: ‘const timeval’ is not derived from ‘const QPair<T, U>’
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    In file included from ../../include/QtCore/qstring.h:1:0,
    from ../../include/QtCore/../../src/corelib/kernel/qobject.h:48,
    from ../../include/QtCore/qobject.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:45,
    from ../../include/QtCore/qcoreapplication.h:1,
    from global/qt_pch.h:64:
    ../../include/QtCore/../../src/corelib/tools/qstring.h:1309:13: note: bool operator>=(const QStringRef&, const QStringRef&)
    inline bool operator>=(const QStringRef &s1, const QStringRef &s2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qstring.h:1309:13: note: no known conversion for argument 1 from ‘const timeval’ to ‘const QStringRef&’
    ../../include/QtCore/../../src/corelib/tools/qstring.h:1038:32: note: bool operator>=(const char*, QLatin1String)
    inline QT_ASCII_CAST_WARN bool operator>=(const char s1, QLatin1String s2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qstring.h:1038:32: note: no known conversion for argument 1 from ‘const timeval’ to ‘const char

    ../../include/QtCore/../../src/corelib/tools/qstring.h:984:13: note: bool operator>=(QLatin1String, QLatin1String)
    inline bool operator>=(QLatin1String s1, QLatin1String s2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qstring.h:984:13: note: no known conversion for argument 1 from ‘const timeval’ to ‘QLatin1String’
    ../../include/QtCore/../../src/corelib/tools/qstring.h:1336:32: note: bool operator>=(const char*, const QStringRef&)
    inline QT_ASCII_CAST_WARN bool operator>=(const char s1, const QStringRef &s2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qstring.h:1336:32: note: no known conversion for argument 1 from ‘const timeval’ to ‘const char

    ../../include/QtCore/../../src/corelib/tools/qstring.h:1025:32: note: bool operator>=(const char*, const QString&)
    inline QT_ASCII_CAST_WARN bool operator>=(const char s1, const QString &s2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qstring.h:1025:32: note: no known conversion for argument 1 from ‘const timeval’ to ‘const char

    In file included from ../../include/QtCore/qbytearray.h:1:0,
    from ../../include/QtCore/../../src/corelib/tools/qstring.h:46,
    from ../../include/QtCore/qstring.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qobject.h:48,
    from ../../include/QtCore/qobject.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:45,
    from ../../include/QtCore/qcoreapplication.h:1,
    from global/qt_pch.h:64:
    ../../include/QtCore/../../src/corelib/tools/qbytearray.h:560:13: note: bool operator>=(const char*, const QByteArray&)
    inline bool operator>=(const char a1, const QByteArray &a2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qbytearray.h:560:13: note: no known conversion for argument 1 from ‘const timeval’ to ‘const char

    ../../include/QtCore/../../src/corelib/tools/qbytearray.h:558:13: note: bool operator>=(const QByteArray&, const char*)
    inline bool operator>=(const QByteArray &a1, const char a2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qbytearray.h:558:13: note: no known conversion for argument 1 from ‘const timeval’ to ‘const QByteArray&’
    ../../include/QtCore/../../src/corelib/tools/qbytearray.h:556:13: note: bool operator>=(const QByteArray&, const QByteArray&)
    inline bool operator>=(const QByteArray &a1, const QByteArray &a2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qbytearray.h:556:13: note: no known conversion for argument 1 from ‘const timeval’ to ‘const QByteArray&’
    In file included from ../../include/QtCore/qchar.h:1:0,
    from ../../include/QtCore/../../src/corelib/tools/qstring.h:45,
    from ../../include/QtCore/qstring.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qobject.h:48,
    from ../../include/QtCore/qobject.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:45,
    from ../../include/QtCore/qcoreapplication.h:1,
    from global/qt_pch.h:64:
    ../../include/QtCore/../../src/corelib/tools/qchar.h:390:13: note: bool operator>=(QChar, QChar)
    inline bool operator>=(QChar c1, QChar c2) { return c1.unicode() >= c2.unicode(); }
    ^
    ../../include/QtCore/../../src/corelib/tools/qchar.h:390:13: note: no known conversion for argument 1 from ‘const timeval’ to ‘QChar’
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:66: error: no match for ‘operator-’ (operand type is ‘const timeval’)
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:66: note: candidates are:
    In file included from ../../include/QtCore/5.0.2/QtCore/private/qcore_unix_p.h:1:0,
    from kernel/qtimerinfo_unix.cpp:45:
    ../../include/QtCore/5.0.2/QtCore/private/../../../../../src/corelib/kernel/qcore_unix_p.h:133:16: note: timeval operator-(const timeval&, const timeval&)
    inline timeval operator-(const timeval &t1, const timeval &t2)
    ^
    ../../include/QtCore/5.0.2/QtCore/private/../../../../../src/corelib/kernel/qcore_unix_p.h:133:16: note: candidate expects 2 arguments, 1 provided
    In file included from ../../include/QtCore/qsharedpointer_impl.h:1:0,
    from ../../include/QtCore/../../src/corelib/tools/qsharedpointer.h:50,
    from ../../include/QtCore/qsharedpointer.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qpointer.h:45,
    from ../../include/QtCore/qpointer.h:1,
    from ../../include/QtCore/5.0.2/QtCore/private/../../../../../src/corelib/kernel/qobject_p.h:57,
    from ../../include/QtCore/5.0.2/QtCore/private/qobject_p.h:1,
    from kernel/qtimerinfo_unix.cpp:47:
    ../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:697:63: note: template<class T, class X> typename QSharedPointer<T>::difference_type operator-(const QSharedPointer<T>&, const QSharedPointer<T>&)
    Q_INLINE_TEMPLATE typename QSharedPointer<T>::difference_type operator-(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:697:63: note: template argument deduction/substitution failed:
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:66: note: ‘const timeval’ is not derived from ‘const QSharedPointer<T>’
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    In file included from ../../include/QtCore/qsharedpointer_impl.h:1:0,
    from ../../include/QtCore/../../src/corelib/tools/qsharedpointer.h:50,
    from ../../include/QtCore/qsharedpointer.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qpointer.h:45,
    from ../../include/QtCore/qpointer.h:1,
    from ../../include/QtCore/5.0.2/QtCore/private/../../../../../src/corelib/kernel/qobject_p.h:57,
    from ../../include/QtCore/5.0.2/QtCore/private/qobject_p.h:1,
    from kernel/qtimerinfo_unix.cpp:47:
    ../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:702:63: note: template<class T, class X> typename QSharedPointer<T>::difference_type operator-(const QSharedPointer<T>&, X
    )
    Q_INLINE_TEMPLATE typename QSharedPointer<T>::difference_type operator-(const QSharedPointer<T> &ptr1, X ptr2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:702:63: note: template argument deduction/substitution failed:
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:66: note: ‘const timeval’ is not derived from ‘const QSharedPointer<T>’
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    In file included from ../../include/QtCore/qsharedpointer_impl.h:1:0,
    from ../../include/QtCore/../../src/corelib/tools/qsharedpointer.h:50,
    from ../../include/QtCore/qsharedpointer.h:1,
    from ../../include/QtCore/../../src/corelib/kernel/qpointer.h:45,
    from ../../include/QtCore/qpointer.h:1,
    from ../../include/QtCore/5.0.2/QtCore/private/../../../../../src/corelib/kernel/qobject_p.h:57,
    from ../../include/QtCore/5.0.2/QtCore/private/qobject_p.h:1,
    from kernel/qtimerinfo_unix.cpp:47:
    ../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:707:63: note: template<class T, class X> typename QSharedPointer<T>::difference_type operator-(T
    , const QSharedPointer<T>&)
    Q_INLINE_TEMPLATE typename QSharedPointer<X>::difference_type operator-(T ptr1, const QSharedPointer<X> &ptr2)
    ^
    ../../include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:707:63: note: template argument deduction/substitution failed:
    In file included from ../../include/QtCore/qglobal.h:1:0,
    from global/qt_pch.h:58:
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483:66: note: mismatched types ‘T
    ’ and ‘timeval’
    Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
    ^
    ../../include/QtCore/../../src/corelib/global/qglobal.h:483: confused by earlier errors, bailing out
    make: *** [.obj/release-shared/qtimerinfo_unix.o] Error 1


  • Lifetime Qt Champion

    Hi,

    You posted almost the same question in several threads like this one or that one.

    So what exactly are you trying to do ? Build for Linux ? OpenWRT ? What distribution are you using ? What version of GCC ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.