I am working on Linux and I have installed Qt Creator 2.5.2, Qt libraries 4.7.4 and 4.4.3 all from sources. I cannot install the binaries directly for incompatibility between versions. The installation processes for both Qt 4.7.4 and Qt 4.4.3 were the same. The issue I am facing is that Qt Creator recognizes Qt 4.7.4 but not Qt 4.4.3, with the error
The Qt version is invalid : Could not determine the path to the
binaries of the Qt installation, maybe the path is wrong.
Well each library is installed in /home/$username/qt/Qt-$version. When I manually compile a project with
cd directory
/home/$username/qt/Qt-4.4.3/qmake $PATHPRO
make
Everything work as a charm and I can run the app.
What did I tried?
Recompile Qt-4.4.3
Check the folder permissions
Restart Qt Creator
Smash my head on my desktop
Any thoughts? The OS is SUSE Enterprise 11-32bits.
Problem solved :D.
QtCreator find libraries by using some qmake properties. It query for these properties by executing the command qmake -query. The issue was that none of these variables were set in the Qt 4.4.3 library while they were present in the Qt 4.7.4 library.
So the solution is to set the properties using
home/$username/qt/Qt-4.4.3/bin/qmake -set VARIABLE VALUE
where value is usually a path to a directory
Variables in 4.7.4:
QT_INSTALL_PREFIX: home/$username/qt/Qt-4.7.4/
QT_INSTALL_DATA:
QT_INSTALL_DOCS:
QT_INSTALL_HEADERS:
QT_INSTALL_LIBS:
QT_INSTALL_BINS:
QT_INSTALL_PLUGINS:
QT_INSTALL_IMPORTS:
QT_INSTALL_TRANSLATIONS:
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:
QT_INSTALL_DEMOS:
QMAKE_MKSPECS:
QMAKE_VERSION:2.01a
QT_VERSION:4.7.4
I think the most important are QT_INSTALL_LIBS, QT_INSTALL_LIBS and QT_VERSION.
see configuring qmake environment.
Related
I'm trying to upgrade my project to Qt 5.9.2 since I believe Qt 5.9 has better C++17 compatibility than 5.5 (default in Ubuntu 16.04)
I installed 5.9.2 using the online installer in my home directory and set CMAKE_PREFIX_PATH to /home/karnik/Tools/Qt/5.9.2/gcc_64/libs/cmake but find_package(Qt5 5.9.2 COMPONENTS Widgets REQUIRED) reported the error,
CMake Error at CMakeLists.txt:75 (FIND_PACKAGE):
Could not find a configuration file for package "Qt5" that is compatible
with requested version "5.9".
The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake, version: 5.5.1
I also tried setting it to just /home/karnik/Tools/Qt/5.9.2
I then set Qt5_DIR inside my CMakeLists.txt to /home/karnik/Tools/Qt/5.9.2/gcc_64/lib/cmake/Qt5/ and the error got solved but MESSAGE("Qt Version is " ${Qt5Widgets_VERSION}) showed that it was still using 5.5.1.
I then set Qt5Widgets_DIR to /home/karnik/Tools/Qt/5.9.2/gcc_64/lib/cmake/Qt5Widgets/ and the version showed 5.9.2.
But weirdly, MESSAGE(${Qt5Widgets_INCLUDE_DIRS}) showed that it was still pointing to the old files inside /usr/include
/usr/include/x86_64-linux-gnu/qt5//usr/include/x86_64-linux-gnu/qt5/QtWidgets/usr/include/x86_64-linux-gnu/qt5/QtGui/usr/include/x86_64-linux-gnu/qt5/QtCore/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++-64/usr/include
How can I get it to point to the right libraries?
TIA!
I've installed fresh QtCreator and Qt 5.8 to my system.
As I understand there are 2 Qt toolchains right now on my PC: One in ~/Qt/5.8 (default path) and one is in usr/lib/x86_64-linux-gnu/qt5/bin where KDE stores it for own purposes. The one in /usr/lib/x86_64-linux-gnu/qt5/bin is version 5.7.
Ok, If I create a dummy project in Qt Creator then it'll allow me to choose only Qt 5.8 Kit. And if I do so I'll get Project ERROR: Unknown module(s) in QT: KF5DBusAddons on any KDE Frameworks module I want to link.
(I'm linking them by QT += KF5DBusAddons in .pro file)
It seems that's because Qt 5.8 don't know about KDE modules in /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/ because it looks into ~/Qt/5.8/gcc_64/mkspecs/modules/ instead. And there are no KDE modules. They are not suggested as an option in Qt Online Installer tool.
Fine, so I need either add a Qt5.7 from /usr/lib/x86_64-linux-gnu/ or install KDE Frameworks 5 on top of Qt 5.8. I've tried the first one and run into configuration problems. It still cann't see modules in /usr/lib/x86_64-linux-gnu/.
My question is: Is there a working tutorial on how to start with KDE Framework and Qt Creator. Can I stick with qmake toolchain and not cmake files? Or working explanation on how to add System Qt libraries as a Kit into QtCreator?
P.S. I'm trying to use /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf And my qmake result command line is qmake /home/user1/dev/kdbustest/kdbustest.pro -spec /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/ CONFIG+=debug && /usr/bin/make qmake_all
Qt creator has its own configuration for qt versions used in builds.
the config is in tools > options > build and run > Kits
Make sure the kit you have selected (e.g. Desktop) has the correct Qt version set.
If the qt version you want isn't in the dropdown, you can add it in the Qt Versions tab.
Also check you have the right kit selected to build your project (see the build configuration button - above the run/green play button)
The mkspec should be automatically set to use the system qt version and modules, but you can make sure by setting Qt mkspec (in tools > options > build and run > Kits) to /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/
After all this, you can verify the correct command is being run by looking at the compile compile output pane when running build > Run qmake.
I install the latest qt version from the official website http://www.qt.io/qt5-4/ successfully. I follow this tutorial http://sysads.co.uk/2014/05/install-qt-5-3-ubuntu-14-04 and install the qt 5.4 version. Besides, I have the Ubuntu repository version of qt 5.2.1 installed.
Now I want to make the default version of 5.4 due to a program can't work well in the old qt5 version. That is to say, when I start a program which need to use qt5 library the program will use the version 5.4 rather than the version qt 5.2. Though I have installed the version 5.4 and 5.2, the program still use qt 5.2 version.
I try to use qtchooser to choose the 5.4 version as the default option, however, the program installed in the system still use the qt 5.2 library.
I endeavor to modify the related files regarding qtchooser, nothing changes.
If the library version is not in some regular repository, I would strongly suggest not relying on the user to install it somehow from an "unofficial" install location. Or provide a package for the library version yourself to install alongside your application. But don't replace the system Qt version. That would be Bad®.
Instead, either compile your program with a specific rpath, or wrap your program in scripts that use something like LD_PRELOAD and/or LD_LIBRARY_PATH to load the library version you're shipping in your application package.
Both ways are clunky, and I would try to at least work around the Qt version bug if at all possible.
The latest Qt version (non-alpha) actually is Qt 5.5.
If you install it through the installer provided by Qt, you should change the default Qt version by editing/creating:
/etc/xdg/qtchooser/default.conf
which should contain first the bin directory, then the lib directory, for example:
/opt/Qt/5.5/gcc_64/bin
/opt/Qt/5.5/gcc_64/lib
At least this works for the qmake version. Otherwise you might need to change LD_LIBRARY_PATH as commented by rubenvb.
I'm using Linux Mint 16 and I got a problem.
I installed Qt Creator 5.2.1 from binary package, downloaded from Qt site. I don't have Qt Linguist... Also, I have installed qtcreator and qt5-dev-tools (or similar name) from repository, still no Linguist. Where I can download it?
I prefer binary version from Qt site because it's newer than version from repository.
It should be in the bin folder. You can always do this to figure it out:
find $installdir/ -name \*linguist\*
By the way, there is also another option: install Archlinux and get all the fancy latest stuff. ;-)
I have Qt 4.6.3 on Debian. I need version 4.8.1.
To install it I downloaded the Qt SDK 1.2.1 from the Qt site, where is said that it contains version 4.8.1
After installation I checked Qt version and it is 4.6.3 instead of expected 4.8.1.
What I am doing wrong? And how can I install 4.8.1?
First of all I recommend getting 'official' Debian Qt upgrades by adding the testing (wheezy) repo to your package manager, this way everything on your system will be updated seamlessly in a few clicks.
If you can't do this, then:
Use your package manager to uninstall the existing Qt installation (so that's the runtime libs, plugins, and Qt Creator).
Install the SDK anywhere you like, it installs under one folder anyway.
Update your $PATH to point to the directory with qtcreator, qmake, etc., there are numerous ways of doing this, the simplest is exporting the updated $PATH in your .bashrc. (And optionally make some nice shortcuts for your DE).
Create symlinks in /usr/lib (or /usr/lib64) to point to the Qt libraries the SDK provides, or add a qt.conf file containing the path in your /etc/ld.conf.so.d/ directory and run ldconfig as root.
I'm an openSUSE user myself, so some of the above may slightly different on Debian, hopefully someone with Debian experience can chime in if I'm incorrect.