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.9k 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 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
              • H hobbyProgrammer

                @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 Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #27

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

                C:\Program Files\MySQL\MySQL Server 8.0\include

                put this in "" as it contains spaces

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

                H 2 Replies Last reply
                0
                • jsulmJ jsulm

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

                  C:\Program Files\MySQL\MySQL Server 8.0\include

                  put this in "" as it contains spaces

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

                  @jsulm yes I already tried that, but it failed to work

                  kshegunovK 1 Reply Last reply
                  0
                  • jsulmJ jsulm

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

                    C:\Program Files\MySQL\MySQL Server 8.0\include

                    put this in "" as it contains spaces

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

                    @jsulm just to be sure, it is just this command right?

                    qmake -- "MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include" "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 8.0\lib"

                    not that I should add sqldrivers.pro behind it?

                    qmake -- "MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include" "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 8.0\lib" sqldrivers.pro

                    jsulmJ 1 Reply Last reply
                    0
                    • H hobbyProgrammer

                      @jsulm just to be sure, it is just this command right?

                      qmake -- "MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include" "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 8.0\lib"

                      not that I should add sqldrivers.pro behind it?

                      qmake -- "MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include" "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 8.0\lib" sqldrivers.pro

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

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

                      not that I should add sqldrivers.pro behind it?

                      Depends in which directory you are. If you're in the directory where sqldrivers.pro is then no need to mention it. It looks like you're not doing out of source build which you should do. Also, are you sure qmake you're calling is the correct one (because you do not specify complete path)?

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

                      1 Reply Last reply
                      0
                      • H hobbyProgrammer

                        @jsulm yes I already tried that, but it failed to work

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by kshegunov
                        #31

                        I had the same problem the other day. qmake refused to find the mysql libs for whatever reason.
                        So here's what I did:

                        1. cd into C:/Qt/5.12.5/Src/qtbase
                        2. $> configure.exe -prefix C:\Qt\5.12.5\mingw73_32 -release -platform win32-g++ -sql-mysql 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"
                          Adjust the prefix and mysql paths as needed.
                        3. If configure complains about QMAKESPEC and other variables - unset them; i.e. $> set QMAKESPEC=
                        4. Rerun configure and make sure in the summary the mysql is detected
                        5. Do a partial build of Qt: $> mingw32-make module-qtbase
                        6. Go to C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers and install the plugins in the prefix location:
                          mingw32-make install

                        Good luck.

                        PS. That's for a release build, for the debug version you need to set the appropriate flag to configure to build both.

                        Read and abide by the Qt Code of Conduct

                        H 1 Reply Last reply
                        2
                        • kshegunovK kshegunov

                          I had the same problem the other day. qmake refused to find the mysql libs for whatever reason.
                          So here's what I did:

                          1. cd into C:/Qt/5.12.5/Src/qtbase
                          2. $> configure.exe -prefix C:\Qt\5.12.5\mingw73_32 -release -platform win32-g++ -sql-mysql 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"
                            Adjust the prefix and mysql paths as needed.
                          3. If configure complains about QMAKESPEC and other variables - unset them; i.e. $> set QMAKESPEC=
                          4. Rerun configure and make sure in the summary the mysql is detected
                          5. Do a partial build of Qt: $> mingw32-make module-qtbase
                          6. Go to C:/Qt/5.12.5/Src/qtbase/src/plugins/sqldrivers and install the plugins in the prefix location:
                            mingw32-make install

                          Good luck.

                          PS. That's for a release build, for the debug version you need to set the appropriate flag to configure to build both.

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

                          @kshegunov I can't seem to find configure.exe, should it be .exe or can it also be a different type of file?

                          kshegunovK 1 Reply Last reply
                          0
                          • H hobbyProgrammer

                            @kshegunov I can't seem to find configure.exe, should it be .exe or can it also be a different type of file?

                            kshegunovK Offline
                            kshegunovK Offline
                            kshegunov
                            Moderators
                            wrote on last edited by
                            #33

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

                            I can't seem to find configure.exe, should it be .exe or can it also be a different type of file?

                            It's an exe. It's in your Qt source folder.

                            Read and abide by the Qt Code of Conduct

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

                              @kshegunov
                              I see 3 configure files:
                              config.txt
                              configure (which is labelled as 'file')
                              configure.bat
                              configure.json

                              1 Reply Last reply
                              0
                              • kshegunovK kshegunov

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

                                I can't seem to find configure.exe, should it be .exe or can it also be a different type of file?

                                It's an exe. It's in your Qt source folder.

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

                                @kshegunov I tried with the .bat file, which seems to work properly, but I get this:

                                ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

                                Which doesn't seem ideal.
                                Also when I checked it with a sql project I still got:
                                QSqlDatabase: QMYSQL driver not loaded
                                QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

                                kshegunovK 1 Reply Last reply
                                0
                                • H hobbyProgrammer

                                  @kshegunov I tried with the .bat file, which seems to work properly, but I get this:

                                  ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

                                  Which doesn't seem ideal.
                                  Also when I checked it with a sql project I still got:
                                  QSqlDatabase: QMYSQL driver not loaded
                                  QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

                                  kshegunovK Offline
                                  kshegunovK Offline
                                  kshegunov
                                  Moderators
                                  wrote on last edited by
                                  #36

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

                                  ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

                                  Then either you haven't provided the correct paths to the mysql headers and libraries or they're incompatible for some reason (e.g. they're 32bits while your compiler is 64bits or vice versa).

                                  Read and abide by the Qt Code of Conduct

                                  H 1 Reply Last reply
                                  1
                                  • kshegunovK kshegunov

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

                                    ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.

                                    Then either you haven't provided the correct paths to the mysql headers and libraries or they're incompatible for some reason (e.g. they're 32bits while your compiler is 64bits or vice versa).

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

                                    @kshegunov alright, I managed to get it right on my PC, but I'd also like to have it on my laptop. The reimp worked and the MySQL folder\lib now contains libmysql.def and libmysql.a, however whenever I run configure.exe it doesn't work.

                                    configure.exe -debug-and-release -platform win32-g++ -qt-sql-mysql -l mysql -I C:\MySQL\include -L C:\MySQL\lib
                                    

                                    gives me this:

                                    Bootstrapping qmake ...
                                    mingw32-make: Nothing to be done for 'first'.
                                    ERROR: Invalid value given for boolean command line option 'sql-mysql'.
                                    
                                    ERROR: Unknown command line option '-l'.
                                    
                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #38

                                      Hi,

                                      As the error text suggests, remove that -l option. The configure script doesn't support it. It only wants the include and library paths.

                                      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
                                      0
                                      • SGaistS SGaist

                                        Hi,

                                        As the error text suggests, remove that -l option. The configure script doesn't support it. It only wants the include and library paths.

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

                                        @SGaist alright that solves the last error, but I still have this one:

                                        ERROR: Invalid value given for boolean command line option 'sql-mysql'.
                                        
                                        jsulmJ 1 Reply Last reply
                                        0
                                        • H hobbyProgrammer

                                          @SGaist alright that solves the last error, but I still have this one:

                                          ERROR: Invalid value given for boolean command line option 'sql-mysql'.
                                          
                                          jsulmJ Offline
                                          jsulmJ Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #40

                                          @hobbyProgrammer Can you show your current configure call?

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

                                          H 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