How do I change which version of Qt is used for qmake?
Multi tool use
I feel like there should be a simple way of doing this, but my googlefu is failing so I'd really appreciate some info on how to switch (or even permanently change) which version of Qt is used when doing qmake. If I ask which version I get the following:
~ $ qmake --version
QMake version 3.0
Using Qt version 5.0.1 in /usr/lib/x86_64-linux-gnu
I've install QtCreator, but I'm not sure where to go from here.
make qt qtcreator
add a comment |
I feel like there should be a simple way of doing this, but my googlefu is failing so I'd really appreciate some info on how to switch (or even permanently change) which version of Qt is used when doing qmake. If I ask which version I get the following:
~ $ qmake --version
QMake version 3.0
Using Qt version 5.0.1 in /usr/lib/x86_64-linux-gnu
I've install QtCreator, but I'm not sure where to go from here.
make qt qtcreator
add a comment |
I feel like there should be a simple way of doing this, but my googlefu is failing so I'd really appreciate some info on how to switch (or even permanently change) which version of Qt is used when doing qmake. If I ask which version I get the following:
~ $ qmake --version
QMake version 3.0
Using Qt version 5.0.1 in /usr/lib/x86_64-linux-gnu
I've install QtCreator, but I'm not sure where to go from here.
make qt qtcreator
I feel like there should be a simple way of doing this, but my googlefu is failing so I'd really appreciate some info on how to switch (or even permanently change) which version of Qt is used when doing qmake. If I ask which version I get the following:
~ $ qmake --version
QMake version 3.0
Using Qt version 5.0.1 in /usr/lib/x86_64-linux-gnu
I've install QtCreator, but I'm not sure where to go from here.
make qt qtcreator
make qt qtcreator
edited Feb 22 '14 at 0:50
Ramesh
23.6k34103184
23.6k34103184
asked Feb 21 '14 at 10:27
Tamsyn MichaelTamsyn Michael
258138
258138
add a comment |
add a comment |
7 Answers
7
active
oldest
votes
This isn't necessarily Unix/Linux specific, so you are probably better asking this on Stack Overflow. Never the less, QtCreator is usually quite good at detecting alternative Qt installs, just create a new project and look under the Projects
tab on the left. You can set different build configurations there. There should be a drop down box to select from the various installed versions for each configuration.
Otherwise, it seems to the QTDIR
environmental variable is used to set the Qt version. By default QtCreator sets this to /usr/share/qt4
for me, so setting it to the equivalent path (ie the one where the configuration files are) should make qmake build with a different version. You could test with something like:
QTDIR=/usr/share/qtX qmake --version
It may also be possible to set this in the .pro
file, but if so it is undocumented (as with quite a lot of qmake
variables).
Also, if you want to build with a specific major version, qmake
is usually just symlinked to a binary for the default major version. The real binaries are qmake-qt4
, qmake-qt5
etc. Also see man qtchooser
and the qtX-default
packages on Debian based systems.
Update
There is a bug with qtchooser
on Ubuntu 13.04 and 13.10 which seem to affect the way Qt applications detect different Qt versions, see https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/1177823. This may affect QtCreator also.
Thanks! I needed to use qmake-qt4 instead of the bald qmake - so easy, but I just couldn't find the info I needed. Thanks!
– Tamsyn Michael
Feb 22 '14 at 4:03
@TamsynMichael - Yes, on the linux side qmake in bin is just a symlink. So, if you used something like update-alternatives to switch back and forth, that might be ideal. It's not in update-alternatives, and things like the PyQt build scripts want a direct reference to the binary anyway - not a symlink.
– RobotHumans
Jan 27 '15 at 7:36
add a comment |
It helped me to use -qt=qt5
switch or QT_SELECT=qt5
environment variable.
$ 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
add a comment |
Under some distros like Debian Jessie Stable you can do the follow :
sudo apt-get install -y qt4-qmake qt4-dev-tools
sudo update-alternatives --install "/usr/bin/qmake" "qmake" "/usr/bin/qmake-qt4" 40
sudo update-alternatives --config qmake
And just select the version you need if you need change again just run again the third line.
add a comment |
qmake
(/usr/bin/qmake
) actually is just a symlink to qtchooser
(/usr/bin/qtchooser
).
Here is a quotation fromman qtchooser
:
FILES
/etc/xdg/qtchooser/default.conf
System-wide configuration files. Each has two lines, the first
is the path to the binaries and the second is the path to the Qt
libraries. If a default.conf is provided, the settings from it
will be automatically used in case nothing else is selected.
$HOME/.config/qtchooser/*.conf
User configuration files.
The file /etc/xdg/qtchooser/default.conf
has higher priority than /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
. Here are the steps of how to choose the default Qt version for qmake
on example of my system (Ubuntu 17.10 x64, Qt 5.10.1).
Create the /etc/xdg/qtchooser
directory:
sudo mkdir /etc/xdg/qtchooser
Create and edit the configuration file:
gksudo gedit /etc/xdg/qtchooser/default.conf
As said above. this file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it will be:
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close. Now qmake
should use the specified Qt version.
A symlink also works: sudo mkdir -p /etc/xdg/qtchooser && sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /etc/xdg/qtchooser/default.conf
– maharvey67
11 hours ago
add a comment |
There is a better method.
If you want to make your changes permanent, you need to modify the /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
file, which is a symlink to ../../../../share/qtchooser/qt4-x86_64-linux-gnu.conf
.
Here is an example for my system (Ubuntu 17.10 x64, Qt 5.10.1). I would suggest to keep both original symlink file and its target in place (in case you want to recover the original configuration). And also create the new files in the default locations (for consistency). So here are the steps:
Rename the symlink file:
sudo mv /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf_orig
Create a new target configuration file (with any name):
gksudo gedit /usr/share/qtchooser/my_Qt_5.10.1_Desktop_gcc_x64.conf
This file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it is
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close it. Create a symlink default.conf
to the new configuration file:
ln -s /usr/share/qtchooser/my_Qt_5.10.1_Destop_gcc_x64.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
Check your Qt version:
qmake --version
Now it should always use the specified version.
add a comment |
Many of the above answers will work. However I have personally found that none of them are persistent. E.g. I can run this command:
$ QT_SELECT=qt5 qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
But if I open a new terminal and check the Qt version it will revert to the default, and if you have multiple versions of Qt installed the default may not be the one you want. You can tell by running this command:
$ qtchooser -print-env
QT_SELECT="default"
QTTOOLDIR=...
QTLIBDIR=...
The only way to make your changes stick is to change the default version. To do this, edit /usr/lib/x86_64-linux-gnu/qtchooser/default.conf
and change this line:
/usr/lib/x86_64-linux-gnu/qt5/bin
Where you change qt5
to whatever version you want. You can use the command qtchooser -list-versions
to see what versions are installed on your machine.
add a comment |
In (my) default setup on Fedora 23 having both qt-3.3.8
and qt-4.8.5
environments it was also necessary to add the /usr/libxx/qt4/bin/
directory temporarily to the PATH
to allow the cmake
/qmake
packages to find the right version. This was necessary when building the code, not when running the finished QT4 app.
For some reason the QT3 path already was installed there permanently and unfortunately at the start of the PATH
, which prevented the QT version selector working properly.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f116254%2fhow-do-i-change-which-version-of-qt-is-used-for-qmake%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
This isn't necessarily Unix/Linux specific, so you are probably better asking this on Stack Overflow. Never the less, QtCreator is usually quite good at detecting alternative Qt installs, just create a new project and look under the Projects
tab on the left. You can set different build configurations there. There should be a drop down box to select from the various installed versions for each configuration.
Otherwise, it seems to the QTDIR
environmental variable is used to set the Qt version. By default QtCreator sets this to /usr/share/qt4
for me, so setting it to the equivalent path (ie the one where the configuration files are) should make qmake build with a different version. You could test with something like:
QTDIR=/usr/share/qtX qmake --version
It may also be possible to set this in the .pro
file, but if so it is undocumented (as with quite a lot of qmake
variables).
Also, if you want to build with a specific major version, qmake
is usually just symlinked to a binary for the default major version. The real binaries are qmake-qt4
, qmake-qt5
etc. Also see man qtchooser
and the qtX-default
packages on Debian based systems.
Update
There is a bug with qtchooser
on Ubuntu 13.04 and 13.10 which seem to affect the way Qt applications detect different Qt versions, see https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/1177823. This may affect QtCreator also.
Thanks! I needed to use qmake-qt4 instead of the bald qmake - so easy, but I just couldn't find the info I needed. Thanks!
– Tamsyn Michael
Feb 22 '14 at 4:03
@TamsynMichael - Yes, on the linux side qmake in bin is just a symlink. So, if you used something like update-alternatives to switch back and forth, that might be ideal. It's not in update-alternatives, and things like the PyQt build scripts want a direct reference to the binary anyway - not a symlink.
– RobotHumans
Jan 27 '15 at 7:36
add a comment |
This isn't necessarily Unix/Linux specific, so you are probably better asking this on Stack Overflow. Never the less, QtCreator is usually quite good at detecting alternative Qt installs, just create a new project and look under the Projects
tab on the left. You can set different build configurations there. There should be a drop down box to select from the various installed versions for each configuration.
Otherwise, it seems to the QTDIR
environmental variable is used to set the Qt version. By default QtCreator sets this to /usr/share/qt4
for me, so setting it to the equivalent path (ie the one where the configuration files are) should make qmake build with a different version. You could test with something like:
QTDIR=/usr/share/qtX qmake --version
It may also be possible to set this in the .pro
file, but if so it is undocumented (as with quite a lot of qmake
variables).
Also, if you want to build with a specific major version, qmake
is usually just symlinked to a binary for the default major version. The real binaries are qmake-qt4
, qmake-qt5
etc. Also see man qtchooser
and the qtX-default
packages on Debian based systems.
Update
There is a bug with qtchooser
on Ubuntu 13.04 and 13.10 which seem to affect the way Qt applications detect different Qt versions, see https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/1177823. This may affect QtCreator also.
Thanks! I needed to use qmake-qt4 instead of the bald qmake - so easy, but I just couldn't find the info I needed. Thanks!
– Tamsyn Michael
Feb 22 '14 at 4:03
@TamsynMichael - Yes, on the linux side qmake in bin is just a symlink. So, if you used something like update-alternatives to switch back and forth, that might be ideal. It's not in update-alternatives, and things like the PyQt build scripts want a direct reference to the binary anyway - not a symlink.
– RobotHumans
Jan 27 '15 at 7:36
add a comment |
This isn't necessarily Unix/Linux specific, so you are probably better asking this on Stack Overflow. Never the less, QtCreator is usually quite good at detecting alternative Qt installs, just create a new project and look under the Projects
tab on the left. You can set different build configurations there. There should be a drop down box to select from the various installed versions for each configuration.
Otherwise, it seems to the QTDIR
environmental variable is used to set the Qt version. By default QtCreator sets this to /usr/share/qt4
for me, so setting it to the equivalent path (ie the one where the configuration files are) should make qmake build with a different version. You could test with something like:
QTDIR=/usr/share/qtX qmake --version
It may also be possible to set this in the .pro
file, but if so it is undocumented (as with quite a lot of qmake
variables).
Also, if you want to build with a specific major version, qmake
is usually just symlinked to a binary for the default major version. The real binaries are qmake-qt4
, qmake-qt5
etc. Also see man qtchooser
and the qtX-default
packages on Debian based systems.
Update
There is a bug with qtchooser
on Ubuntu 13.04 and 13.10 which seem to affect the way Qt applications detect different Qt versions, see https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/1177823. This may affect QtCreator also.
This isn't necessarily Unix/Linux specific, so you are probably better asking this on Stack Overflow. Never the less, QtCreator is usually quite good at detecting alternative Qt installs, just create a new project and look under the Projects
tab on the left. You can set different build configurations there. There should be a drop down box to select from the various installed versions for each configuration.
Otherwise, it seems to the QTDIR
environmental variable is used to set the Qt version. By default QtCreator sets this to /usr/share/qt4
for me, so setting it to the equivalent path (ie the one where the configuration files are) should make qmake build with a different version. You could test with something like:
QTDIR=/usr/share/qtX qmake --version
It may also be possible to set this in the .pro
file, but if so it is undocumented (as with quite a lot of qmake
variables).
Also, if you want to build with a specific major version, qmake
is usually just symlinked to a binary for the default major version. The real binaries are qmake-qt4
, qmake-qt5
etc. Also see man qtchooser
and the qtX-default
packages on Debian based systems.
Update
There is a bug with qtchooser
on Ubuntu 13.04 and 13.10 which seem to affect the way Qt applications detect different Qt versions, see https://bugs.launchpad.net/ubuntu/+source/qt4-x11/+bug/1177823. This may affect QtCreator also.
edited Feb 22 '14 at 0:20
answered Feb 21 '14 at 11:44
GraemeGraeme
25.2k46599
25.2k46599
Thanks! I needed to use qmake-qt4 instead of the bald qmake - so easy, but I just couldn't find the info I needed. Thanks!
– Tamsyn Michael
Feb 22 '14 at 4:03
@TamsynMichael - Yes, on the linux side qmake in bin is just a symlink. So, if you used something like update-alternatives to switch back and forth, that might be ideal. It's not in update-alternatives, and things like the PyQt build scripts want a direct reference to the binary anyway - not a symlink.
– RobotHumans
Jan 27 '15 at 7:36
add a comment |
Thanks! I needed to use qmake-qt4 instead of the bald qmake - so easy, but I just couldn't find the info I needed. Thanks!
– Tamsyn Michael
Feb 22 '14 at 4:03
@TamsynMichael - Yes, on the linux side qmake in bin is just a symlink. So, if you used something like update-alternatives to switch back and forth, that might be ideal. It's not in update-alternatives, and things like the PyQt build scripts want a direct reference to the binary anyway - not a symlink.
– RobotHumans
Jan 27 '15 at 7:36
Thanks! I needed to use qmake-qt4 instead of the bald qmake - so easy, but I just couldn't find the info I needed. Thanks!
– Tamsyn Michael
Feb 22 '14 at 4:03
Thanks! I needed to use qmake-qt4 instead of the bald qmake - so easy, but I just couldn't find the info I needed. Thanks!
– Tamsyn Michael
Feb 22 '14 at 4:03
@TamsynMichael - Yes, on the linux side qmake in bin is just a symlink. So, if you used something like update-alternatives to switch back and forth, that might be ideal. It's not in update-alternatives, and things like the PyQt build scripts want a direct reference to the binary anyway - not a symlink.
– RobotHumans
Jan 27 '15 at 7:36
@TamsynMichael - Yes, on the linux side qmake in bin is just a symlink. So, if you used something like update-alternatives to switch back and forth, that might be ideal. It's not in update-alternatives, and things like the PyQt build scripts want a direct reference to the binary anyway - not a symlink.
– RobotHumans
Jan 27 '15 at 7:36
add a comment |
It helped me to use -qt=qt5
switch or QT_SELECT=qt5
environment variable.
$ 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
add a comment |
It helped me to use -qt=qt5
switch or QT_SELECT=qt5
environment variable.
$ 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
add a comment |
It helped me to use -qt=qt5
switch or QT_SELECT=qt5
environment variable.
$ 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
It helped me to use -qt=qt5
switch or QT_SELECT=qt5
environment variable.
$ 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
edited Feb 23 '17 at 10:45
answered Oct 5 '15 at 9:33
pevikpevik
608514
608514
add a comment |
add a comment |
Under some distros like Debian Jessie Stable you can do the follow :
sudo apt-get install -y qt4-qmake qt4-dev-tools
sudo update-alternatives --install "/usr/bin/qmake" "qmake" "/usr/bin/qmake-qt4" 40
sudo update-alternatives --config qmake
And just select the version you need if you need change again just run again the third line.
add a comment |
Under some distros like Debian Jessie Stable you can do the follow :
sudo apt-get install -y qt4-qmake qt4-dev-tools
sudo update-alternatives --install "/usr/bin/qmake" "qmake" "/usr/bin/qmake-qt4" 40
sudo update-alternatives --config qmake
And just select the version you need if you need change again just run again the third line.
add a comment |
Under some distros like Debian Jessie Stable you can do the follow :
sudo apt-get install -y qt4-qmake qt4-dev-tools
sudo update-alternatives --install "/usr/bin/qmake" "qmake" "/usr/bin/qmake-qt4" 40
sudo update-alternatives --config qmake
And just select the version you need if you need change again just run again the third line.
Under some distros like Debian Jessie Stable you can do the follow :
sudo apt-get install -y qt4-qmake qt4-dev-tools
sudo update-alternatives --install "/usr/bin/qmake" "qmake" "/usr/bin/qmake-qt4" 40
sudo update-alternatives --config qmake
And just select the version you need if you need change again just run again the third line.
answered Nov 5 '16 at 7:34
inukazeinukaze
18112
18112
add a comment |
add a comment |
qmake
(/usr/bin/qmake
) actually is just a symlink to qtchooser
(/usr/bin/qtchooser
).
Here is a quotation fromman qtchooser
:
FILES
/etc/xdg/qtchooser/default.conf
System-wide configuration files. Each has two lines, the first
is the path to the binaries and the second is the path to the Qt
libraries. If a default.conf is provided, the settings from it
will be automatically used in case nothing else is selected.
$HOME/.config/qtchooser/*.conf
User configuration files.
The file /etc/xdg/qtchooser/default.conf
has higher priority than /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
. Here are the steps of how to choose the default Qt version for qmake
on example of my system (Ubuntu 17.10 x64, Qt 5.10.1).
Create the /etc/xdg/qtchooser
directory:
sudo mkdir /etc/xdg/qtchooser
Create and edit the configuration file:
gksudo gedit /etc/xdg/qtchooser/default.conf
As said above. this file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it will be:
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close. Now qmake
should use the specified Qt version.
A symlink also works: sudo mkdir -p /etc/xdg/qtchooser && sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /etc/xdg/qtchooser/default.conf
– maharvey67
11 hours ago
add a comment |
qmake
(/usr/bin/qmake
) actually is just a symlink to qtchooser
(/usr/bin/qtchooser
).
Here is a quotation fromman qtchooser
:
FILES
/etc/xdg/qtchooser/default.conf
System-wide configuration files. Each has two lines, the first
is the path to the binaries and the second is the path to the Qt
libraries. If a default.conf is provided, the settings from it
will be automatically used in case nothing else is selected.
$HOME/.config/qtchooser/*.conf
User configuration files.
The file /etc/xdg/qtchooser/default.conf
has higher priority than /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
. Here are the steps of how to choose the default Qt version for qmake
on example of my system (Ubuntu 17.10 x64, Qt 5.10.1).
Create the /etc/xdg/qtchooser
directory:
sudo mkdir /etc/xdg/qtchooser
Create and edit the configuration file:
gksudo gedit /etc/xdg/qtchooser/default.conf
As said above. this file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it will be:
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close. Now qmake
should use the specified Qt version.
A symlink also works: sudo mkdir -p /etc/xdg/qtchooser && sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /etc/xdg/qtchooser/default.conf
– maharvey67
11 hours ago
add a comment |
qmake
(/usr/bin/qmake
) actually is just a symlink to qtchooser
(/usr/bin/qtchooser
).
Here is a quotation fromman qtchooser
:
FILES
/etc/xdg/qtchooser/default.conf
System-wide configuration files. Each has two lines, the first
is the path to the binaries and the second is the path to the Qt
libraries. If a default.conf is provided, the settings from it
will be automatically used in case nothing else is selected.
$HOME/.config/qtchooser/*.conf
User configuration files.
The file /etc/xdg/qtchooser/default.conf
has higher priority than /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
. Here are the steps of how to choose the default Qt version for qmake
on example of my system (Ubuntu 17.10 x64, Qt 5.10.1).
Create the /etc/xdg/qtchooser
directory:
sudo mkdir /etc/xdg/qtchooser
Create and edit the configuration file:
gksudo gedit /etc/xdg/qtchooser/default.conf
As said above. this file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it will be:
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close. Now qmake
should use the specified Qt version.
qmake
(/usr/bin/qmake
) actually is just a symlink to qtchooser
(/usr/bin/qtchooser
).
Here is a quotation fromman qtchooser
:
FILES
/etc/xdg/qtchooser/default.conf
System-wide configuration files. Each has two lines, the first
is the path to the binaries and the second is the path to the Qt
libraries. If a default.conf is provided, the settings from it
will be automatically used in case nothing else is selected.
$HOME/.config/qtchooser/*.conf
User configuration files.
The file /etc/xdg/qtchooser/default.conf
has higher priority than /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
. Here are the steps of how to choose the default Qt version for qmake
on example of my system (Ubuntu 17.10 x64, Qt 5.10.1).
Create the /etc/xdg/qtchooser
directory:
sudo mkdir /etc/xdg/qtchooser
Create and edit the configuration file:
gksudo gedit /etc/xdg/qtchooser/default.conf
As said above. this file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it will be:
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close. Now qmake
should use the specified Qt version.
answered Mar 1 '18 at 4:38
vstepaniukvstepaniuk
413
413
A symlink also works: sudo mkdir -p /etc/xdg/qtchooser && sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /etc/xdg/qtchooser/default.conf
– maharvey67
11 hours ago
add a comment |
A symlink also works: sudo mkdir -p /etc/xdg/qtchooser && sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /etc/xdg/qtchooser/default.conf
– maharvey67
11 hours ago
A symlink also works: sudo mkdir -p /etc/xdg/qtchooser && sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /etc/xdg/qtchooser/default.conf
– maharvey67
11 hours ago
A symlink also works: sudo mkdir -p /etc/xdg/qtchooser && sudo ln -s /usr/share/qtchooser/qt5-x86_64-linux-gnu.conf /etc/xdg/qtchooser/default.conf
– maharvey67
11 hours ago
add a comment |
There is a better method.
If you want to make your changes permanent, you need to modify the /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
file, which is a symlink to ../../../../share/qtchooser/qt4-x86_64-linux-gnu.conf
.
Here is an example for my system (Ubuntu 17.10 x64, Qt 5.10.1). I would suggest to keep both original symlink file and its target in place (in case you want to recover the original configuration). And also create the new files in the default locations (for consistency). So here are the steps:
Rename the symlink file:
sudo mv /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf_orig
Create a new target configuration file (with any name):
gksudo gedit /usr/share/qtchooser/my_Qt_5.10.1_Desktop_gcc_x64.conf
This file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it is
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close it. Create a symlink default.conf
to the new configuration file:
ln -s /usr/share/qtchooser/my_Qt_5.10.1_Destop_gcc_x64.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
Check your Qt version:
qmake --version
Now it should always use the specified version.
add a comment |
There is a better method.
If you want to make your changes permanent, you need to modify the /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
file, which is a symlink to ../../../../share/qtchooser/qt4-x86_64-linux-gnu.conf
.
Here is an example for my system (Ubuntu 17.10 x64, Qt 5.10.1). I would suggest to keep both original symlink file and its target in place (in case you want to recover the original configuration). And also create the new files in the default locations (for consistency). So here are the steps:
Rename the symlink file:
sudo mv /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf_orig
Create a new target configuration file (with any name):
gksudo gedit /usr/share/qtchooser/my_Qt_5.10.1_Desktop_gcc_x64.conf
This file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it is
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close it. Create a symlink default.conf
to the new configuration file:
ln -s /usr/share/qtchooser/my_Qt_5.10.1_Destop_gcc_x64.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
Check your Qt version:
qmake --version
Now it should always use the specified version.
add a comment |
There is a better method.
If you want to make your changes permanent, you need to modify the /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
file, which is a symlink to ../../../../share/qtchooser/qt4-x86_64-linux-gnu.conf
.
Here is an example for my system (Ubuntu 17.10 x64, Qt 5.10.1). I would suggest to keep both original symlink file and its target in place (in case you want to recover the original configuration). And also create the new files in the default locations (for consistency). So here are the steps:
Rename the symlink file:
sudo mv /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf_orig
Create a new target configuration file (with any name):
gksudo gedit /usr/share/qtchooser/my_Qt_5.10.1_Desktop_gcc_x64.conf
This file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it is
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close it. Create a symlink default.conf
to the new configuration file:
ln -s /usr/share/qtchooser/my_Qt_5.10.1_Destop_gcc_x64.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
Check your Qt version:
qmake --version
Now it should always use the specified version.
There is a better method.
If you want to make your changes permanent, you need to modify the /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
file, which is a symlink to ../../../../share/qtchooser/qt4-x86_64-linux-gnu.conf
.
Here is an example for my system (Ubuntu 17.10 x64, Qt 5.10.1). I would suggest to keep both original symlink file and its target in place (in case you want to recover the original configuration). And also create the new files in the default locations (for consistency). So here are the steps:
Rename the symlink file:
sudo mv /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf_orig
Create a new target configuration file (with any name):
gksudo gedit /usr/share/qtchooser/my_Qt_5.10.1_Desktop_gcc_x64.conf
This file must contain two lines: the first line is the path to the Qt binaries (including qmake) and the second is the path to the Qt libraries (including .so files). In my case it is
<Qt_dir>/5.10.1/gcc_64/bin
<Qt_dir>/5.10.1/gcc_64/lib
Save it and close it. Create a symlink default.conf
to the new configuration file:
ln -s /usr/share/qtchooser/my_Qt_5.10.1_Destop_gcc_x64.conf /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
Check your Qt version:
qmake --version
Now it should always use the specified version.
edited 20 mins ago
answered Mar 1 '18 at 3:00
vstepaniukvstepaniuk
413
413
add a comment |
add a comment |
Many of the above answers will work. However I have personally found that none of them are persistent. E.g. I can run this command:
$ QT_SELECT=qt5 qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
But if I open a new terminal and check the Qt version it will revert to the default, and if you have multiple versions of Qt installed the default may not be the one you want. You can tell by running this command:
$ qtchooser -print-env
QT_SELECT="default"
QTTOOLDIR=...
QTLIBDIR=...
The only way to make your changes stick is to change the default version. To do this, edit /usr/lib/x86_64-linux-gnu/qtchooser/default.conf
and change this line:
/usr/lib/x86_64-linux-gnu/qt5/bin
Where you change qt5
to whatever version you want. You can use the command qtchooser -list-versions
to see what versions are installed on your machine.
add a comment |
Many of the above answers will work. However I have personally found that none of them are persistent. E.g. I can run this command:
$ QT_SELECT=qt5 qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
But if I open a new terminal and check the Qt version it will revert to the default, and if you have multiple versions of Qt installed the default may not be the one you want. You can tell by running this command:
$ qtchooser -print-env
QT_SELECT="default"
QTTOOLDIR=...
QTLIBDIR=...
The only way to make your changes stick is to change the default version. To do this, edit /usr/lib/x86_64-linux-gnu/qtchooser/default.conf
and change this line:
/usr/lib/x86_64-linux-gnu/qt5/bin
Where you change qt5
to whatever version you want. You can use the command qtchooser -list-versions
to see what versions are installed on your machine.
add a comment |
Many of the above answers will work. However I have personally found that none of them are persistent. E.g. I can run this command:
$ QT_SELECT=qt5 qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
But if I open a new terminal and check the Qt version it will revert to the default, and if you have multiple versions of Qt installed the default may not be the one you want. You can tell by running this command:
$ qtchooser -print-env
QT_SELECT="default"
QTTOOLDIR=...
QTLIBDIR=...
The only way to make your changes stick is to change the default version. To do this, edit /usr/lib/x86_64-linux-gnu/qtchooser/default.conf
and change this line:
/usr/lib/x86_64-linux-gnu/qt5/bin
Where you change qt5
to whatever version you want. You can use the command qtchooser -list-versions
to see what versions are installed on your machine.
Many of the above answers will work. However I have personally found that none of them are persistent. E.g. I can run this command:
$ QT_SELECT=qt5 qmake --version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu
But if I open a new terminal and check the Qt version it will revert to the default, and if you have multiple versions of Qt installed the default may not be the one you want. You can tell by running this command:
$ qtchooser -print-env
QT_SELECT="default"
QTTOOLDIR=...
QTLIBDIR=...
The only way to make your changes stick is to change the default version. To do this, edit /usr/lib/x86_64-linux-gnu/qtchooser/default.conf
and change this line:
/usr/lib/x86_64-linux-gnu/qt5/bin
Where you change qt5
to whatever version you want. You can use the command qtchooser -list-versions
to see what versions are installed on your machine.
answered Jul 31 '17 at 2:07
MattMatt
112
112
add a comment |
add a comment |
In (my) default setup on Fedora 23 having both qt-3.3.8
and qt-4.8.5
environments it was also necessary to add the /usr/libxx/qt4/bin/
directory temporarily to the PATH
to allow the cmake
/qmake
packages to find the right version. This was necessary when building the code, not when running the finished QT4 app.
For some reason the QT3 path already was installed there permanently and unfortunately at the start of the PATH
, which prevented the QT version selector working properly.
add a comment |
In (my) default setup on Fedora 23 having both qt-3.3.8
and qt-4.8.5
environments it was also necessary to add the /usr/libxx/qt4/bin/
directory temporarily to the PATH
to allow the cmake
/qmake
packages to find the right version. This was necessary when building the code, not when running the finished QT4 app.
For some reason the QT3 path already was installed there permanently and unfortunately at the start of the PATH
, which prevented the QT version selector working properly.
add a comment |
In (my) default setup on Fedora 23 having both qt-3.3.8
and qt-4.8.5
environments it was also necessary to add the /usr/libxx/qt4/bin/
directory temporarily to the PATH
to allow the cmake
/qmake
packages to find the right version. This was necessary when building the code, not when running the finished QT4 app.
For some reason the QT3 path already was installed there permanently and unfortunately at the start of the PATH
, which prevented the QT version selector working properly.
In (my) default setup on Fedora 23 having both qt-3.3.8
and qt-4.8.5
environments it was also necessary to add the /usr/libxx/qt4/bin/
directory temporarily to the PATH
to allow the cmake
/qmake
packages to find the right version. This was necessary when building the code, not when running the finished QT4 app.
For some reason the QT3 path already was installed there permanently and unfortunately at the start of the PATH
, which prevented the QT version selector working properly.
edited Apr 19 '16 at 11:50
roaima
44.7k655121
44.7k655121
answered Apr 19 '16 at 11:31
GunnarGunnar
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f116254%2fhow-do-i-change-which-version-of-qt-is-used-for-qmake%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
xmN2Owva rvJIBORVxg0FtRgj,7iquJweum0u5La TkSilrwMWDpn,9HTUUE,RACtL,b5g KfXdL74,T4hWITdX3Bz92Btjbja5 P8HBl l6E