how to change the qtversion in shell/default for system
-
So I'm attempting to build some libs from source code since I can't find them in my computer. An example is:
KDBusService
from the kde api. It is found in the KDBusAddons class. It can be cloned hereSo running:
$ git clone git@invent.kde.org:frameworks/kdbusaddons.git $ cd kdbusaddons ~/kdbusaddons$ ls autotests CMakeLists.txt KF5DBusAddonsConfig.cmake.in KF5DBusAddonsMacros.cmake KF5dbus.service.in LICENSES MAINTAINER metainfo.yaml README.md src tests ~/kdbusaddons$ cmake CMakeLists.txt
gives me the following error output
-- The C compiler identification is GNU 9.3.0 -- The CXX compiler identification is GNU 9.3.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Installing in /usr/local. Run /home/paul/kdbusaddons/prefix.sh to set the environment for KDBusAddons. -- Setting build type to 'Debug' as none was specified. -- Looking for __GLIBC__ -- Looking for __GLIBC__ - found -- Performing Test _OFFT_IS_64BIT -- Performing Test _OFFT_IS_64BIT - Success -- Performing Test HAVE_DATE_TIME -- Performing Test HAVE_DATE_TIME - Success -- Performing Test BSYMBOLICFUNCTIONS_AVAILABLE -- Performing Test BSYMBOLICFUNCTIONS_AVAILABLE - Success CMake Error at CMakeLists.txt:21 (find_package): Could not find a configuration file for package "Qt5DBus" that is compatible with requested version "5.15.0". The following configuration files were considered but not accepted: /usr/lib/x86_64-linux-gnu/cmake/Qt5DBus/Qt5DBusConfig.cmake, version: 5.12.8 /lib/x86_64-linux-gnu/cmake/Qt5DBus/Qt5DBusConfig.cmake, version: 5.12.8 -- Configuring incomplete, errors occurred! See also "/home/paul/kdbusaddons/CMakeFiles/CMakeOutput.log".
how do i change my qt version? i've been struggling. I need 5.15 and my default is 5.12.8. Apt pacakges don't't fix the issue.
-
Hi,
Did you install Qt 5.15 ?
If so then, then use
-DCMAKE_PREFIX_PATH=/path/to/5.15/lib/cmake
to point cmake to that version of Qt. -
So I tried to make and install the libs for 5.15.2 from the qt-everywhere-src-5.15.2 tar i downloaded from the qt site. i tried to follow the README instructions but the make finished with some errors. After running your command without any issues i still get this from a
qmake -query
QT_SYSROOT: QT_INSTALL_PREFIX:/usr QT_INSTALL_ARCHDATA:/usr/lib/x86_64-linux-gnu/qt5 QT_INSTALL_DATA:/usr/share/qt5 QT_INSTALL_DOCS:/usr/share/qt5/doc QT_INSTALL_HEADERS:/usr/include/x86_64-linux-gnu/qt5 QT_INSTALL_LIBS:/usr/lib/x86_64-linux-gnu QT_INSTALL_LIBEXECS:/usr/lib/x86_64-linux-gnu/qt5/libexec QT_INSTALL_BINS:/usr/lib/qt5/bin QT_INSTALL_TESTS:/usr/tests QT_INSTALL_PLUGINS:/usr/lib/x86_64-linux-gnu/qt5/plugins QT_INSTALL_IMPORTS:/usr/lib/x86_64-linux-gnu/qt5/imports QT_INSTALL_QML:/usr/lib/x86_64-linux-gnu/qt5/qml QT_INSTALL_TRANSLATIONS:/usr/share/qt5/translations QT_INSTALL_CONFIGURATION:/etc/xdg QT_INSTALL_EXAMPLES:/usr/lib/x86_64-linux-gnu/qt5/examples QT_INSTALL_DEMOS:/usr/lib/x86_64-linux-gnu/qt5/examples QT_HOST_PREFIX:/usr QT_HOST_DATA:/usr/lib/x86_64-linux-gnu/qt5 QT_HOST_BINS:/usr/lib/qt5/bin QT_HOST_LIBS:/usr/lib/x86_64-linux-gnu QMAKE_SPEC:linux-g++ QMAKE_XSPEC:linux-g++ QMAKE_VERSION:3.1 QT_VERSION:5.12.8
My qt version is still 5.12.8.
I also tried using the installer from the Qt source code site
-
After running your command without any issues i still get this from a qmake -query
You don't try to change the system default Qt, you explicitly select which Qt you use when you build your application. Multiple Qt versions can quite happily coexist.
If you run the system qmake executable then you get the system Qt settings, and any Makefile it builds will encapsulate those.
If you run the qmake executable in the Qt5.15 bin directory then you get the settings for that version of Qt, and any Makefile it builds will encapsulate those.Your original question relates to building an application using CMake, not qmake, and @SGaist offered a way to ensure that CMake finds relevant configuration files in the Qt 5.15 directory structure (after you install it if needed).
Since you mention trying/failing to build Qt 5.15 from source, can I suggest the binary installer from:
https://www.qt.io/download-open-sourceLate breaking news...
If you are a Ubuntu user:
https://packages.ubuntu.com/focal/libkf5dbusaddons5
looks like it circumvents the entire problem -
@SGaist said in how to change the qtversion in shell/default for system:
DCMAKE_PREFIX_PATH=
So I managed to install the latest version, 6.1.2 with the installer, but I'm not quite sure which exact directory needs to be used in the
DCMAKE_PREFIX_PATH
call. I have a
~/Qt/6.1.2/gcc_64/lib
and a~/Qt/6.1.2/gcc_64/bin
with a bunch of binaries from that installation. However, I'm not sure how theDCMAKE_PREFIX_PATH
command works.paul@pauls-computer:~/kdbusaddons$ DCMAKE_PREFIX_PATH=/home/paul/Qt/6.1.2/gcc_64/bin paul@pauls-computer:~/kdbusaddons$ DCMAKE_PREFIX_PATH=/home/paul/Qt/6.1.2/gcc_64/lib paul@pauls-computer:~/kdbusaddons$ cmake CMakeLists.txt -- Installing in /usr/local. Run /home/paul/kdbusaddons/prefix.sh to set the environment for KDBusAddons. CMake Error at CMakeLists.txt:21 (find_package): Could not find a configuration file for package "Qt5DBus" that is compatible with requested version "5.15.0". The following configuration files were considered but not accepted: /usr/lib/x86_64-linux-gnu/cmake/Qt5DBus/Qt5DBusConfig.cmake, version: 5.12.8 /lib/x86_64-linux-gnu/cmake/Qt5DBus/Qt5DBusConfig.cmake, version: 5.12.8 -- Configuring incomplete, errors occurred! See also "/home/paul/kdbusaddons/CMakeFiles/CMakeOutput.log". paul@pauls-computer:~/kdbusaddons$
Also, I have the libkf5dbusaddons5. Already do you know where the corresponding binaries might be for that? Perhaps if I knew where that was I could use those to help build my program.
eep it doesn't work. debugger was acting funky.
i think it's something i'll have to dive into with the devs of the app.
-
@ChrisW67 ok i copied that exactly, and it actually changed the output of the error code. So I think it actually worked. There were some other errors involving cmake. But I contacted the devs of the kdeconnect app and they suggest I use something called craft to build the application and test changes to code.
I'm gonna leave that last post as the solved answer, because it did work.