QMYSQL driver not loaded (but built)



  • I followed this guide (http://www.seppemagiels.com/blog/create-mysql-driver-qt-windows) and built the dlls and .a files. I put them in the spot the guide said (.../qtsources/4.8.1/src/plugins/sqldrivers), my mingw/bin folder, and also my qtsdk/desktop/qt/4.8.1/mingw/bin folder. However, when I run his test application, the only results I'm getting from QSqlDatabase::drivers() are "QSQLITE", "QODBC3", and "QODBC". I'm supposed to be getting a result for QMYSQL. What do I need to do? I tried adding INCLUDEPATH and LIBS in my project.pro file to point to any folder that had the dlls I made, but that didn't change anything.



  • Set the following environment variable, and run again. Then, post the debug output.
    @
    QT_DEBUG_PLUGINS = 1
    @



  • I have the same problem, I'm compiling the dylib and are already in the right repectoire. But when I compile I get the message Error
    QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
    QSqlError(-1, "Driver not loaded", "Driver not loaded")

    I'm using Qt 5.0.2 and Qt Creator 2.7.1 for Mac OS X 10.7.5
    Thanks you



  • I'm use
    [quote author="Andre" date="1351773160"]Set the following environment variable, and run again. Then, post the debug output.
    @
    QT_DEBUG_PLUGINS = 1
    @[/quote]

    And i show this error

    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/platforms/libqcocoa.dylib"
    Got keys from plugin meta data ("cocoa")
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/platforms/libqminimal.dylib"
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/platforms/libqminimal_debug.dylib"
    Got keys from plugin meta data ("minimal")
    loaded library "/System/Library/Frameworks/Carbon.framework/Carbon"
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlite.dylib"
    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib"
    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
    "Cannot load library /Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 5): Library not loaded: libmysqlclient.18.dylib
    Referenced from: /Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
    Reason: image not found)"
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib"
    "Cannot load library /Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib: (dlopen(/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib, 5): Library not loaded: libmysqlclient.18.dylib
    Referenced from: /Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib
    Reason: image not found)"
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlodbc.dylib"
    Got keys from plugin meta data ("QODBC3", "QODBC")
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlodbc_debug.dylib"
    Got keys from plugin meta data ("QODBC3", "QODBC")
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib"
    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() looking at "/Developer/Qt/Qt5.0.2/5.0.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib"
    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
    QSqlError(-1, "Driver not loaded", "Driver not loaded")


  • Lifetime Qt Champion

    Hi,

    The loader can't find libmysqlclient. Do you have it in your PATH ?



  • Hi,
    yes, i have.
    It is in the installation folder of MySQL


  • Lifetime Qt Champion

    Let me rephrase that:

    In your PATH environment variable, do you have the path pointing to the folder where libmysqlclient.dylib can be found ?



  • No, how can do?


  • Lifetime Qt Champion

    Two possibilities:
    Update you .profile and start QtCreator from the console using :
    @open myproject.pro@

    Updated the value in the Run section of the Project panel


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.