Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QTDriver not Load
Forum Updated to NodeBB v4.3 + New Features

QTDriver not Load

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
33 Posts 6 Posters 10.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jsulmJ jsulm

    @lucaynnofrota said in QTDriver not Load:

    set mysql=C:\Program Files\MySQL

    You should avoid using paths with spaces.

    L Offline
    L Offline
    lucaynnofrota
    wrote on last edited by
    #20

    @jsulm
    Thanks for reply
    I copied the files of interest to another folder to try to build. But it did not work.
    Input:

    d:
    cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
    nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
    
    pause
    

    Output:

    D:\>cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
    
    D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
    Info: creating stash file D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql\.qmake.stash
    
    Running configuration tests...
    Checking for DB2 (IBM)... no
    Checking for InterBase... no
    Checking for MySQL... no
    Checking for OCI (Oracle)... no
    Checking for ODBC... yes
    Checking for PostgreSQL... no
    Checking for SQLite (version 2)... no
    Checking for TDS (Sybase)... no
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... yes
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    
    Qt is now configured for building. Just run 'mingw32-make'.
    Once everything is built, Qt is installed.
    You should NOT run 'mingw32-make install'.
    Note that this build cannot be deployed to other machines or devices.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    
    
    D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
    
    Microsoft (R) Program Maintenance Utility Version 14.16.27023.1
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    NMAKE : fatal error U1073: don't know how to make 'C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql'
    Stop.
    
    D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>pause
    

    What is "sub" in documentation?

    jsulmJ 1 Reply Last reply
    0
    • L lucaynnofrota

      @jsulm
      Thanks for reply
      I copied the files of interest to another folder to try to build. But it did not work.
      Input:

      d:
      cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
      qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
      nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
      
      pause
      

      Output:

      D:\>cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
      
      D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
      Info: creating stash file D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql\.qmake.stash
      
      Running configuration tests...
      Checking for DB2 (IBM)... no
      Checking for InterBase... no
      Checking for MySQL... no
      Checking for OCI (Oracle)... no
      Checking for ODBC... yes
      Checking for PostgreSQL... no
      Checking for SQLite (version 2)... no
      Checking for TDS (Sybase)... no
      Done running configuration tests.
      
      Configure summary:
      
      Qt Sql:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... yes
        PostgreSQL ............................. no
        SQLite2 ................................ no
        SQLite ................................. yes
          Using system provided SQLite ......... no
        TDS (Sybase) ........................... no
      
      Qt is now configured for building. Just run 'mingw32-make'.
      Once everything is built, Qt is installed.
      You should NOT run 'mingw32-make install'.
      Note that this build cannot be deployed to other machines or devices.
      
      Prior to reconfiguration, make sure you remove any leftovers from
      the previous build.
      
      
      D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
      
      Microsoft (R) Program Maintenance Utility Version 14.16.27023.1
      Copyright (C) Microsoft Corporation.  All rights reserved.
      
      NMAKE : fatal error U1073: don't know how to make 'C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql'
      Stop.
      
      D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>pause
      

      What is "sub" in documentation?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #21

      @lucaynnofrota said in QTDriver not Load:

      What is "sub" in documentation?

      What sub do you mean?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      L 1 Reply Last reply
      0
      • jsulmJ jsulm

        @lucaynnofrota said in QTDriver not Load:

        What is "sub" in documentation?

        What sub do you mean?

        L Offline
        L Offline
        lucaynnofrota
        wrote on last edited by
        #22

        @jsulm

        Thanks for reply
        http://doc.qt.io/qt-5/sql-driver.html
        Exist this code in documentation

        cd $QTDIR/qtbase/src/plugins/sqldrivers
        qmake -- MYSQL_PREFIX=/usr/local
        make sub-mysql
        

        What is this "sub"?

        jsulmJ 1 Reply Last reply
        0
        • L lucaynnofrota

          @jsulm

          Thanks for reply
          http://doc.qt.io/qt-5/sql-driver.html
          Exist this code in documentation

          cd $QTDIR/qtbase/src/plugins/sqldrivers
          qmake -- MYSQL_PREFIX=/usr/local
          make sub-mysql
          

          What is this "sub"?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #23

          @lucaynnofrota It is a build target. Open the generated Makefile and search for sub-mysql there.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • kmyukieK Offline
            kmyukieK Offline
            kmyukie
            wrote on last edited by kmyukie
            #24

            Hello, I have the same problem as @lucaynnofrota. I think I might be using the wrong commands to compile the MySQL plugin, although I have tried to follow the documentation. I'm on a Mac.
            I've inputted in Terminal:

            cd /Volumes/Potato/apps/5.11.2/Src/qtbase/src/plugins/sqldrivers
            qmake -- MYSQL_PREFIX=/usr/local/mysql
            make sub-mysql
            

            In which "apps" is the Qt folder I've accidentally renamed.
            But whenever I try to execute this:

            #include <iostream>
            #include <QtSql>
            #include <QtCore>
            #include <QString>
            #include <QCoreApplication>
            using namespace std;
            
            int main(int argc,char *argv[])
            {
                   QCoreApplication a(argc,argv);
            
                   QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                   bool ok = db.open();
                   if(ok) cout << "OK!\n";
                   qDebug() << db.lastError();
            }
            

            I get :

            QSqlDatabase: QMYSQL driver not loaded
            QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
            QSqlError("", "Driver not loaded", "Driver not loaded")
            

            My .pro file is:

            TEMPLATE = app
            CONFIG += console c++11
            CONFIG -= app_bundle
            CONFIG += qt
            QT += sql gui
            SOURCES += \
                    main.cpp
            

            What am I doing wrong?
            Thanks!

            jsulmJ 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #25

              Hi,

              Add the QT_DEBUG_PLUGINS environment variable in the Run part of the Project panel. You'll have more information about why the plugins doesn't load. A wild guess would be that the application can't find the MySQL dlls at run time.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • kmyukieK Offline
                kmyukieK Offline
                kmyukie
                wrote on last edited by
                #26

                Thanks for replying!
                I've tried to set QT_DEBUG_PLUGINS to 1, and the output is:

                cd /; /Volumes/Potato/apps/Qt\ Creator.app/Contents/MacOS/../Resources/qtcreator_process_stub run /var/folders/sv/76q4jsns75g48tkx3b4g__3c0000gn/T/QtCreator.kFAuXu/stub-socket Press\ \<RETURN\>\ to\ close\ this\ window... /Users/yukie/build-testsqlite-Desktop_Qt_5_11_2_clang_64bit-Release /var/folders/sv/76q4jsns75g48tkx3b4g__3c0000gn/T/QtCreator.KiilXk 23590 /Users/yukie/build-testsqlite-Desktop_Qt_5_11_2_clang_64bit-Release/testsqlite
                QFactoryLoader::QFactoryLoader() checking directory path "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers" ...
                QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib"
                Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QSQLITE"
                        ]
                    },
                    "className": "QSQLiteDriverPlugin",
                    "debug": false,
                    "version": 330498
                }
                
                
                Got keys from plugin meta data ("QSQLITE")
                QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib"
                Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QSQLITE"
                        ]
                    },
                    "className": "QSQLiteDriverPlugin",
                    "debug": true,
                    "version": 330498
                }
                
                
                Got keys from plugin meta data ("QSQLITE")
                QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
                Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QMYSQL3",
                            "QMYSQL"
                        ]
                    },
                    "className": "QMYSQLDriverPlugin",
                    "debug": false,
                    "version": 330498
                }
                
                
                Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib"
                Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QMYSQL3",
                            "QMYSQL"
                        ]
                    },
                    "className": "QMYSQLDriverPlugin",
                    "debug": true,
                    "version": 330498
                }
                
                
                Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib"
                Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QPSQL7",
                            "QPSQL"
                        ]
                    },
                    "className": "QPSQLDriverPlugin",
                    "debug": false,
                    "version": 330498
                }
                
                
                Got keys from plugin meta data ("QPSQL7", "QPSQL")
                QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib"
                Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib, metadata=
                {
                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                    "MetaData": {
                        "Keys": [
                            "QPSQL7",
                            "QPSQL"
                        ]
                    },
                    "className": "QPSQLDriverPlugin",
                    "debug": true,
                    "version": 330498
                }
                
                
                Got keys from plugin meta data ("QPSQL7", "QPSQL")
                QFactoryLoader::QFactoryLoader() checking directory path "/Users/yukie/build-testsqlite-Desktop_Qt_5_11_2_clang_64bit-Release/sqldrivers" ...
                Cannot load library /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
                  Referenced from: /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
                  Reason: image not found)
                QLibraryPrivate::loadPlugin failed on "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib" : "Cannot load library /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib\n  Referenced from: /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib\n  Reason: image not found)"
                QSqlDatabase: QMYSQL driver not loaded
                QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                QSqlError("", "Driver not loaded", "Driver not loaded")
                QSqlQuery::prepare: database not open
                QSqlQuery::prepare: database not open
                QSqlQuery::prepare: database not open
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #27

                  I didn't realise that you are working on macOS. This thread is for Windows.

                  As for your issue, it has already been answered many times already on this forum. Please search it.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • kmyukieK kmyukie

                    Hello, I have the same problem as @lucaynnofrota. I think I might be using the wrong commands to compile the MySQL plugin, although I have tried to follow the documentation. I'm on a Mac.
                    I've inputted in Terminal:

                    cd /Volumes/Potato/apps/5.11.2/Src/qtbase/src/plugins/sqldrivers
                    qmake -- MYSQL_PREFIX=/usr/local/mysql
                    make sub-mysql
                    

                    In which "apps" is the Qt folder I've accidentally renamed.
                    But whenever I try to execute this:

                    #include <iostream>
                    #include <QtSql>
                    #include <QtCore>
                    #include <QString>
                    #include <QCoreApplication>
                    using namespace std;
                    
                    int main(int argc,char *argv[])
                    {
                           QCoreApplication a(argc,argv);
                    
                           QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                           bool ok = db.open();
                           if(ok) cout << "OK!\n";
                           qDebug() << db.lastError();
                    }
                    

                    I get :

                    QSqlDatabase: QMYSQL driver not loaded
                    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                    QSqlError("", "Driver not loaded", "Driver not loaded")
                    

                    My .pro file is:

                    TEMPLATE = app
                    CONFIG += console c++11
                    CONFIG -= app_bundle
                    CONFIG += qt
                    QT += sql gui
                    SOURCES += \
                            main.cpp
                    

                    What am I doing wrong?
                    Thanks!

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #28

                    @kmyukie Didn't you forgot "make install"?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @lucaynnofrota said in QTDriver not Load:

                      D:/Qt/5.11.2/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri

                      Does this file exist?

                      A Offline
                      A Offline
                      ankurboruah
                      wrote on last edited by
                      #29

                      @jsulm I had the same issue as @lucaynnofrota where the qtsqldrivers-config.pri file was not found. Any idea where I can find the file?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #30

                        @ankurboruah This file is created when you configure Qt.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        A 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          @ankurboruah This file is created when you configure Qt.

                          A Offline
                          A Offline
                          ankurboruah
                          wrote on last edited by
                          #31

                          @SGaist Thanks for your reply. I came to the same conclusion as well. Going through with configuring Qt. Hopefully no errors pop up during that.

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #32

                            Which version of Qt are you trying to build the driver for ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              lucaynnofrota
                              wrote on last edited by
                              #33

                              The problem with MySQL I could not solve.
                              I tried using Postgres and I had no problem. Shortly afterwards I realized that I was making a Mistake, the latest versions of MySQL are for 64bit and the version I was using from 32bit qt

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved