Unsolved QMYSQL driver not loaded on ArchLinux!!!
-
Hello,
I have this problem when connecting to Qt 5 with MySQL on ArchLinux. When I try to connect QMYSQL, I get this error:
QMetaObject::connectSlotsByName: No matching signal for on_btnAddProduct_clicked() QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE Connect Fail!
I've been doing research in a lot of places/forums but I have not found a result. Generally there are solutions for Ubuntu and Windows. How can I fix this?
Useful things:
Qt Base: 5.11.0
I installed MySQL from:
pacman -S mariadb https://wiki.archlinux.org/index.php/MySQL
cd /usr/lib/qt/plugins/sqldrivers/ libqsqlibase.so libqsqlmysql.so libqsqlpsql.so libqsqlite.so libqsqlodbc.so libqsqltds.so
ldd libqsqlmysql.so linux-vdso.so.1 (0x00007fff53974000) libQt5Sql.so.5 => /usr/lib/libQt5Sql.so.5 (0x00007fc352c76000) libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x00007fc352576000) libmysqlclient.so.18 => /usr/lib/libmysqlclient.so.18 (0x00007fc351feb000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fc351c62000) libc.so.6 => /usr/lib/libc.so.6 (0x00007fc3518a6000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fc351688000) libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007fc351401000) libz.so.1 => /usr/lib/libz.so.1 (0x00007fc3511ea000) libicui18n.so.61 => /usr/lib/libicui18n.so.61 (0x00007fc350d3f000) libicuuc.so.61 => /usr/lib/libicuuc.so.61 (0x00007fc350985000) libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0x00007fc35070e000) libdouble-conversion.so.1 => /usr/lib/libdouble-conversion.so.1 (0x00007fc3504fe000) libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fc3502fa000) libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fc34ffe3000) libm.so.6 => /usr/lib/libm.so.6 (0x00007fc34fc4e000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fc34fa36000) /usr/lib64/ld-linux-x86-64.so.2 (0x00007fc3530d4000) libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007fc34f7cc000) libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fc34f34f000) librt.so.1 => /usr/lib/librt.so.1 (0x00007fc34f147000) liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007fc34ef21000) liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007fc34ed0a000) libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007fc34e9ee000) libicudata.so.61 => /usr/lib/libicudata.so.61 (0x00007fc34ce49000) libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007fc34cbd7000) libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007fc34c9b7000)
My .pro file:
QT += core gui QT += sql QTPLUGIN += qsqlmysql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = ProductManagementTool TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS INCLUDEPATH += /usr/include/mysql \ /usr/lib/qt/plugins/sqldrivers \
MariaDB is already running:
+-------------------------+-----------------------------+ | Variable_name | Value | +-------------------------+-----------------------------+ | innodb_version | 5.6.39-83.1 | | protocol_version | 10 | | slave_type_conversions | | | version | 10.1.33-MariaDB | | version_comment | MariaDB Server | | version_compile_machine | x86_64 | | version_compile_os | Linux | | version_malloc_library | system | | version_ssl_library | OpenSSL 1.1.0h 27 Mar 2018 | | wsrep_patch_version | wsrep_25.23 | +-------------------------+-----------------------------+
Thanks... :)
-
Hi and welcome to devnet,
What do you get if you run your application with the
QT_DEBUG_PLUGINS
environment variable set to 1 ? -
Hi,
Sorry, I am newbie at Qt. I can't figure out where I should define QT_DEBUG_PLUGINS. In my .pro file's DEFINES section or Build & Run Kits's Environment section? I am using Qt Creator 4.6.1.
Edit: Here is my fully qmake .pro && make and ./ run output: https://paste.ee/p/IzHA5
-
Hi
its on linux you would do ( in shell)
export QT_DEBUG_PLUGINS=1
/path/yourappit then dumps status over plugin loading.
(update: i though you meant when deployed)
-
You can do that in the Run part of the Project panel in Qt Creator.
-
I added QT_DEBUG_PLUGINS=1 argument to Run -> Command Line Argument and I now see my variable in Run Environment section. Variable: QT_DEBUG_PLUGINS, Value: 1. But I don't know where I should be see the Debug output. I checked all possible Run Output windows and Terminal outputs. Where to see the output that needs me?
Edit: Did you checked my https://paste.ee/p/IzHA5 output? Is that exactly what you want?
-
I ran it but not worked: cp -R /usr/lib/qt/plugins/sqldrivers/ /home/dentrax/anaconda3/plugins/sqldrivers/
I don't know why it uses anaconda's sqldrivers.Edit: I added /usr/bin/qmake under the Qt Versions section and changed my Kits's Qt Version to it. Now I get this error insted of "not loaded" error when I am connecting to MySQL: Access denied for user 'root'@'arch' (using password: YES) QMYSQL: Unable to connect Am I on the right way?
Edit2: I changed my host name from "arch" to "localhost" and I connected successfully to database now. The whole problem is the anaconda. Why did not Qt warn me? Like "Warning: You are using anaconda's qmake, you should use system's qmake (/usr/bin/qmake)" I hope this problem is fixed. Thank you guys. :) Have a nice day.
[dentrax@arch ProductManagementTool]$ export QT_DEBUG_PLUGINS=1 [dentrax@arch ProductManagementTool]$ ./ProductManagementTool DBController QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/platforms" ... QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/platforms/libqminimal.so" Found metadata in lib /home/dentrax/anaconda3/plugins/platforms/libqminimal.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("minimal") QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/platforms/libqoffscreen.so" Found metadata in lib /home/dentrax/anaconda3/plugins/platforms/libqoffscreen.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("offscreen") QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/platforms/libqxcb.so" Found metadata in lib /home/dentrax/anaconda3/plugins/platforms/libqxcb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "xcb" ] }, "className": "QXcbIntegrationPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("xcb") QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/platforms" ... loaded library "/home/dentrax/anaconda3/plugins/platforms/libqxcb.so" loaded library "Xcursor" QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/xcbglintegrations" ... QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/xcbglintegrations/libqxcb-glx-integration.so" Found metadata in lib /home/dentrax/anaconda3/plugins/xcbglintegrations/libqxcb-glx-integration.so, metadata= { "IID": "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5", "MetaData": { "Keys": [ "xcb_glx" ] }, "className": "QXcbGlxIntegrationPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("xcb_glx") QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/xcbglintegrations" ... loaded library "/home/dentrax/anaconda3/plugins/xcbglintegrations/libqxcb-glx-integration.so" QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/platformthemes" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/platformthemes" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/platforminputcontexts" ... QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" Found metadata in lib /home/dentrax/anaconda3/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata= { "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1", "MetaData": { "Keys": [ "compose", "xim" ] }, "className": "QComposePlatformInputContextPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("compose", "xim") QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so" Found metadata in lib /home/dentrax/anaconda3/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so, metadata= { "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1", "MetaData": { "Keys": [ "ibus" ] }, "className": "QIbusPlatformInputContextPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("ibus") QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/platforminputcontexts" ... loaded library "/home/dentrax/anaconda3/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/styles" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/styles" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/accessible" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/accessiblebridge" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/accessiblebridge" ... QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/iconengines" ... QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/iconengines/libqsvgicon.so" Found metadata in lib /home/dentrax/anaconda3/plugins/iconengines/libqsvgicon.so, metadata= { "IID": "org.qt-project.Qt.QIconEngineFactoryInterface", "MetaData": { "Keys": [ "svg", "svgz", "svg.gz" ] }, "className": "QSvgIconPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("svg", "svgz", "svg.gz") QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/iconengines" ... QMetaObject::connectSlotsByName: No matching signal for on_btnAddProduct_clicked() QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/anaconda3/plugins/sqldrivers" ... QFactoryLoader::QFactoryLoader() looking at "/home/dentrax/anaconda3/plugins/sqldrivers/libqsqlite.so" Found metadata in lib /home/dentrax/anaconda3/plugins/sqldrivers/libqsqlite.so, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QSQLITE" ] }, "className": "QSQLiteDriverPlugin", "debug": false, "version": 329218 } Got keys from plugin meta data ("QSQLITE") QFactoryLoader::QFactoryLoader() checking directory path "/home/dentrax/Documents/Projects/Qt/ProductManagementTool/sqldrivers" ... QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE Connect Fail!QLibraryPrivate::unload succeeded on "/home/dentrax/anaconda3/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" QLibraryPrivate::unload succeeded on "/home/dentrax/anaconda3/plugins/xcbglintegrations/libqxcb-glx-integration.so" QLibraryPrivate::unload succeeded on "/home/dentrax/anaconda3/plugins/platforms/libqxcb.so" Segmentation fault (core dumped)
-
From the looks of it you are mixing two different versions of Qt.
On that seems to be provided by Arch and the other by conda.
The
ldd
command you ran was on the Arch provided Qt which should be working properly while the one that fails is the one from conda. You should runldd
on your conda Qt MySQL plugin to see what's going on there.