You are not logged in.
Hi,
I want to get started with Qt and I made a Qt installation for Qt5 and Qt6 following the Arch wiki. I want to use Qt6 and cmake. I think a fresh start should be done with the latest version and not with a legacy version.
Unfortunately I can't find a way to setup QtCreator for Qt6. If I create a new project it uses Qt5. I can't figure out how to change that. I followed the documentation but that does not work:
https://doc.qt.io/qtcreator/creator-project-cmake.html
There is no kit auto detected. There is only a manual configuration which points to Qt5. I can't figure out how to change that configuration to Qt6.
Qt6 is installed and working - if I manually edit the generated CMakeList.txt and set it to Qt6 Cmake will use Qt6 (I checked that with ldd).
Offline
qtcreator appears to look for qmake in PATH .
/usr/bin/qmake on archlinux is is the qt5 version, qt6 uses /usr/bin/qmake6 .
Next to the Kits tab there's a 'QT versions' tab, click that and add /usr/bin/qmake6 manually .
That will give you the option to choose between qt5 and qt6 for projects.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
I have already tried this (found this hint some time ago). However this only affects qmake projects. Cmake simply ignores all changes and sticks with Qt5.
Offline
Then we'll have to convince cmake to use qt6 .
Try the following :
ensure qt versions lists qt6
on kits tab , add a new manual kit called cmake-with-qt6
set the qt version for this kit to qt6
create a new project
once you reach the part were you can select kits, choose cmake-with-qt6 .
verify if this new project does use qt6 .
If not , you may have to hardcode qt6 paths in 'cmake configuration' of the cmake-with-qt6 kit .
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
If not , you may have to hardcode qt6 paths in 'cmake configuration' of the cmake-with-qt6 kit .
I tried everything else - nothing worked. Unfortunately I couldn't figure out how to hardcode the path in in the cmake configuration.
Finally I renamed /usr/lib/cmake/Qt5 so that QtCreator can't find it and now it uses Qt6 automatically.
This is a terrible hack.
The other alternative is to manually edit CMakeList.txt and remove Qt5 from find_package().
I think, I will use the latter option.
Both solutions are not what I'd expect from a working installation. Is this an Arch issue because this contradicts the Qt documentation?
Last edited by rennradler (2023-01-21 08:32:39)
Offline
Archlinux does things its own way which often differs from how other *nixes like debian, ubunut ,suse and fedora do it.
(a wellknown example is that we were the first distro that set python by default to python3, years before other distros did. This broke lots of python2 scripts that assumed python always meant python2)
Over time I have noticed that cmake find_package often fails on archlinux.
I also noticed that the best way for cmake to find things on archlinux is to tell find_package to use pkgconfig .
Unfortunately this needs to be done by upstream and pkgconfig is either not available on or rarely used outside of linux.
I am not aware of any software intended for cross-platform use that does combine pkgconfig with cmake find_package .
Is this an arch issue ?
Possibly, though to me it feels more like one of the things that make archlinux unique.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
To use qt6
Go to
Edit > Preferences... > Kits > Qt Versions
'Add' /bin/qmake6
To enable toolkit
Go to
Edit > Preferences... > Kits > Kits
'Clone' Desktop
click on "Clone of Desktop"
Edit the Qt Version to be "Qt 6.x.x.x ()"
Try setting "Clone of Desktop" as default to use Qt6
Last edited by Samey_007 (2024-01-01 11:22:12)
Offline
I faced the same problem. Selecting /usr/bin/qmake6 in "Qt Versions" and "Qt 6.7.0 (System)" in Desktop Kit works only for projects with "qmake" build system. Projects with "CMake" build system ignore it for some reason.
However, it's possible to build CMake project with Qt6 from command line by configuring with:
$ cmake -DQT_DIR=/usr/lib/cmake/Qt6 ..
Offline