Details
-
Bug
-
Resolution: Out of scope
-
P4: Low
-
None
-
Some future release
-
None
-
QT SDK 4.6, Windows (any Version), Mingw32, Mysql Connector C
Description
Hello,
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
mingw32-make
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:
\src\script\tmp\moc\debug_shared\mocinclude.tmp
\src\script\tmp\moc\release_shared\mocinclude.tmp
\src\3rdparty\webkit\WebCore\tmp\moc\debug_shared\mocinclude.tmp
\src\3rdparty\webkit\WebCore\tmp\moc\release_shared\mocinclude.tmp
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.