Compiler error on building qt creator 2.8.1



  • I am trying to build qt creator 2.8.1 from source. My platform is Centos 6 x64, with all qt 5.1.1 packages installed via yum. Qmake ran with no complaints (other than private header warnings), but make fails with the message below.

    I read something about compiler bugs so I installed devtoolset-1.1 and recompiled...

    @g++ -c -m64 -pipe -Werror -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_CREATOR -DQML_BUILD_STATIC_LIB -DQBS_LIBRARY -DSRCDIR="/usr/src/qtcreator/qt-creator-2.8.1-src/src/shared/qbs/src/lib" -DQBS_VERSION="1.0.1" -DQT_NO_DEBUG -DQT_XML_LIB -DQT_SCRIPT_LIB -DQT_CORE_LIB -I/usr/lib64/qt5/mkspecs/linux-g++-64 -I. -I. -I../../src -I/usr/include/qt5 -I/usr/include/qt5/QtXml -I/usr/include/qt5/QtScript -I/usr/include/qt5/QtCore -I. -o project.o api/project.cpp
    cc1plus: warnings being treated as errors
    In file included from /usr/include/qt5/QtCore/qobject.h:56,
    from /usr/include/qt5/QtCore/qsharedpointer_impl.h:65,
    from /usr/include/qt5/QtCore/qsharedpointer.h:50,
    from /usr/include/qt5/QtCore/QSharedPointer:1,
    from api/../language/forward_decls.h:32,
    from api/project.h:32,
    from api/project.cpp:29:
    /usr/include/qt5/QtCore/qbytearray.h: In function ‘int qRegisterNormalizedMetaType(const QByteArray&, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2::Defined && (! QMetaTypeId2::IsBuiltIn))>::DefinedType) [with T = qbs::Internal::InternalJob*]’:
    /usr/include/qt5/QtCore/qbytearray.h:433: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
    /usr/include/qt5/QtCore/qbytearray.h:438: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
    /usr/include/qt5/QtCore/qarraydata.h:104: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
    /usr/include/qt5/QtCore/qgenericatomic.h:96: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
    /usr/include/qt5/QtCore/qbytearray.h:395: note: initialized from here
    make[3]: *** [project.o] Error 1
    make[3]: Leaving directory /usr/src/qtcreator/qt-creator-2.8.1-src/src/shared/qbs/src/lib' make[2]: *** [sub----shared-qbs-src-lib-make_first] Error 2 make[2]: Leaving directory/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs'
    make[1]: *** [sub-libs-make_first-ordered] Error 2
    make[1]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
    make: *** [sub-src-make_first-ordered] Error 2
    @


  • Moderators

    I think "-Werror" is to be blamed here, try building without it.



  • I'm pretty new to Qt....so....where would I override the compiler setting? Is there a parameter I can send to qmake?


  • Moderators

    AFAIK, Qt Creator should not be using Werror by default. I don't know how to disable it, take a look at the .pro file, or run qmake and then remove the flag from the Makefile.



  • I had same problem.
    Files:
    @qt-creator-2.8.1-src.tar.gz
    qt-everywhere-opensource-src-5.1.1.tar.gz@

    After you unpacked both tar.gz and builded (configure, make, make install) the (qt-everywhere-opensource-src-5.1.1.tar.gz), try this:

    @ln -s qt-everywhere-opensource-src-5.1.1/qtbase/bin/qmake /bin/qmake@

    @cp qt-creator-2.8.1-src/src/libs/3rdparty/cplusplus/Literals.h qt-everywhere-opensource-src-5.1.1/qtbase/src/3rdparty/angle/src/compiler/preprocessor/@

    @cd qt-creator-2.8.1-src
    qmake -r
    make
    make CFLAGS="-Wno-error -fPIC" CXXFLAGS="-Wno-error -fPIC"

    cp qt-creator-2.8.1-src/src/libs/3rdparty/cplusplus/Literals.h qt-creator-2.8.1-src/src/shared/qbs/src/plugins/scanner/cpp/

    cp qt-creator-2.8.1-src/src/libs/3rdparty/cplusplus/Name.h qt-creator-2.8.1-src/src/shared/qbs/src/plugins/scanner/cpp/

    make

    restore qmake

    rm -f /bin//qmake
    ln -s /usr/local/Qt-5.1.1/bin/qmake /bin/qmake
    @

    The (1st) make will exit with error:
    @/usr/include/qt5/QtCore/qbytearray.h:433: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules ..@

    The (2nd) make will exit with error:
    @Name.h:48: error: ISO C++ forbids declaration of ‘AnonymousNameId’ with no type
    Name.h:48: error: ‘AnonymousNameId’ declared as a ‘virtual’ field
    Name.h:48: error: expected ‘;’ before ‘*’ token
    Name.h:49: error: expected ‘;’ before ‘virtual’@

    The (3rd) make will compile. :)

    It seems working, (Centos 6.4 x86_64)
    gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)


Log in to reply
 

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