qtheader

Including wrong Qt version headers


I am trying to install QT Creator from source on Centos 6. I have installed (what I think are) the Qt5 libraries onto my system using yum. When I check which rpm's are installed I see

[qt-creator-2.8.1-src]# rpm -qa | grep qt
qt5-qtbase-x11-5.1.1-3.el6.x86_64
qt-4.6.2-26.el6_4.x86_64
qt-sqlite-4.6.2-26.el6_4.x86_64
qt-x11-4.6.2-26.el6_4.x86_64
qt5-qtbase-5.1.1-3.el6.x86_64
ibus-qt-1.3.0-2.el6.x86_64
qt3-3.3.8b-30.el6.x86_64
qt5-qtbase-devel-5.1.1-3.el6.x86_64
qt-devel-4.6.2-26.el6_4.x86_64
qt3-devel-3.3.8b-30.el6.x86_64

So qt5 seems to be installed, but so is qt4 and qt3 (perhaps required by some other apps, but this is a pretty plain system). So now I've downloaded the QT Creator source, and am trying to compile. I gave the full path the qt5 qmake (/usr/lib64/qt5/bin/qmake qtcreator.pro) and that worked. But now when I issue the command make I see:

[qt-creator-2.8.1-src]# make
cd src/ && ( test -e Makefile || /usr/lib64/qt5/bin/qmake /usr/src/qtcreator/qt-creator-2.8.1-src/src/src.pro -o Makefile ) && make -f Makefile 
make[1]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
cd libs && make -f Makefile
make[2]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs'
cd aggregation && make -f Makefile
make[3]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs/aggregation'
g++ -c -pipe -Wall -W -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC  -DAGGREGATION_LIBRARY -DQT_NO_DEBUG -DQT_SHARED -DQT_TABLET_SUPPORT -DQT_THREAD_SUPPORT -I/usr/lib64/qt-3.3/mkspecs/default -I. -I/src -I\ -I/usr/lib64/qt-3.3/include -o aggregate.o aggregate.cpp
In file included from aggregate.h:33,
                 from aggregate.cpp:30:
aggregation_global.h:33:21: error: qglobal.h: No such file or directory
In file included from aggregate.cpp:30:
aggregate.h:35:19: error: QObject: No such file or directory
aggregate.h:36:17: error: QList: No such file or directory
aggregate.h:37:17: error: QHash: No such file or directory
aggregate.h:38:26: error: QReadWriteLock: No such file or directory
aggregate.h:39:23: error: QReadLocker: No such file or directory
aggregate.cpp:32:24: error: QWriteLocker: No such file or directory
aggregate.cpp:33:18: error: QDebug: No such file or directory
In file included from aggregate.cpp:30:
aggregate.h:43: error: expected initializer before ‘:’ token
aggregate.cpp:277: error: expected ‘}’ at end of input
make[3]: *** [aggregate.o] Error 1
make[3]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs/aggregation'
make[2]: *** [sub-aggregation] Error 2
make[2]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src/libs'
make[1]: *** [sub-libs] Error 2
make[1]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
make: *** [sub-src-make_first-ordered] Error 2

so it looks like make is including the qt 3.3 headers I/usr/lib64/qt-3.3/mkspecs/default). How do I tell make or qmake to use the Qt5 headers/libraries?


I remove the qt3-devel package as suggested below, and now my error changes to:

cd src/ && ( test -e Makefile || /opt/Qt/5.1.1/gcc_64/bin/qmake /usr/src/qtcreator/qt-creator-2.8.1-src/src/src.pro -o Makefile ) && make -f Makefile 
make[1]: Entering directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
make[1]: *** No rule to make target `/usr/lib64/qt-3.3/mkspecs/default/qmake.conf', needed by `Makefile'.  Stop.
make[1]: Leaving directory `/usr/src/qtcreator/qt-creator-2.8.1-src/src'
make: *** [sub-src-make_first-ordered] Error 2

as you can see make is still referencing the qt3 stuff.


Solution

  • The solution for those encountering the same:

    1. Remove qt3-devel
    2. Install qt5-* (otherwise the make process will complain about missing items). You can probably be more selective but after 10 time install individual packages based on make complains, I just put them all in.
    3. run qmake giving the full path to the qt5 version of qmake
    4. run 'qmake -r' not 'qmake qtcreator.pro'