Solved Qt plugins MySQL in Raspbian
-
Hi and welcome to devnet,
You can't use the installer on the Raspberry Pi. The Pi uses an ARM processor and the installers are build of x86/x86_64.
Did you compile Qt for raspbian or are you using a package from the distribution ?
-
@SGaist Im using packages from the distribution. And i try to compil with Qt src and MySQL
-
I just re-read your qmake line to build the plugin. You have a space between -L and your path which is wrong. The -L and -l options both require to have their argument right after.
-
@SGaist I do it again and no error, after the command make install. He said he creat the lib .so on $PathOfQt5/plugins/
And when i tried to run my app he said again QSQLDatabase QMYSQL driver not loaded
& QSQLDatabase : available drivers : QSQLITECan i use the lib for ubuntu 14.0.4 for my raspberry ?
-
No you can't, they are not from the same architecture. You have to compile the plugin with the Qt you are using for your RPi.
-
@SGaist Ok, i do it and not work at all...
with the same error in Qt ...QSQLDatabase QMYSQL driver not loaded
& QSQLDatabase : available drivers : QSQLITE -
Did you check that the plugin was properly installed in your device ?
-
@SGaist Yep he did. Should i copy/paste on my debug folder ?
-
He did ? Who's that ?
What do you mean by
copy/past on my debug folder
? -
-
No, they should be in Qt's installation folder under
plugins/sqldrivers/
-
@SGaist Yeah, they are in the folder sqldrivers as you said. I really don't know how to help you with some indications... :/
-
What do you get if your run
ldd libqsqlmysql.so
on your RPi ? -
@SGaist I got this :
pi@raspberrypi:/usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers $ ldd libqsqlmysql.so
linux-vdso.so.1 (0x7ec39000)
/usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76f42000)
libmysqlclient.so.18 => /usr/lib/arm-linux-gnueabihf/libmysqlclient.so.18 (0x76c1a000)
libQt5Sql.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Sql.so.5 (0x76bd4000)
libQt5Core.so.5 => /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 (0x7674f000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76673000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76532000)
/lib/ld-linux-armhf.so.3 (0x54b8f000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76509000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x764e2000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x764cf000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76454000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76427000)
libicui18n.so.52 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.52 (0x76266000)
libicuuc.so.52 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.52 (0x7611e000)
libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0x7601b000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x76004000)
libicudata.so.52 => /usr/lib/arm-linux-gnueabihf/libicudata.so.52 (0x74987000)
libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0x74913000) -
Looks fine… Can you start your application with
QT_DEBUG_PLUGINS=1
? To see what happens when your application loads the plugins. -
@SGaist I go this about Qt plugins for mysql :
Got keys from plugin meta data ("QSQLITE") QFactoryLoader::QFactoryLoader() looking at "/usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlmysql.so" Found metadata in lib /usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlmysql.so, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL3", "QMYSQL" ] }, "className": "QMYSQLDriverPlugin", "debug": false, "version": 328450 } Got keys from plugin meta data ("QMYSQL3", "QMYSQL") QFactoryLoader::QFactoryLoader() looking at "/usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlpsql.so" Found metadata in lib /usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlpsql.so, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "className": "QPSQLDriverPlugin", "debug": false, "version": 328960 } In /usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlpsql.so: Plugin uses incompatible Qt library (5.5.0) [release] "Le plugin '/usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlpsql.so' utilise une bibliothèque Qt incompatible. (5.5.0) [release]" not a plugin QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/sqldrivers" ... loaded library "/usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlite.so"
-
Looks like you either have two different version of Qt installed or you build your plugin with a different version of Qt than the one you originally built.
-
@SGaist Ok, i will try a new install of Qt with this tutorial https://wiki.qt.io/RaspberryPi2EGLFS
Then a new install of MySql header & lib files. I will inform you about progress of this. I hate Qt on raspbian (joke ofc) :D -
Hello,
I know this thread is old but I came here with the same problem and managed to solve it.
By installing libqt5sql5-mysql with $ apt-get install libqt5sql5-mysql
Happy coding ! :)