Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. incorrect parameters for compiling MySQL Plugin on Windows 10
Forum Updated to NodeBB v4.3 + New Features

incorrect parameters for compiling MySQL Plugin on Windows 10

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
12 Posts 2 Posters 766 Views
  • 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.
  • N Offline
    N Offline
    nullbuil7
    wrote on last edited by
    #1

    https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows
    this link claims with the that with the following commands you can compile the MySQL plugin on your machine but qmake doesn't have a -- parameter

    cd %QTDIR%\qtbase\src\plugins\sqldrivers
    qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"
    nmake sub-mysql
    nmake install
    

    how do i compile the dll? i have all the requirements

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

      @nullbuil7 said in incorrect parameters for compiling MySQL Plugin on Windows 10:

      but qmake doesn't have a -- parameter

      It has, please show the output and also the output of qmake -version

      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
      • N Offline
        N Offline
        nullbuil7
        wrote on last edited by
        #3
        PS J:\Qt\Qt5.12.9\5.12.9\mingw73_64\plugins\sqldrivers> qmake -version
        QMake version 3.1
        Using Qt version 5.12.9 in J:/Qt/Qt5.12.9/5.12.9/mingw73_64/lib
        
        PS J:\Qt\Qt5.12.9\5.12.9\mingw73_64\plugins\sqldrivers> qmake -- MYSQL_INCDIR="C:/Program Files/MariaDB/MariaDB Connector C 64-bit/include" MYSQL_LIBDIR="C:/Program Files/MariaDB/MariaDB Connector C 64-bit/lib"
        Usage: J:\Qt\Qt5.12.9\5.12.9\mingw73_64\bin\qmake.exe [mode] [options] [files]
        
        QMake has two modes, one mode for generating project files based on
        some heuristics, and the other for generating makefiles. Normally you
        shouldn't need to specify a mode, as makefile generation is the default
        mode for qmake, but you may use this to test qmake on an existing project
        
        Mode:
          -project       Put qmake into project file generation mode
                         In this mode qmake interprets [files] as files to
                         be added to the .pro file. By default, all files with
                         known source extensions are added.
                         Note: The created .pro file probably will
                         need to be edited. For example add the QT variable to
                         specify what modules are required.
          -makefile      Put qmake into makefile generation mode (default)
                         In this mode qmake interprets files as project files to
                         be processed, if skipped qmake will try to find a project
                         file in your current working directory
        
        Warnings Options:
          -Wnone         Turn off all warnings; specific ones may be re-enabled by
                         later -W options
          -Wall          Turn on all warnings
          -Wparser       Turn on parser warnings
          -Wlogic        Turn on logic warnings (on by default)
          -Wdeprecated   Turn on deprecation warnings (on by default)
        
        Options:
           * You can place any variable assignment in options and it will be *
           * processed as if it was in [files]. These assignments will be    *
           * processed before [files] by default.                            *
          -o file        Write output to file
          -d             Increase debug level
          -t templ       Overrides TEMPLATE as templ
          -tp prefix     Overrides TEMPLATE so that prefix is prefixed into the value
          -help          This help
          -v             Version information
          -early         All subsequent variable assignments will be
                         parsed right before default_pre.prf
          -before        All subsequent variable assignments will be
                         parsed right before [files] (the default)
          -after         All subsequent variable assignments will be
                         parsed after [files]
          -late          All subsequent variable assignments will be
                         parsed right after default_post.prf
          -norecursive   Don't do a recursive search
          -recursive     Do a recursive search
          -set <prop> <value> Set persistent property
          -unset <prop>  Unset persistent property
          -query <prop>  Query persistent property. Show all if <prop> is empty.
          -qtconf file   Use file instead of looking for qt.conf
          -cache file    Use file as cache           [makefile mode only]
          -spec spec     Use spec as QMAKESPEC       [makefile mode only]
          -nocache       Don't use a cache file      [makefile mode only]
          -nodepend      Don't generate dependencies [makefile mode only]
          -nomoc         Don't generate moc targets  [makefile mode only]
          -nopwd         Don't look for files in pwd [project mode only]
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @nullbuil7 said in incorrect parameters for compiling MySQL Plugin on Windows 10:

          J:\Qt\Qt5.12.9\5.12.9\mingw73_64\plugins\sqldrivers

          I'm pretty sure there are no sources in this directory.

          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
          • N Offline
            N Offline
            nullbuil7
            wrote on last edited by
            #5

            fixed the former issue. downloaded the source code and now when i run the qmake command i get this:

            PS J:\Downloads\Compressed\qtbase-5.15.1\qtbase-5.15.1\src\plugins\sqldrivers> qmake -- MYSQL_INCDIR="C:\\MariaDB\\include" MYSQL_LIBDIR="C:\\MariaDB\\lib"
            
            Running configuration tests...
            Done running configuration tests.
            
            Configure summary:
            
            Qt Sql Drivers:
              DB2 (IBM) .............................. no
              InterBase .............................. no
              MySql .................................. yes
              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 'J:\Qt\Qt5.12.9\5.12.9\mingw73_64'.
            
            Prior to reconfiguration, make sure you remove any leftovers from
            the previous build.
            

            which is an issue of it's own because when i run mingw32-make sub-mysql i get this error and i think maybe it's because it's trying to build other ODBC and SQLite too and gives this error:

            PS J:\Downloads\Compressed\qtbase-5.15.1\qtbase-5.15.1\src\plugins\sqldrivers> mingw32-make.exe sub-mysql
            cd mysql\ && ( if not exist Makefile J:\Qt\Qt5.12.9\5.12.9\mingw73_64\bin\qmake.exe -o Makefile J:\Downloads\Compressed\qtbase-5.15.1\qtbase-5.15.1\src\plugins\sqldrivers\mysql\mysql.pro ) && J:/Qt/Qt5.12.9/5.12.9/mingw73_64/bin/mingw32-make -f Makefile
            mingw32-make[1]: Entering directory 'J:/Downloads/Compressed/qtbase-5.15.1/qtbase-5.15.1/src/plugins/sqldrivers/mysql'
            J:/Qt/Qt5.12.9/5.12.9/mingw73_64/bin/mingw32-make -f Makefile.Release all
            mingw32-make[2]: Entering directory 'J:/Downloads/Compressed/qtbase-5.15.1/qtbase-5.15.1/src/plugins/sqldrivers/mysql'
            g++ -c -fno-keep-inline-dllexport -O2 -std=c++1z -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_JAVA_STYLE_ITERATORS -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtSql\5.12.9 -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtSql\5.12.9\QtSql -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtCore\5.12.9 -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtCore\5.12.9\QtCore -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtSql -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtCore -I.moc\release -I"C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include" -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-winx64\include -IC:\Utils\postgresql\pgsql\include -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\mkspecs\win32-g++  -o .obj\release\qsql_mysql.o qsql_mysql.cpp
            process_begin: CreateProcess(NULL, g++ -c -fno-keep-inline-dllexport -O2 -std=c++1z -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_JAVA_STYLE_ITERATORS -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtSql\5.12.9 -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtSql\5.12.9\QtSql -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtCore\5.12.9 -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtCore\5.12.9\QtCore -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtSql -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\include\QtCore -I.moc\release "-IC:\Program Files\MariaDB\MariaDB Connector C 64-bit\include" -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-winx64\include -IC:\Utils\postgresql\pgsql\include -IJ:\Qt\Qt5.12.9\5.12.9\mingw73_64\mkspecs\win32-g++ -o .obj\release\qsql_mysql.o qsql_mysql.cpp, ...) failed.
            make (e=2): The system cannot find the file specified.
            mingw32-make[2]: *** [Makefile.Release:391: .obj/release/qsql_mysql.o] Error 2
            mingw32-make[2]: Leaving directory 'J:/Downloads/Compressed/qtbase-5.15.1/qtbase-5.15.1/src/plugins/sqldrivers/mysql'
            mingw32-make[1]: *** [Makefile:42: release-all] Error 2
            mingw32-make[1]: Leaving directory 'J:/Downloads/Compressed/qtbase-5.15.1/qtbase-5.15.1/src/plugins/sqldrivers/mysql'
            mingw32-make: *** [Makefile:42: sub-mysql] Error 2
            

            in any case it doesn't compile yet.

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

              make (e=2): The system cannot find the file specified.

              You have to run it in your Qt command prompt where g++ is available.

              "-IC:\Program Files\MariaDB\MariaDB Connector C 64-bit\include"

              This does not look correct when you pass C:\MariaDB\include. Please remove all created files and start over. After configure take a look into config.log to see where it really finds the mysql include files and libs.

              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
              1
              • N Offline
                N Offline
                nullbuil7
                wrote on last edited by
                #7
                qsql_mysql.cpp:1243:65: error: 'SkipEmptyParts' is not a member of 'Qt'
                     const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
                                                                                 ^~~~~~~~~~~~~~
                
                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  You're mixing different Qt versions. Clean up again and make sure to call the correct qmake.exe for Qt5.12.9

                  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
                  • N Offline
                    N Offline
                    nullbuil7
                    wrote on last edited by
                    #9

                    first thanks for the replies they've been of great help. I managed to make and install MySQL using visual build tools 2017 and MySQL Connector C 6.1 BUT:
                    now MySQL is only added to the list of sql plugin drivers and this code:

                    #include <QCoreApplication>
                    #include <QtSql>
                    #include <QSqlDatabase>
                    #include <QDebug>
                    
                    int main(int argc, char *argv[])
                    {
                        QCoreApplication a(argc, argv);
                        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                        db.setHostName("127.0.0.1");
                        db.setPort(3306);
                        db.setDatabaseName("test");
                        db.setUserName("testuser");
                        db.setPassword("123");
                        if (db.open())
                        {
                            qDebug() << "Connected!";
                            return 0;
                        }
                        else
                        {
                            qDebug() << "Failed to Connect.";
                            return -1;
                        }
                    
                        return a.exec();
                    }
                    

                    returns:

                    QSqlDatabase: QMYSQL driver not loaded
                    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
                    Failed to Connect.
                    Press <RETURN> to close this window...
                    

                    Obviously some lib file is missing. how do i resolve this?

                    (PS: Got it working with PosgreSql : )

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

                      @nullbuil7 said in incorrect parameters for compiling MySQL Plugin on Windows 10:

                      Obviously some lib file is missing. how do i resolve this?

                      Please please use the forum search function - this question is asked at least twice per week. You're most likely missing some dependency dlls for the mysql plugin when running your app.

                      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
                      1
                      • N Offline
                        N Offline
                        nullbuil7
                        wrote on last edited by
                        #11

                        but I do have all the dlls and lib files

                            Directory: J:\Qt\Qt5.12.9\5.12.9\msvc2017_64\plugins\sqldrivers
                        
                        
                        Mode                 LastWriteTime         Length Name
                        ----                 -------------         ------ ----
                        -a----         12/4/2020  12:32 AM        1199104 qsqlite.dll
                        -a----         12/4/2020  12:32 AM        1867776 qsqlited.dll
                        -a----         12/4/2020  12:31 AM          88576 qsqlodbc.dll
                        -a----         12/4/2020  12:31 AM         208896 qsqlodbcd.dll
                        -a----         6/11/2020  11:42 AM          76920 qsqlpsql.dll
                        -a----         6/11/2020  11:42 AM         183928 qsqlpsqld.dll
                        -a----         12/4/2020  12:31 AM          62464 qsqlmysql.dll
                        -a----         12/4/2020  12:31 AM        1732608 qsqlmysql.pdb
                        -a----         12/4/2020  12:31 AM         181248 qsqlmysqld.dll
                        -a----         12/4/2020  12:31 AM        1863680 qsqlmysqld.pdb
                        -a----         12/4/2020  12:31 AM        1748992 qsqlodbc.pdb
                        -a----         12/4/2020  12:31 AM        1798144 qsqlodbcd.pdb
                        -a----         12/4/2020  12:32 AM        5042176 qsqlite.pdb
                        -a----         12/4/2020  12:32 AM        3772416 qsqlited.pdb
                        

                        anyway I'm using PostgreSQL for now but I do want this bug fixed

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

                          @nullbuil7 said in incorrect parameters for compiling MySQL Plugin on Windows 10:

                          but I do have all the dlls and lib files

                          No you don't have - as I said please use the forum search function. Your sql plugin needs some additional dlls like e.g. the postgresql library...

                          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
                          1

                          • Login

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