Help with mysql driver @ os x
I'm trying to install the mysql driver in OS X 1.6.4
I was reading the documentation, it seem easy. I compiled and install it, first time the $QTDIR env-var was not right, even corrected it, QT still not found the driver.
libqsqlmysql.dylib and libqsqlmysql_debug.dylib are both present in /Developer/Applications/Qt/plugins/sqldrivers
Can anybody help me?
Is the directory in the library search path?
You can check with the following code snippet:
int main( int argc, char ** argv )
qDebug() << QCoreApplication::libraryPaths()
The output should contain "/Developer/Applications/Qt/plugins" (the sqldrivers part is added autmatically).
I tried, the output is:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL
/Users/elminster/arti/arti.app/Contents/MacOS/arti finalizó retornando 0
The files are in the directory, i tried even use the QPluginLoader, it do not work.
It's posible i builded the files in the wrong way?
Are the mysql libs available? You can check with
otool -L /Developer/Applications/Qt/plugins/sqldrivers/libqsqlmysql.dylib
The output is:
otool -L /Developer/Applications/Qt/plugins/sqldrivers/libqsqlmysql.dylib/Developer/Applications/Qt/plugins/sqldrivers/libqsqlmysql.dylib: libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
libmysql.16.dylib (compatibility version 16.0.0, current version 16.0.0)
QtSql.framework/Versions/4/QtSql (compatibility version 4.6.0, current version 4.6.2)
QtCore.framework/Versions/4/QtCore (compatibility version 4.6.0, current version 4.6.2)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 103.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
There is no path with the mysql library (libmysql.16.dylib). Are you sure this lib is in your library search path?
You can search for the lib using locate, and try to add the directory of the lib to DYLD_LIBRARY_PATH
I had the same problem.
I'm using this script to build the plugin:
then you must relink the plugin using command
install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib libqsqlmysql.dylib
This is a good solution for a local install but not for deploying apps. In this case you should link using the @executable_path
One more information, the plugin builded on MacOS 10.6 is a 64bits edition (linked to the 64bits MySQL lib). You can not configure your app to be 32/64bits.
CONFIG *= x86 x86_64
to your project file, will cause the plugin to be non-loadable.
[EDIT: fixed code markup, Volker]
similar problem here: