Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Compiling MySql plugin under Qt 5.14.2
Forum Updated to NodeBB v4.3 + New Features

Compiling MySql plugin under Qt 5.14.2

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 4 Posters 1.4k 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.
  • A Offline
    A Offline
    Anas
    wrote on last edited by
    #1

    Hi everybody,
    i'am using a Windows x64, i need to use Mysql 8 in QT 5.14.2( MinGW x64)
    i've started installing MySQl driver as indicated :
    1-qmake -- MYSQL_INCDIR="C:\Program Files\MySQL\MySQL Server 8.0\include" "MYSQL_LIBDIR="C:\Program Files\MySQL\MySQL Server 8.0\lib"

    2- then when, I am using:
    cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql

    3- and run: qmake, I'm getting :

    Project ERROR: Library 'mysql' is not defined.

    even if I use

    qmake "INCLUDEPATH+=/usr/include/mysql"
    "LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.pro

    Any idea how to solve this problem?

    Thank you all

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

      Hi,

      Step 3 should be mingw32-make, not another call to qmake.

      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
      • A Offline
        A Offline
        Anas
        wrote on last edited by Anas
        #3

        Now when i enter mingw32-make as A 3rd step, it guives me : mingw32-make: *** No targets specified and no makefile found. Stop.

        i tried to run the qmake in sqldrivers instead of mysql and it guives me : 90fce401-f34c-4636-ba8b-41bb9c643aa0-image.png

        jsulmJ 1 Reply Last reply
        0
        • A Anas

          Now when i enter mingw32-make as A 3rd step, it guives me : mingw32-make: *** No targets specified and no makefile found. Stop.

          i tried to run the qmake in sqldrivers instead of mysql and it guives me : 90fce401-f34c-4636-ba8b-41bb9c643aa0-image.png

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

          @Anas Check config.log as qmake asks you to do. You should find information about why MySQL is disabled.

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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Anas
            wrote on last edited by
            #5

            Hi jsulm, Thank you for your answer this is what i find in the log :

            6adb432a-5f09-4603-a2da-c67464a87c04-image.png

            I'm sorry i'm new on QT

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

              On your terminal picture, one thing that is wrong is the make call that is glued to the last ". Remove that completely. It's not part of the configuration process.

              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

                On your terminal picture, one thing that is wrong is the make call that is glued to the last ". Remove that completely. It's not part of the configuration process.

                A Offline
                A Offline
                Anas
                wrote on last edited by
                #7

                @SGaist i've read in an other forum that i should add it to make the mysql driver available, now by removing it i still have the mysql driver not available do you know please how to make it a yes 0d17fddd-e7ba-499d-b889-2ba5d07e9b67-image.png

                jsulmJ 1 Reply Last reply
                0
                • A Anas

                  @SGaist i've read in an other forum that i should add it to make the mysql driver available, now by removing it i still have the mysql driver not available do you know please how to make it a yes 0d17fddd-e7ba-499d-b889-2ba5d07e9b67-image.png

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

                  @Anas Please check again the log file

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

                  A 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Anas Please check again the log file

                    A Offline
                    A Offline
                    Anas
                    wrote on last edited by Anas
                    #9

                    @jsulm did you take a look at the screen i've posted ?

                    1.PNG

                    jsulmJ 1 Reply Last reply
                    0
                    • A Anas

                      @jsulm did you take a look at the screen i've posted ?

                      1.PNG

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

                      @Anas said in Compiling MySql plugin under Qt 5.14.2:

                      did you take a look at the screen i've posted ?

                      Yes, I did, but since you wrote "now by removing it i still have the mysql driver not available" it would make sense to check the log again.

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

                      A 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Anas said in Compiling MySql plugin under Qt 5.14.2:

                        did you take a look at the screen i've posted ?

                        Yes, I did, but since you wrote "now by removing it i still have the mysql driver not available" it would make sense to check the log again.

                        A Offline
                        A Offline
                        Anas
                        wrote on last edited by
                        #11

                        @jsulm thank you for your answer now it's giving : a491cb8d-b299-462a-8133-c031e87901b6-image.png

                        sorry for the quality of the screen

                        jsulmJ 1 Reply Last reply
                        0
                        • A Anas

                          @jsulm thank you for your answer now it's giving : a491cb8d-b299-462a-8133-c031e87901b6-image.png

                          sorry for the quality of the screen

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

                          @Anas Please post text and not screen shots.
                          sybfront.h header file is not found as you can see.
                          Take a look at https://forum.qt.io/topic/92626/cant-connect-to-mysql-database-qmysql-driver-not-loaded

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

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            Anas
                            wrote on last edited by Anas
                            #13

                            @jsulm i've done everything as indicated in the post you sent me, i think it's not the same probleme :
                            -i've added the bin folders in the path ,
                            -i've redownloaded Mysql connector and installed it
                            -in the cmd.exe i enter : cd C:\QT\5.14.2\Src\qtbase\src\plugins\sqldrivers

                            • i run qmake -- MYSQL_INCDIR="C:\Mysql\MySQL Connector C 6.1\include" MYSQL_LIBDIR="C:\Mysql\MySQL Connector C 6.1\lib"
                              it still gives me that Mysql is not available, and in the log i still have the same error sybfront.h is not found, how can i solve this please o how can i add this file if needed
                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              Anas
                              wrote on last edited by
                              #14

                              it's so frustrating, Could anyone Help please ? or should i just delete QT and try something else !

                              1 Reply Last reply
                              0
                              • B Offline
                                B Offline
                                Bonnie
                                wrote on last edited by Bonnie
                                #15

                                Compiling the plugin should be easier than the loading problem.

                                The problem is not "sybfront.h is not found" in the last of the log, but "mysql.h is not found", in the middle of the log.
                                Your log showed that you are using C:\MySQL\MySQL Server 8.0
                                But later you said you run qmake with C:\Mysql\MySQL Connector C 6.1
                                So can you post the latest log?
                                But before that, are you sure mysql.h is in the C:\Mysql\MySQL Connector C 6.1\include folder?
                                Ah, and before run qmake again, delete config.cache file just in case.

                                P.S. For later convenience (avoiding the loading problem), if you are not using MSVC2015 version of Qt, I recommand that do not use MySQL Connector C 6.1.10-6.1.12, using 6.1.9 or older instead.

                                1 Reply Last reply
                                1
                                • A Offline
                                  A Offline
                                  Anas
                                  wrote on last edited by
                                  #16

                                  Thank you Bonnie for your answer now i've succeeded to installed Mysql driver, but i still cannot connect qt to my database, how can i see where's the loaded driver please normally it's in the application output but i can't get that message, here's what i've in my debugging console

                                  QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/accessible" ...
                                  QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/accessible" ...
                                  QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/accessiblebridge" ...
                                  QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/accessiblebridge" ...
                                  QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers" ...
                                  QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlite.dll"
                                  Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlite.dll, metadata=
                                  {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                  "Keys": [
                                  "QSQLITE"
                                  ]
                                  },
                                  "archreq": 0,
                                  "className": "QSQLiteDriverPlugin",
                                  "debug": false,
                                  "version": 331264
                                  }

                                  Got keys from plugin meta data ("QSQLITE")
                                  QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"
                                  Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                                  {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                  "Keys": [
                                  "QMYSQL3",
                                  "QMYSQL"
                                  ]
                                  },
                                  "archreq": 0,
                                  "className": "QMYSQLDriverPlugin",
                                  "debug": false,
                                  "version": 331264
                                  }

                                  Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                                  QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlodbc.dll"
                                  Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
                                  {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                  "Keys": [
                                  "QODBC3",
                                  "QODBC"
                                  ]
                                  },
                                  "archreq": 0,
                                  "className": "QODBCDriverPlugin",
                                  "debug": false,
                                  "version": 331264
                                  }

                                  Got keys from plugin meta data ("QODBC3", "QODBC")
                                  QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlpsql.dll"
                                  Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
                                  {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                  "Keys": [
                                  "QPSQL7",
                                  "QPSQL"
                                  ]
                                  },
                                  "archreq": 0,
                                  "className": "QPSQLDriverPlugin",
                                  "debug": false,
                                  "version": 331264
                                  }

                                  Got keys from plugin meta data ("QPSQL7", "QPSQL")
                                  QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/sqldrivers" ...
                                  loaded library "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/styles/qwindowsvistastyle.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qgif.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qicns.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qico.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qjpeg.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qsvg.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qtga.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qtiff.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qwbmp.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qwebp.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/platforms/qwindows.dll"
                                  QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"

                                  Thank you again for your help

                                  B 1 Reply Last reply
                                  0
                                  • A Anas

                                    Thank you Bonnie for your answer now i've succeeded to installed Mysql driver, but i still cannot connect qt to my database, how can i see where's the loaded driver please normally it's in the application output but i can't get that message, here's what i've in my debugging console

                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/accessible" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/accessible" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/accessiblebridge" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/accessiblebridge" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers" ...
                                    QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlite.dll"
                                    Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlite.dll, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                    "MetaData": {
                                    "Keys": [
                                    "QSQLITE"
                                    ]
                                    },
                                    "archreq": 0,
                                    "className": "QSQLiteDriverPlugin",
                                    "debug": false,
                                    "version": 331264
                                    }

                                    Got keys from plugin meta data ("QSQLITE")
                                    QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"
                                    Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                    "MetaData": {
                                    "Keys": [
                                    "QMYSQL3",
                                    "QMYSQL"
                                    ]
                                    },
                                    "archreq": 0,
                                    "className": "QMYSQLDriverPlugin",
                                    "debug": false,
                                    "version": 331264
                                    }

                                    Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                                    QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlodbc.dll"
                                    Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                    "MetaData": {
                                    "Keys": [
                                    "QODBC3",
                                    "QODBC"
                                    ]
                                    },
                                    "archreq": 0,
                                    "className": "QODBCDriverPlugin",
                                    "debug": false,
                                    "version": 331264
                                    }

                                    Got keys from plugin meta data ("QODBC3", "QODBC")
                                    QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlpsql.dll"
                                    Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                    "MetaData": {
                                    "Keys": [
                                    "QPSQL7",
                                    "QPSQL"
                                    ]
                                    },
                                    "archreq": 0,
                                    "className": "QPSQLDriverPlugin",
                                    "debug": false,
                                    "version": 331264
                                    }

                                    Got keys from plugin meta data ("QPSQL7", "QPSQL")
                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/sqldrivers" ...
                                    loaded library "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/styles/qwindowsvistastyle.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qgif.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qicns.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qico.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qjpeg.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qsvg.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qtga.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qtiff.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qwbmp.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qwebp.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/platforms/qwindows.dll"
                                    QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"

                                    Thank you again for your help

                                    B Offline
                                    B Offline
                                    Bonnie
                                    wrote on last edited by
                                    #17

                                    @Anas According to the console, the mysql plugin seems to be loaded successfully.
                                    Did you print the error message of the database?

                                        qDebug() << db.lastError().text();
                                    

                                    And show your code please. (You can hide those ip/hostname, username and password things)

                                    1 Reply Last reply
                                    1
                                    • A Offline
                                      A Offline
                                      Anas
                                      wrote on last edited by
                                      #18

                                      thank you very much Bonnie for your help it's working now, it was just a password probleme, thank you again

                                      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