Do you have those static plugins built?
Do you have those static plugins built?
hey thanks for replying,
I do have the -qt-sql-mysql driver and plugin specified. all seems correct.
I'm asking if the static plugin file is the sqldrivers directory. BTW. -qt-sql-mysql and -plugin-sql-mysql are exclusive. The first compiles mysql support directly into Qt library whereas the second one builds a static plugin. Please check if any of your Qt libraries depends on the mysql client library.
ah, sorry about that,
according to the documentation, it seems that I do. I have the libqsqlmysql.a in the plugin/sqldrivers directory.
Being a newbies I don't know how to check if any library depends on mysqlclient. after reading other forum, I assume that it does, other suggested to include -L/usr/lib/mysql -lmysqlclient
after doing that, I have a different error:
" /usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient"
I checked and there exist under /usr/lib/sql both the libmysqlclient.so and .a
this stuff is beyond my knowledge, I hope you can help.
thanks
Run ldd on every Qt library (QtCore and QtSql being the most obvious ones) and see if "libmysqlclient" is there.
khikho (19th January 2009)
I finally figured this out, for future user, here is correct way to do this step by step:
How to use static plugin in qt: example for mysql
1) ./configure -static -plugin-sql-mysql ... and many other switch as you wish,
2) make sure your project file look as follow:
Template = app
TARGET = executable
QT += core sql
CONFIG += static
QTPLUGIN += qsqlmysql
LIBS += -L/usr/lib64/mysql -lmysqlclient ( use /usr/lib/mysql for 32 bit system )
source += main.cpp
3) make sure your file have the macro that look as followed:
#include <QtCore>
#include <QSqlDatabase>
#include <QtPlugin>
QT_IMPORT_PLUGIN( qsqlmysql )
int main( int argc, char** argv )
{
QCoreApplication app( argc, argc );
QSqlDatabase db = QSqlDatabase::addDatabase( "MYSQL" );
qDebug() << QSqlDatabase::drivers();
return 0;
}
This will give you a working example to push ahead.
4) for using mysql driver as share object, just recompile qt as follow
./configure -qt-sql-mysql ... and many other switch
5) use QSqlDatabase as in step 3 without the PLUGIN macro.
Last edited by khikho; 19th January 2009 at 23:05.
Bookmarks