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. Qt MySQL Driver Mingw32-make not working
Forum Updated to NodeBB v4.3 + New Features

Qt MySQL Driver Mingw32-make not working

Scheduled Pinned Locked Moved Unsolved General and Desktop
46 Posts 6 Posters 6.1k Views 3 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 Christian Ehrlicher

    @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

    reinstalling the entire mysql workbench/server.

    why? Moving the two needed directories to somewhere else should be enough.

    H Offline
    H Offline
    hobbyProgrammer
    wrote on last edited by
    #7

    @Christian-Ehrlicher I can just make a new folder without spaces and move all the files to there?

    1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

      reinstalling the entire mysql workbench/server.

      why? Moving the two needed directories to somewhere else should be enough.

      H Offline
      H Offline
      hobbyProgrammer
      wrote on last edited by hobbyProgrammer
      #8

      @Christian-Ehrlicher @Christian-Ehrlicher I moved it and used this command (from this tutorial:

      cd C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers
      qmake -- MYSQL_INCDIR=C:\MySQL\include "MYSQL_LIBDIR=C:\MySQL\lib"
      mingw32-make 
      

      but still get the same errors..

      jsulmJ 2 Replies Last reply
      0
      • H hobbyProgrammer

        @Christian-Ehrlicher @Christian-Ehrlicher I moved it and used this command (from this tutorial:

        cd C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers
        qmake -- MYSQL_INCDIR=C:\MySQL\include "MYSQL_LIBDIR=C:\MySQL\lib"
        mingw32-make 
        

        but still get the same errors..

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

        @hobbyProgrammer Do a clean rebuild

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

        H 1 Reply Last reply
        1
        • jsulmJ jsulm

          @hobbyProgrammer Do a clean rebuild

          H Offline
          H Offline
          hobbyProgrammer
          wrote on last edited by
          #10

          @jsulm still results in getting the same error. I should rebuild sqldrivers.pro right?

          1 Reply Last reply
          0
          • H hobbyProgrammer

            @Christian-Ehrlicher @Christian-Ehrlicher I moved it and used this command (from this tutorial:

            cd C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers
            qmake -- MYSQL_INCDIR=C:\MySQL\include "MYSQL_LIBDIR=C:\MySQL\lib"
            mingw32-make 
            

            but still get the same errors..

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

            @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

            cd C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers

            You're doing in source build which is bad.
            Make sure there are no build artefacts.

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

            H 1 Reply Last reply
            0
            • jsulmJ jsulm

              @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

              cd C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers

              You're doing in source build which is bad.
              Make sure there are no build artefacts.

              H Offline
              H Offline
              hobbyProgrammer
              wrote on last edited by
              #12

              @jsulm why is that bad? I'm quite new and just following the instructions from the docs, so I'd like to learn how to do things properly :')

              jsulmJ 1 Reply Last reply
              0
              • H hobbyProgrammer

                @jsulm why is that bad? I'm quite new and just following the instructions from the docs, so I'd like to learn how to do things properly :')

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

                @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                why is that bad?

                Because you're polluting source tree with build artefacts. If you then want to do a clean rebuild you need to delete all build artefacts and there can be many of them all over the place. Out of source builds are way easier:

                1. Create a build directory
                2. Go to that directory
                3. qmake
                4. make
                5. make install

                For a clean rebuild delete everything inside build directory (or delete it and create again) and repeat steps 2..5.

                By the way: QtCreator does out of source builds by default, so your source tree is clean and it's easier to use version control systems like Git :-)

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

                H 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                  why is that bad?

                  Because you're polluting source tree with build artefacts. If you then want to do a clean rebuild you need to delete all build artefacts and there can be many of them all over the place. Out of source builds are way easier:

                  1. Create a build directory
                  2. Go to that directory
                  3. qmake
                  4. make
                  5. make install

                  For a clean rebuild delete everything inside build directory (or delete it and create again) and repeat steps 2..5.

                  By the way: QtCreator does out of source builds by default, so your source tree is clean and it's easier to use version control systems like Git :-)

                  H Offline
                  H Offline
                  hobbyProgrammer
                  wrote on last edited by
                  #14

                  @jsulm Thank you for your answer. I'm gonna retry to make the driver with this information in mind.

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    hobbyProgrammer
                    wrote on last edited by
                    #15

                    I still did not get it to work.

                    What I did:

                    1. Moved all the content from MySQL server directory (contained a lot of spaced) to C:/MySQL.
                    2. Used these commands:
                    cd C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers
                    qmake -- MYSQL_INCDIR=:C\MySQL\include "MYSQL_LIBDIR=C:\MySQL\lib"
                    mingw32-make 
                    

                    yet it still doesn't work. Is there anyone who knows why and can help me? I really want to connect to my MySQL database..

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

                      @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                      MYSQL_INCDIR=:C\MySQL\include

                      typo?

                      What was the output of the qmake command?

                      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
                      2
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #17

                        You have the : before the C. Is this just a typo here ?

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

                        H 1 Reply Last reply
                        1
                        • SGaistS SGaist

                          You have the : before the C. Is this just a typo here ?

                          H Offline
                          H Offline
                          hobbyProgrammer
                          wrote on last edited by hobbyProgrammer
                          #18

                          @Christian-Ehrlicher @SGaist
                          yes that was a typo, but the output stays the same: "Project ERROR: Could not find feature sql-mysql."

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

                            That's not the complete output. Please remove all intermediate files create by qmake (run first 'make distclean', then also remove qmake.cache) and rerun qmake again with the correct mysql parameters. Then show us the output.

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

                            H 1 Reply Last reply
                            2
                            • Christian EhrlicherC Christian Ehrlicher

                              That's not the complete output. Please remove all intermediate files create by qmake (run first 'make distclean', then also remove qmake.cache) and rerun qmake again with the correct mysql parameters. Then show us the output.

                              H Offline
                              H Offline
                              hobbyProgrammer
                              wrote on last edited by
                              #20

                              @Christian-Ehrlicher right now this is my output:

                              C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR=C:\MySQL\include "MYSQL_LIBDIR=C:\MySQL\lib"

                              Running configuration tests...
                              Done running configuration tests.

                              Configure summary:

                              Qt Sql Drivers:
                              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, you must run 'mingw32-make install'.
                              Qt will be installed into 'C:\Qt\5.12.5\mingw73_32'.

                              Prior to reconfiguration, make sure you remove any leftovers from
                              the previous build.

                              Then I ran mingw32-make:

                              C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers>mingw32-make
                              cd odbc\ && ( if not exist Makefile C:\Qt\5.12.5\mingw73_32\bin\qmake.exe -o Makefile C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers\odbc\odbc.pro ) && mingw32-make -f Makefile
                              mingw32-make[1]: Entering directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/odbc'
                              mingw32-make -f Makefile.Release all
                              mingw32-make[2]: Entering directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/odbc'
                              mingw32-make[2]: Nothing to be done for 'all'.
                              mingw32-make[2]: Leaving directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/odbc'
                              mingw32-make -f Makefile.Debug all
                              mingw32-make[2]: Entering directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/odbc'
                              mingw32-make[2]: Nothing to be done for 'all'.
                              mingw32-make[2]: Leaving directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/odbc'
                              mingw32-make[1]: Leaving directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/odbc'
                              cd sqlite\ && ( if not exist Makefile C:\Qt\5.12.5\mingw73_32\bin\qmake.exe -o Makefile C:\Qt\5.12.5\Src\qtbase\src\plugins\sqldrivers\sqlite\sqlite.pro ) && mingw32-make -f Makefile
                              mingw32-make[1]: Entering directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/sqlite'
                              mingw32-make -f Makefile.Release all
                              mingw32-make[2]: Entering directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/sqlite'
                              mingw32-make[2]: Nothing to be done for 'all'.
                              mingw32-make[2]: Leaving directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/sqlite'
                              mingw32-make -f Makefile.Debug all
                              mingw32-make[2]: Entering directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/sqlite'
                              mingw32-make[2]: Nothing to be done for 'all'.
                              mingw32-make[2]: Leaving directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/sqlite'
                              mingw32-make[1]: Leaving directory 'C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers/sqlite'

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

                                @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                                MySql .................................. no

                                So why do you even try to call mingw32-make when the configure step says it could not find the mysql stuff?
                                There is a config.log (iirc) where you can take a look into why the mysql plugins are not found.

                                MYSQL_INCDIR=C:\MySQL\include "MYSQL_LIBDIR=C:\MySQL\lib"

                                Why one with " and one without? It's not needed ...

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

                                H 1 Reply Last reply
                                2
                                • Christian EhrlicherC Christian Ehrlicher

                                  @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                                  MySql .................................. no

                                  So why do you even try to call mingw32-make when the configure step says it could not find the mysql stuff?
                                  There is a config.log (iirc) where you can take a look into why the mysql plugins are not found.

                                  MYSQL_INCDIR=C:\MySQL\include "MYSQL_LIBDIR=C:\MySQL\lib"

                                  Why one with " and one without? It's not needed ...

                                  H Offline
                                  H Offline
                                  hobbyProgrammer
                                  wrote on last edited by
                                  #22

                                  @Christian-Ehrlicher It seems like it cannot find the libraries in the global paths.

                                  Command line: "MYSQL_INCDIR=C:\MySQL\include" "MYSQL_LIBDIR=C:\MySQL\lib"
                                  Global lib dirs: [C:\openssl\lib C:\Utils\my_sql\mysql-5.6.11-win32\lib C:\Utils\postgresql\pgsql\lib] ["C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x86" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\lib\x86" "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x86" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x86" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x86"]
                                  Global inc dirs: [C:\openssl\include C:\Utils\my_sql\mysql-5.6.11-win32\include C:\Utils\postgresql\pgsql\include] ["C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include" "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt"]
                                  ...........
                                  ...........
                                  Trying source 5 (type inline) of library mysql ...
                                  None of [liblibmysql.dll.a liblibmysql.a libmysql.dll.a libmysql.a libmysql.lib] found in ["C:\Program Files (x86)\MySQL\MySQL Connector C++ 8.0\lib"] and global paths.
                                  => source produced no result.

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

                                    @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                                    Trying source 5 (type inline) of library mysql ...

                                    There are 4 other tries finding mysql before, please show the output

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

                                    H 1 Reply Last reply
                                    0
                                    • Christian EhrlicherC Christian Ehrlicher

                                      @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                                      Trying source 5 (type inline) of library mysql ...

                                      There are 4 other tries finding mysql before, please show the output

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

                                      @Christian-Ehrlicher

                                      this is the entire mysql section I believe:

                                      Command line: "MYSQL_INCDIR=C:\MySQL\include" "MYSQL_LIBDIR=C:\MySQL\lib"
                                      Global lib dirs: [C:\openssl\lib C:\Utils\my_sql\mysql-5.6.11-win32\lib C:\Utils\postgresql\pgsql\lib] ["C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x86" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\lib\x86" "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x86" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x86" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x86"]
                                      Global inc dirs: [C:\openssl\include C:\Utils\my_sql\mysql-5.6.11-win32\include C:\Utils\postgresql\pgsql\include] ["C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include" "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt"]
                                      loaded result for library config.sqldrivers.libraries.db2
                                      Trying source 0 (type inline) of library db2 ...
                                      None of [libdb2cli.dll.a libdb2cli.a db2cli.dll.a db2cli.a db2cli.lib] found in [] and global paths.
                                      => source produced no result.
                                      Trying source 1 (type inline) of library db2 ...
                                      => source failed condition '!config.win32'.
                                      test config.sqldrivers.libraries.db2 FAILED
                                      loaded result for library config.sqldrivers.libraries.ibase
                                      Trying source 0 (type inline) of library ibase ...
                                      None of [libgds32_ms.dll.a libgds32_ms.a gds32_ms.dll.a gds32_ms.a gds32_ms.lib] found in [] and global paths.
                                      => source produced no result.
                                      Trying source 1 (type inline) of library ibase ...
                                      => source failed condition '!config.win32'.
                                      test config.sqldrivers.libraries.ibase FAILED
                                      loaded result for library config.sqldrivers.libraries.mysql
                                      Trying source 0 (type mysqlConfig) of library mysql ...
                                      mysql_config not found.
                                      => source produced no result.
                                      Trying source 1 (type mysqlConfig) of library mysql ...
                                      mysql_config not found.
                                      => source produced no result.
                                      Trying source 2 (type mysqlConfig) of library mysql ...
                                      mysql_config not found.
                                      => source produced no result.
                                      Trying source 3 (type mysqlConfig) of library mysql ...
                                      mysql_config not found.
                                      => source produced no result.
                                      Trying source 4 (type inline) of library mysql ...
                                      => source failed condition '!config.win32'.
                                      Trying source 5 (type inline) of library mysql ...
                                      None of [liblibmysql.dll.a liblibmysql.a libmysql.dll.a libmysql.a libmysql.lib] found in ["C:\Program Files (x86)\MySQL\MySQL Connector C++ 8.0\lib"] and global paths.
                                      => source produced no result.

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

                                        @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                                        liblibmysql.dll.a liblibmysql.a libmysql.dll.a libmysql.a libmysql.lib]

                                        So is one of these libraries available in C:\Program Files (x86)\MySQL\MySQL Connector C++ 8.0\lib ? I would guess no. It's in C:\Program Files\MySQL\MySQL Server 8.0\lib or C:\Program Files (x86)\MySQL\MySQL Server 8.0\lib depending on what you've installed.

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

                                        H 1 Reply Last reply
                                        1
                                        • Christian EhrlicherC Christian Ehrlicher

                                          @hobbyProgrammer said in Qt MySQL Driver Mingw32-make not working:

                                          liblibmysql.dll.a liblibmysql.a libmysql.dll.a libmysql.a libmysql.lib]

                                          So is one of these libraries available in C:\Program Files (x86)\MySQL\MySQL Connector C++ 8.0\lib ? I would guess no. It's in C:\Program Files\MySQL\MySQL Server 8.0\lib or C:\Program Files (x86)\MySQL\MySQL Server 8.0\lib depending on what you've installed.

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

                                          @Christian-Ehrlicher yes i know that these libraries are inside the MySQL Server 8.0 folder, but I don't know why it's not searching there. I used these commands: C:\Qt\5.12.5\Src\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 also moved the folder MySQL Server 8.0 to C:/MySQL, so I can access to a library without any spaces.

                                          jsulmJ 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