Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Getting qtchooser to recognize Qt version >=5.6 to use with qmake



  • Background: I'm an engineer but a novice Linux user on Ubuntu 16.04. I'm trying to use some code from a github repository that states it requires Qt >=5.6 to compile.
    Using sudo apt-get install qt5-qmake only installs Qt version 5.5, i.e.

    :~$ qmake -v
    QMake version 3.0
    Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu
    

    The only way I found to install Qt >=5.6 was to use the open source installer at https://www.qt.io/download. Using that, I installed Qt 5.6 (as well as 5.11) to the default location, home/username/Qt.

    However, qtchooser apparently doesn't recognize any of the versions installed via the qt.io installer, i.e.

    :~$ qtchooser -l
    4
    5
    default
    qt4-x86_64-linux-gnu
    qt4
    qt5-x86_64-linux-gnu
    qt5
    

    and if I change the version (via QT_SELECT=qt5 or such), it only points to the version installed with apt-get (Qt version 5.5.1).

    I tried export QTLIBDIR=$HOME/Qt/5.6/gcc_64 so that qtchooser would know where to find the qmake for 5.6, but it seems to just ignore it, i.e. I still get

    ~$ qmake --version
    QMake version 3.0
    Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu
    

    I've found older answers elsewhere that state to add a qt56.conf or similar file to /usr/lib/x86_64-linux-gnu/qtchooser with the right folders, which I assumed was

    $HOME/Qt/5.6/gcc_64/bin
    $HOME/Qt/5.6/gcc_64
    

    However, after creating the file with the above contents in the same location at the other .conf files, it does now list qt56 as an option with qtchooser -l but when selecting QT_SELECT=qt56, it simpy reverts to the default (`QT_SELECT="default").

    Summary question: How do I enable qtchooser to recognize the versions of Qt installed with the qt.io installer?


  • Moderators

    Do you really need qtchooser? If you installed Qt from official installer, you can:

    • open your project in Qt Creator and easily compile/ develop from there
    • from command line, just use export PATH=/path/to/your/qt/installation/qtversion/gcc_64/bin:$PATH and then correct qmake will be used. Then compiling your app is simple: qmake && make

Log in to reply