Errors while compiling Qt Creator 3.0.0 on CentOS6.4
I successfully managed to create a Qt 5.2.0 build on my platform, and I am now attempting to create a Qt Creator 3.0.0 build. I keep getting the following errors and have no clue what it means and what I should look for to solve the problem. Any ideas what I did wrong here?
g++ -c -pipe -Werror -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_CREATOR -DQML_BUILD_STATIC_LIB -DQBS_LIBRARY -DSRCDIR="/workspace/third_party/sources/qt-creator-opensource-src-3.0.0/src/shared/qbs/src/lib" -DQBS_VERSION="1.1.1" -DQT_NO_DEBUG -DQT_XML_LIB -DQT_SCRIPT_LIB -DQT_CORE_LIB -I/workspace/third_party/libs/qt-5.2.0/mkspecs/linux-g++ -I../../../../../../src/shared/qbs/src/lib -I../../../../../../src/shared/qbs/src/lib -I../../../../../../src/shared/qbs/src -I/workspace/third_party/libs/qt-5.2.0/include -I/workspace/third_party/libs/qt-5.2.0/include/QtXml -I/workspace/third_party/libs/qt-5.2.0/include/QtScript -I/workspace/third_party/libs/qt-5.2.0/include/QtCore -I/workspace/third_party/sources/qt-creator-opensource-src-3.0.0/build/src/shared/qbs/src/lib -I. -o project.o ../../../../../../src/shared/qbs/src/lib/api/project.cpp
cc1plus: warnings being treated as errors
In file included from /workspace/third_party/libs/qt-5.2.0/include/QtCore/qobject.h:56,
/workspace/third_party/libs/qt-5.2.0/include/QtCore/qbytearray.h: In function ‘int qRegisterNormalizedMetaType(const QByteArray&, T*, typename QtPrivate::MetaTypeDefinedHelper<T, (QMetaTypeId2::Defined && (! QMetaTypeId2::IsBuiltIn))>::DefinedType) [with T = qbs::Internal::InternalJob*]’:
/workspace/third_party/libs/qt-5.2.0/include/QtCore/qbytearray.h:446: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/workspace/third_party/libs/qt-5.2.0/include/QtCore/qbytearray.h:451: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/workspace/third_party/libs/qt-5.2.0/include/QtCore/qarraydata.h:104: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/workspace/third_party/libs/qt-5.2.0/include/QtCore/qgenericatomic.h:96: error: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
/workspace/third_party/libs/qt-5.2.0/include/QtCore/qbytearray.h:408: note: initialized from here
make: *** [project.o] Error 1
make: Leaving directory
/workspace/third_party/sources/qt-creator-opensource-src-3.0.0/build/src/shared/qbs/src/lib' make: *** [sub----shared-qbs-src-lib-make_first] Error 2 make: Leaving directory/workspace/third_party/sources/qt-creator-opensource-src-3.0.0/build/src/libs'
make: *** [sub-libs-make_first-ordered] Error 2
make: Leaving directory `/workspace/third_party/sources/qt-creator-opensource-src-3.0.0/build/src'
make: *** [sub-src-make_first-ordered] Error 2
The quick work around is removing -Werror or -O2 from Makefile in your src/shared/qbs/src/lib directory. I've seen people mentioned that different versions of gcc treat aliasing differently.
Thank you for your answer. I definitely think this is compiler related. CentOS's gcc is a bit old.
Btw, any idea if this could be C++11 related? I had to compile Qt with --no-c++11 since CentOS does not support C++11 yet, but I couldn't find any similar option for Qt Creator.
is there any solution to this?
i'm having the same issue