October 14, 2010

elminster elminster
Lab Rat
2 posts

Help with mysql driver @ os x

 

Hello,

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?

8 replies

October 20, 2010

Volker Volker
Mad Scientist
5250 posts

Is the directory in the library search path?

You can check with the following code snippet:

  1. #include <QDebug>
  2.  
  3. int main( int argc, char ** argv )
  4. {
  5. // ...
  6. qDebug() << QCoreApplication::libraryPaths()
  7. // ...
  8. }

The output should contain “/Developer/Applications/Qt/plugins” (the sqldrivers part is added autmatically).

October 21, 2010

elminster elminster
Lab Rat
2 posts

I tried, the output is:

Iniciando /Users/elminster/arti/arti.app/Contents/MacOS/arti…
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL
(”/Developer/Applications/Qt/plugins”, “/Users/elminster/arti/arti.app/Contents/MacOS”)
/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?

October 21, 2010

Volker Volker
Mad Scientist
5250 posts

Are the mysql libs available? You can check with

  1. otool -L /Developer/Applications/Qt/plugins/sqldrivers/libqsqlmysql.dylib

October 22, 2010

elminster elminster
Lab Rat
2 posts

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)

October 22, 2010

Volker Volker
Mad Scientist
5250 posts

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

January 4, 2011

eric.maeker eric.maeker
Lab Rat
2 posts

I had the same problem.
I’m using this script to build the plugin:

http://code.google.com/p/freemedforms/source/browse/trunk/scripts/mac-create-mysql-plugin.sh

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

Eric
http://www.freemedforms.com

January 4, 2011

eric.maeker eric.maeker
Lab Rat
2 posts

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.

Adding:

  1. CONFIG *= x86 x86_64

to your project file, will cause the plugin to be non-loadable.

Eric

[EDIT: fixed code markup, Volker]

April 16, 2011

MAMartins MAMartins
Lab Rat
57 posts

similar problem here:
http://developer.qt.nokia.com/forums/viewthread/5258/
thanks

 
  ‹‹ [Solved] QT 4.6.(2 or 3) stalls on stallation at 85%.      Qt 4.7.0 error on make (invalid pointer to bit-field) ››

You must log in to post a reply. Not a member yet? Register here!