Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QtCharts version 2.5 not found
I have an error message that I cannot solve. Any help would be highly appreciated. When I run one of my programs, I get an error:
qrc:/qml/statsview.qml:3:1: module "QtCharts" version 2.5 is not installed
This is qml file:
/ SPDX-License-Identifier: GPL-2.0
import QtQuick 2.5
import QtCharts 2.5
resulting in a crash. The back trace includes:
Thread 1 "subsurface" received signal SIGSEGV, Segmentation fault. 0x00007ffff5cc769c in QObject::property(char const*) const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (gdb) backtrace #0 0x00007ffff5cc769c in QObject::property(char const*) const () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
I assume it is a dependency that is not met. Where should I look? What would be a remedy?
Kind regards, willemf.
Do you have that module installed ?
willem[~/src/Qt]$ locate libQt5Core
It's QtCharts missing that is complained about.
If you are using Qt installed in system (as it appears from your errors), you can install QtCharts using this line (on debian-like distros):
sudo apt install libqt5charts5-dev
QtCharts is a separate module, different from QtCore. It even has different license (no LGPL!).
Building dependency tree
Reading state information... Done
libqt5charts5-dev is already the newest version (5.12.8-0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
@willemf Before you posted something like this: /home/willem/src/Qt/5.15.0/gcc_64/lib/libQt5Core.so.5.15
Is this the Qt installation you are using? Or do you use Qt from your Linux distribution?
Thank you for your sharp observation. Ubuntu 20.04 comes with Qt5.12, but I needed 5.15. The default Qt in Ubuntu is dispersed over a number of directories. There is no maintenance tool, which makes it very difficult to manage the default installed Qt. The Qt website instructions prefers to have the whole of Qt in a single directory. So I installed Qt 5.15 in a separate directory (src/Qt), explicitly including QtCharts (which I confirmed using the maintenance tool). I changed my system path to include the path to qmake in Qt5.15, which in my case is:
I suspect (BUT I m not sure) that qmake sees the QCharts within the 5.12 system default setup (which is probably qCharts V 2.0) and not the QCharts in the 5.15 installation (which is probably QCharts V 2.5). This may be at the core of my problem.
Do not modify your PATH like that. When you want to use specific version of Qt, always use the full path to the corresponding qmake executable.
That said, you wrote about Src which corresponds to the sources of Qt. Are you sure you installed the pre-built version somewhere ?
willemf last edited by willemf
Please be a bit more explicit? The addition to the path shown above is indeed the full path name to the qmake executable. I probably misunderstand you. Please give an example? My Qt is 5.15, downloaded from the Qt website and installed in /home/willem/src/Qt/5.15.0
What I meant is: do not add path to build tools like that to your PATH. When calling qmake, use the full path to it as part of your command call. Modifying your PATH like that, you can be sure that at some point you will think that you are using one version of qmake while in fact using another and have a hard time debugging that.
As for QtCharts, IIRC, it's a module that you have to explicitly check in either the installer or the maintenance tool.