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. building mysql plugin for qt (c++)
Forum Updated to NodeBB v4.3 + New Features

building mysql plugin for qt (c++)

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 4 Posters 3.5k 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #13

    These are two commands ...
    what did
    "qmake -- MYSQL_INCDIR=C:\dev\mysql-dev\include "MYSQL_LIBDIR=C:/dev/mysql-dev/lib/lib/libmysql.lib"" print?

    mingw32-make is in your PATH when you opened the correct Qt command prompt.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    silvio_2020S 1 Reply Last reply
    1
    • Christian EhrlicherC Christian Ehrlicher

      These are two commands ...
      what did
      "qmake -- MYSQL_INCDIR=C:\dev\mysql-dev\include "MYSQL_LIBDIR=C:/dev/mysql-dev/lib/lib/libmysql.lib"" print?

      mingw32-make is in your PATH when you opened the correct Qt command prompt.

      silvio_2020S Offline
      silvio_2020S Offline
      silvio_2020
      wrote on last edited by
      #14

      @Christian-Ehrlicher said in building mysql plugin for qt (c++):

      These are two commands ...
      what did
      "qmake -- MYSQL_INCDIR=C:\dev\mysql-dev\include "MYSQL_LIBDIR=C:/dev/mysql-dev/lib/lib/libmysql.lib"" print?

      mingw32-make is in your PATH when you opened the correct Qt command prompt.

      @Christian-Ehrlicher

      i opened CMD in this directory after updating envirennement variable
      C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\mysql

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #15

        @silvio_2020 said in building mysql plugin for qt (c++):

        i opened CMD in this directory after updating envirennement variable

        This is wrong, you have to open your Qt command line where your compiler is correctly set up.

        C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\mysql

        And this is also the wrong directory according to the documentation.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        silvio_2020S 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          @silvio_2020 said in building mysql plugin for qt (c++):

          i opened CMD in this directory after updating envirennement variable

          This is wrong, you have to open your Qt command line where your compiler is correctly set up.

          C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\mysql

          And this is also the wrong directory according to the documentation.

          silvio_2020S Offline
          silvio_2020S Offline
          silvio_2020
          wrote on last edited by
          #16

          @Christian-Ehrlicher said in building mysql plugin for qt (c++):

          @silvio_2020 said in building mysql plugin for qt (c++):

          i opened CMD in this directory after updating envirennement variable

          This is wrong, you have to open your Qt command line where your compiler is correctly set up.

          C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\mysql

          And this is also the wrong directory according to the documentation.

          i tried with the right path (sqldrivers)
          and you can see what is the result
          qmake -- MYSQL_INCDIR=C:\dev\mysql-dev\include "MYSQL_LIBDIR=C:/dev/mysql-dev/lib/opt" mingw32-make sub-mysql
          "error: invalid command line parameter 'mingw32-make'"

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

            As @Christian-Ehrlicher already pointed out, your are writing two different commands as one hence the error you are getting.

            Keep them properly separated as in the documentation and @Christian-Ehrlicher's post.

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

            silvio_2020S 1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by Christian Ehrlicher
              #18

              @silvio_2020 said in building mysql plugin for qt (c++):

              "error: invalid command line parameter 'mingw32-make'"

              Again: This is not in the docs! These are two commands:

              "qmake -- MYSQL_INCDIR=C:\dev\mysql-dev\include "MYSQL_LIBDIR=C:/dev/mysql-dev/lib/opt""
              and
              "mingw32-make sub-mysql"

              Is it so hard to follow the instructions?

              /edit: here is a slightly updated document: https://doc-snapshots.qt.io/qt5-5.14/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @SGaist said in building mysql plugin for qt (c++):

                What exact error are you getting in the logs ?

                And what was your command line? Did you remove config.cache in the directory before?

                silvio_2020S Offline
                silvio_2020S Offline
                silvio_2020
                wrote on last edited by
                #19
                This post is deleted!
                1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  @SGaist said in building mysql plugin for qt (c++):

                  What exact error are you getting in the logs ?

                  And what was your command line? Did you remove config.cache in the directory before?

                  silvio_2020S Offline
                  silvio_2020S Offline
                  silvio_2020
                  wrote on last edited by
                  #20

                  @Christian-Ehrlicher said in building mysql plugin for qt (c++):

                  @SGaist said in building mysql plugin for qt (c++):

                  What exact error are you getting in the logs ?

                  And what was your command line? Did you remove config.cache in the directory before?

                  what means removing config.cach ?
                  the same issue , when i launch the command as described it shows me
                  mysql..... no
                  what scenaro i am missing ?

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #21

                    @silvio_2020 said in building mysql plugin for qt (c++):

                    what means removing config.cach ?

                    a config.cache file is created which should be removed when you try again, otherwise the search for the mysql lib will not be performed again.

                    what scenaro i am missing ?

                    You neither posted the qmake command line you're really using nor where you installed the MySQL server to / where the files mentioned in my (second) link (mysql.h, ...) are.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    silvio_2020S 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      @silvio_2020 said in building mysql plugin for qt (c++):

                      what means removing config.cach ?

                      a config.cache file is created which should be removed when you try again, otherwise the search for the mysql lib will not be performed again.

                      what scenaro i am missing ?

                      You neither posted the qmake command line you're really using nor where you installed the MySQL server to / where the files mentioned in my (second) link (mysql.h, ...) are.

                      silvio_2020S Offline
                      silvio_2020S Offline
                      silvio_2020
                      wrote on last edited by
                      #22

                      @Christian-Ehrlicher said in building mysql plugin for qt (c++):

                      @silvio_2020 said in building mysql plugin for qt (c++):

                      what means removing config.cach ?

                      a config.cache file is created which should be removed when you try again, otherwise the search for the mysql lib will not be performed again.

                      what scenaro i am missing ?

                      You neither posted the qmake command line you're really using nor where you installed the MySQL server to / where the files mentioned in my (second) link (mysql.h, ...) are.

                      this is the qmake commande line i am actually using:
                      qmake MYSQL_INCDIR="C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib"
                      must i indicate the Qmake version in the commande line for building the plugin ?
                      i installed the c connector c 6.1.11 in C:/Program Files (x86)/MySQL/

                      silvio_2020S 1 Reply Last reply
                      0
                      • silvio_2020S silvio_2020

                        @Christian-Ehrlicher said in building mysql plugin for qt (c++):

                        @silvio_2020 said in building mysql plugin for qt (c++):

                        what means removing config.cach ?

                        a config.cache file is created which should be removed when you try again, otherwise the search for the mysql lib will not be performed again.

                        what scenaro i am missing ?

                        You neither posted the qmake command line you're really using nor where you installed the MySQL server to / where the files mentioned in my (second) link (mysql.h, ...) are.

                        this is the qmake commande line i am actually using:
                        qmake MYSQL_INCDIR="C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib"
                        must i indicate the Qmake version in the commande line for building the plugin ?
                        i installed the c connector c 6.1.11 in C:/Program Files (x86)/MySQL/

                        silvio_2020S Offline
                        silvio_2020S Offline
                        silvio_2020
                        wrote on last edited by
                        #23

                        @silvio_2020
                        Finally
                        mysql .......... yes
                        i did not deleted the config.cach
                        i have been deleting config.log all the time
                        as recap
                        i installed mysql c connector 6.1.11 in program files/mysql
                        qt already installed
                        i am working with mingw 64 bit
                        qmake command line ?
                        i used as described in the qt doc cute doc
                        lesson learned
                        every time you give it a new building try you must delete the config.cach
                        thanks for everything

                        H 1 Reply Last reply
                        0
                        • silvio_2020S silvio_2020

                          @silvio_2020
                          Finally
                          mysql .......... yes
                          i did not deleted the config.cach
                          i have been deleting config.log all the time
                          as recap
                          i installed mysql c connector 6.1.11 in program files/mysql
                          qt already installed
                          i am working with mingw 64 bit
                          qmake command line ?
                          i used as described in the qt doc cute doc
                          lesson learned
                          every time you give it a new building try you must delete the config.cach
                          thanks for everything

                          H Offline
                          H Offline
                          hehedaozuiteng
                          wrote on last edited by hehedaozuiteng
                          #24

                          @silvio_2020

                          Thanks you man, you saved my life.

                          1 Reply Last reply
                          0
                          • SGaistS SGaist

                            As @Christian-Ehrlicher already pointed out, your are writing two different commands as one hence the error you are getting.

                            Keep them properly separated as in the documentation and @Christian-Ehrlicher's post.

                            silvio_2020S Offline
                            silvio_2020S Offline
                            silvio_2020
                            wrote on last edited by silvio_2020
                            #25

                            @SGaist said in building mysql plugin for qt (c++):

                            As @Christian-Ehrlicher already pointed out, your are writing two different commands as one hence the error you are getting.

                            Keep them properly separated as in the documentation and @Christian-Ehrlicher's post.

                            after building the plugin
                            and i copied both files to project path it still printing :
                            `C:\Qt\5.12.6\mingw73_32\bin\libmysql.dll': Shared library architecture i386 is not compatible with target architecture i386:x86-64.
                            QSqlDatabase: QMYSQL driver not loaded
                            QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
                            what i'am missing ?

                            H 1 Reply Last reply
                            0
                            • silvio_2020S silvio_2020

                              @SGaist said in building mysql plugin for qt (c++):

                              As @Christian-Ehrlicher already pointed out, your are writing two different commands as one hence the error you are getting.

                              Keep them properly separated as in the documentation and @Christian-Ehrlicher's post.

                              after building the plugin
                              and i copied both files to project path it still printing :
                              `C:\Qt\5.12.6\mingw73_32\bin\libmysql.dll': Shared library architecture i386 is not compatible with target architecture i386:x86-64.
                              QSqlDatabase: QMYSQL driver not loaded
                              QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
                              what i'am missing ?

                              H Offline
                              H Offline
                              hehedaozuiteng
                              wrote on last edited by hehedaozuiteng
                              #26

                              @silvio_2020
                              I solved everything, you doc hinted me.

                              the first thing is check the degit of your qmake, g++ and my serves. I select the 64X(highly recommend). everything should be the same digit.

                              I added the path of qmake.exe and g++.exe to system evironment. these two executable file is come from the qt folder. also delete the path which include the g++.exe outside of qt folder.
                              mine is they are under the qt folder, so it also have requirement file.
                              C:\Qt\5.12.6\mingw73_64\bin
                              C:\Qt\Tools\mingw730_64\bin\

                              now run the cmd code

                              cd %QTDIR%\qtbase\src\plugins\sqldrivers
                              qmake -- MYSQL_INCDIR="C:\Program Files\MySQL\MySQL Server 8.0\include" MYSQL_LIBDIR="C:\Program Files\MySQL\MySQL Server 8.0\lib" (I used the include and lib folder in msql server)
                              mingw32-make (do not use the nmake, just make sure not be fucked by digit problem)
                              mingw32-make install
                              

                              after that you should put the "libmysql.dll" from server\lib folder to
                              executable. the problem done.

                              This problem tortured me three days as the end of a year.

                              My English is not good, so if you get help from this, can you write something to help other newbines like me, thanks.

                              1 Reply Last reply
                              2

                              • Login

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