qtchooser - a wrapper used to select between Qt development binary(2种方法)

-----------------------------------------------------------------------------------------------------------

http://manpages.ubuntu.com/manpages/wily/man1/qtchooser.1.html

Replace Default Qt version paths in:

/usr/lib/x86_64-linux-gnu/qtchooser/default.conf
or in newer releases /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf:

/opt/Qt5/bin
/opt/Qt5/lib

Check:

qtchooser -print-env

Reference: man qtchooser

http://askubuntu.com/questions/435564/qt5-installation-and-path-configuration

 

-----------------------------------------------------------------------------------------------------------

QTDIR=/usr/share/qtX qmake --version


qmake --version
QMake version 2.01a
Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu

qmake -qt=qt5 --version
QMake version 3.0
Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu

QT_SELECT=qt5 qmake --version
QMake version 3.0
Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu

 

http://unix.stackexchange.com/questions/116254/how-do-i-change-which-version-of-qt-is-used-for-qmake

 

-----------------------------------------------------------------------------------------------------------

https://harishnavnit.wordpress.com/2014/03/24/handling-multiple-versions-of-qt/

If you’re interested in knowing the current version of Qt that you’re using, open up a terminal and type in the command

1
qmake -v

Qt is something that you’ll definitely require if you’re using or more precisely developing KDE applications. Not only is the KDE SC written in Qt but most applications require different versions of Qt (If I’m not wrong, Digikam and Plasma Media Center required differing versions of Qt).
I know for sure that Plasma Media Center requires Qt4 and I also built the IDE Qt creator (which requires Qt 5.0.2 or so) from source. I was also able build Project Tox which required Qt version 5.2.0 and nothing less. So, I think it’s quite obvious that you might encounter a situation wherein you have more than one Qt version and you have to then choose between the right one. This is however a bit tricky.

To check the different versions of Qt installed on your system, type in the command

1
qtchooser -list-versions

. Here’s the output on my system

1
2
3
4
5
6
➜ ~ git:(master) ✗ qtchooser -list-versions
 qt4
 qt5-x86_64-linux-gnu
 5
 qt5
 default

I obviously had a torrid time in trying to configure the appropriate versions for different applications. I thought that using the “qtchooser” command would be enough to get this problem sorted out but unfortunately there doesn’t seem to be one solid article out in the web that describes the exact usage of the command “qtchooser” and the man page for the same doesn’t really help much in my honest opinion(IMHO).

So while looking through various articles and trying different combinations etc , I finally came across one article [1] that finally solved my issues and in the end it turned out to be quite simple. So, whenever you want to switch to a version of Qt you needn’t really fiddle with the “qtchooser” command, but you can open up a terminal and type in this

1
export QT_SELECT = <desired Qt version>

As mentioned earlier, you can choose the appropriate version from the output of the command “qtchooser -list-versions”. Here’s how things look like in my system after playing around with these commands.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
➜ ~ git:(master) ✗ qmake -v
QMake version 2.01a
Using Qt version 4.8.4 in /usr/lib/x86_64-linux-gnu
➜ ~ git:(master) ✗ qtchooser -list-versions
qt4
qt5-x86_64-linux-gnu
5
qt5
default
➜ ~ git:(master) ✗ export QT_SELECT = 5
zsh: bad assignment
➜ ~ git:(master) ✗ export QT_SELECT = qt5
zsh: bad assignment
➜ ~ git:(master) ✗ export QT_SELECT=qt5
➜ ~ git:(master) ✗ qmake -v
QMake version 3.0
Using Qt version 5.0.2 in /usr/lib/x86_64-linux-gnu
➜ ~ git:(master) ✗ export QT_SELECT=5
➜ ~ git:(master) ✗ qmake -v
QMake version 3.0
Using Qt version 5.0.2 in /usr/lib/x86_64-linux-gnu
➜ ~ git:(master) ✗ export QT_SELECT=qt5-x86_64-linux-gnu
➜ ~ git:(master) ✗ qmake -v
QMake version 3.0
Using Qt version 5.0.2 in /usr/lib/x86_64-linux-gnu
➜ ~ git:(master) ✗ echo "returning back to the stable version --> qt4"
returning back to the stable version --> qt4
➜ ~ git:(master) ✗ export QT_SELECT=qt4
➜ ~ git:(master) ✗ qmake -v
QMake version 2.01a
Using Qt version 4.8.4 in /usr/lib/x86_64-linux-gnu

and that ladies and gentleman, is how you switch between different versions of Qt !

Thank you.

[1] http://www.linuxfromscratch.org/blfs/view/7.4/general/qtchooser.html

posted @ 2017-01-10 22:20  findumars  Views(491)  Comments(0Edit  收藏  举报