Qt version in centos7

10,408

Solution 1

I edited the file .bash_profile as export QTDIR=/usr/local/Trolltech/Qt-4.8.2 export PATH=$QTDIR/bin:$PATH after removing qt3 and now its working fine.

Solution 2

Qt is designed to support multiple parallel installations. I usually have dozens on my systems - multiple versions, targets, configurations.

It's on you to select the version of qmake that represents the Qt installation you're wishing to use. There's a 1:1 mapping between a qmake binary and a Qt installation.

To find all qmake binaries on your system, you can e.g. $ locate qmake | grep bin

The version of qmake present in your PATH is of no consequence, generally speaking, since for any given project you only need to invoke qmake directly once - you do so by giving the full path to the qmake in the install of Qt you're using in the build. Subsequent invocations are done via make qmake_all. I personally find no need for qmake in the PATH at all - it's too easy to run wrong one by mistake.

To recap, for any given project, you'd do:

set CPUS=$(grep -c ^processor /proc/cpuinfo)
mkdir build-projectFoo
cd build-projectFoo
/path/to/Qt/bin/qmake ../projectFoo-src
# no need to call qmake directly from this point onwards
make -j$CPUS
... (modifications to sources, project files, etc.)
make qmake_all && make -j$CPUS
Share:
10,408
mars21al
Author by

mars21al

Updated on June 04, 2022

Comments

  • mars21al
    mars21al almost 2 years

    I am using centos 7. To check the version of qt installed I am using the command qmake --version which returns

    Qmake version: 1.07a (Qt 3.3.8b).
    Qmake is free software from Trolltech ASA.
    

    However when I give the command yum install qt, I get the message

    Package 1:qt-4.8.5-13.el7.x86_64 already installed and latest version.
    Nothing to do.
    

    I am not sure which version of qt is installed in my system! I need to have a qt version > 4.7.

    • Paul Rooney
      Paul Rooney about 7 years
      you may have multiple versions. Perhaps the qmake on your path is symlink to a specific version. There may be a proper way to set a different one. I don't know much about Qt though, so I cant be sure.
    • tambre
      tambre about 7 years
      Well it says qt-4.8.5-13.el7.x86_64 is installed. I'd assume that's v4.8.5.
  • mars21al
    mars21al about 7 years
    I am using CentOS as a workstation.The command ` yum list qt*` returns "Error: No matching Packages to list", whereis qmake gives "qmake: /usr/lib64/qt-3.3/bin/qmake" and rpm -ql qt gives the list of several packages of qt-4.8.5
  • Danyright
    Danyright about 7 years
    Ok. What packages are marked as installed with rpm -ql qt? Apparently you have qt-3.3 installed. If you don't need it, I would recommend remove it to avoid interference with qt-4.8.
  • mars21al
    mars21al about 7 years
    "/usr/bin/qdbus /usr/lib64/libQtCore.so.4 /usr/lib64/libQtCore.so.4.8 /usr/lib64/libQtCore.so.4.8.5 /usr/lib64/libQtDBus.so.4 /usr/lib64/libQtDBus.so.4.8 /usr/lib64/libQtDBus.so.4.8.5 /usr/lib64/libQtNetwork.so.4 /usr/lib64/libQtNetwork.so.4.8 /usr/lib64/libQtNetwork.so.4.8.5" ... and so on.Do I need to change the path of qmake?I mean I want whereis qmake command should return qt4 directory instead of qt3.3.How to change that?
  • Danyright
    Danyright about 7 years
    Check the response. I just added further information to setup an additional Qt Version in Qt Creator
  • Danyright
    Danyright about 7 years
    Sorry I wasn't clear in my previous comment - you should see a whole bunch of packages with yum list qt* (execute as root), including qt, qt3 and qt5 packages (I just tested it on a CentOS install). Since you apparently have qt3 installed, you could also run # yum remove qt3 to uninstall it
  • Danyright
    Danyright about 7 years
    Oh and by the way, you can find the 4.8 qmake with this command: $ rpm -ql qt | grep qmake. So you will probably get something like /usr/lib64/qt-4.8/bin/qmake ?
  • Danyright
    Danyright about 7 years
    That is very surprising... Well you can 1. try to uninstall qt3 as mentioned in my previous command, and 2. if that doesn't work, just add an additional Qt Version to Qt Creator by following the steps I described
  • mars21al
    mars21al about 7 years
    I removed qt3,now on giving the qmake command it returns "bash: /usr/lib64/qt-3.3/bin/qmake: No such file or directory".Since qt4 is installed in my system how to change the path of qmake from its default path of qt3.3 to qt 4.8?
  • Danyright
    Danyright about 7 years
    A reboot should be enough to refresh your PATH and give you the right qmake reference
  • mars21al
    mars21al almost 7 years
    I edited the file .bash_profile as export QTDIR=/usr/local/Trolltech/Qt-4.8.2 export PATH=$QTDIR/bin:$PATH after removing qt3 and now its working fine.
  • Danyright
    Danyright almost 7 years
    Glad you were able to fix it. You should mark the correct answer as such. And if you don't consider my answer to be the best one, I'd appreciate an upvote nonetheless ;-) Thanks!
  • Kuba hasn't forgotten Monica
    Kuba hasn't forgotten Monica over 6 years
    @AMB You need to install it on your system then. It usually comes preinstalled in even minimal installs, but perhaps on your system it isn't. What distro do you have? On CentOS you'd install it via yum install slocate or sudo you install slocate depending on whether you use root user or the safer sudo.