On a Gentoo system, I get the notorious Qt mysql error:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
false
This has numerous posts on various forums, some of which are unresolved.
Simple code to reproduce the error is given in e.g. http://adamcavendish.is-programmer.com/posts/40431.html
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setDatabaseName("test");
db.setUserName("test");
db.setPassword("xxxxxxxxxx");
bool ok = db.open();
qDebug() << ok;
db.close();
MainWindow w;
w.show();
return a.exec();
}
I have in my project .pro file:
QT += sql
There are no compiler errors. However, as the link http://adamcavendish.is-programmer.com/posts/40431.html suggests, my issue is of this type:
Using ldd I see that:
$ ldd libqsqlmysql.so
./libqsqlmysql.so: /usr/lib64/libmysqlclient_r.so.16: version `libmysqlclient_16’ not found (required by ./libqsqlmysql.so)
Simply giving it this file as a symlink to the newer version (18) doesn’t work.
So in other words I’m assuming I need to recompile this libqsqlmysql.so to use the newer version?
How do I go about compiling the new version?
According to qtcreator/5.4/Src/README it is stated that: “A typical `configure; make’ build process is used.”
I do configure (in qtcreator/5.4/Src), everything seems fine.
I do make, and I get:
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NO_TRANSLATION -DQT_QMAKE_LOCATION=\”/usr/bin/qmake\” -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4 -I. -o qlatincodec.o ../../corelib/codecs/qlatincodec.cpp
../../corelib/codecs/qlatincodec.cpp:35:19: fatal error: qlist.h: No such file or directory
#include “qlist.h”
I’ve tried the following versions:
Qt Creator 3.1.2 (opensource) Based on Qt 5.3.1 (GCC 4.6.1, 64 bit)
Qt Creator 3.3.1 (opensource) Based on Qt 5.4.1 (GCC 4.6.1, 64 bit)
↧