Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-25600

Instruction for adding MySQL Support for QT-SDK under Windows using Mingw32 is incomplete



    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Out of scope
    • Affects Version/s: Some future release
    • Fix Version/s: None
    • Component/s: Documentation
    • Labels:
    • Environment:
      QT SDK 4.6, Windows (any Version), Mingw32, Mysql Connector C


      i like to correct a bug on the website http://doc.qt.nokia.com/4.6/sql-driver.html#qmysql.
      The installation instruction is missing some very important details. It took me several hours to find out how to add MySQL support to my QT-SDK. The working instruction is the following:

      First you wrote that I shall install MySQL and select to install also the libraries. This option does not exist in the MySQL community version. The C libraries come in a separate installation package called "MySQL Connector /C". So this one is needed instead what you wrote. You should highlight that the MSI installer installs them in a write-protected directory under c:\program files, which causes that the following steps fail. So users better shall download the ZIP package without MSI installer or copy the "lib" and "include" directory to c:\qt-sdk\mysql where they have regular write permission.

      You forgot to mention, that the Windows libmysql.dll file must be converted to libmysql.a, otherwise the Mingw compiler cannot use it. For this step, we need the program "reimp", which is part of the Mingw Utilities package and which is obviously missing in the QT-SDK. Maybe you add it to the next release, so we dont need to search for it.

      To create the libmysql.a, enter the follwing commands:

      cd c:\qt-sdk\mysql\lib\opt
      reimp -d libmysql.dll
      dlltool -k --input-def MIBMYSQL.def --dllname libmysql.dll --output-lib libmysql.a
      cp libmysql.a c:\qt-sdk\mingw\lib

      As I wrote previously, this does not work under c:\program files. No error message occurs, but the libmysql.a file is simply missing if you try it.

      Since the QT-SDK does not contain database support at all by default, I assume that it must be recompiled completely. Compiling MySQL module requires that you configure that path to the mysql library:

      cd c:\qt-sdk\qt
      configure -debug-and-release -qt-sql-odbc -qt-sql-mysql -l mysql -I c:\qt-sdk\mysql\include -L c:\qt-sdk\mysql\lib\opt
      cd c:\qt-sdk\qt\src\plugins\sqldrivers\mysql
      qmake "INCLUDEPATH+=c:\qt-sdk\mysql\include" "LIBS+=c:\qt-sdk\mysql\lib\opt\libmysql.a" mysql.pro
      cd c:\qt-sdk\qt

      With version 4.6 (I did not try others) the compilation might stop after 2 hours or so with the following error message (which is already discussed somewehre else):

      Creating library file: c:\qt-sdk\qt\lib\libQtWebKitd4.a
      ./obj\debug\QNetworkReplyHandler.o:QNetworkReplyHandler.cpp.text+0x5a): undefined reference to `vtable for WebCore::FormDataIODevice'

      To fix it, delete the following files:


      Then run mingw32-make again. Now it will finish successflly.

      Clear thre plugin cache, by deleting all entries in the windows registry (using regedit) that start with

      HKEY_CURRENT_USER\Software\Trolltech\OrganizationDefaults\Qt Plugin Cache ...

      That's it.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              mabrand Mark Brand
              s.frings Stefan Frings
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created:

                Time Tracking

                Original Estimate - 1 hour
                Remaining Estimate - 1 hour
                Time Spent - Not Specified
                Not Specified

                  Gerrit Reviews

                  There are no open Gerrit changes