Compile MySQL plugin for Qt
-
As I said in the other thread, you need to rebuild Qt to enabled MySQL support. This is more easily done by downloading the stand-alone Qt source package rather than trying to rebuild the Qt that ships as part of the SDK.
Go to "the download site":http://qt.nokia.com/downloads and from the right hand side labelled "Qt: Framework Only" and download the source for your platform and follow my instructions in the previous thread.
-
You can install the sources right from the SDK. Just start the Maintain Qt SDK application and choose to install the sources from there. You only need to compile the driver itself, not the whole of Qt.
-
If you do it that way I think you will also need to install perl. The last time I checked the sources that shipped with the SDK did not have the camelcased headers generated and so the configure step tries to run the synqt perl script to create them.
-
Ok thanks you two. This answer my question.
I downloaded the sources using the Maintain Qt Application and installed PERL
Following "this":http://www.rag.com.au/linux/qt4howto.html, I did this:
@configure -platform win32-g++ -static -release -qt-sql-mysql -l mysql -I "C:\Program Files\MySQL\MySQL Server 5.5\include" -L "C:\Program Files\MySQL\MySQL Server 5.5\lib"@It seems to work but after, the mingw32-make command fails because of the space in the paths...
@g++: Files\MySQL\MySQL: No such file or directory
g++: Server: No such file or directory
g++: 5.5\lib: No such file or directory@It's getting on my nerve, so I'll try again tomorrow...
By the way, I'm recompiling the full Qt here, is there a way to recompile only the myqsl driver ?
Thanks -
What you can do, is create an "NTFS symlink or junction":http://en.wikipedia.org/wiki/NTFS_symbolic_link with a path that does not contain spaces, and use that path instead.
-
Or in the future install MySQL (and other libs) to a location that does not have spaces in the path after being bitten by this many times before ;-)
-
Meanwhile, I hope that at one point, the whole tool chain will be fixed so it simply accepts spaces in paths.
-
Yes. You would hope this is simple in the 21st century. No such luck yet though.
-
Thanks a lot guys!
I finally made it after wasting 2 days to compile this MySQL driver.At first I was compiling the whole sources... It took 3 hours each time.
Then I found that the Qt sources downloaded from the QT Maintain Application were not complete.
[...]
And after a big headache,
here is how I did it: (it might interest someone)- Download Qt SDK and install (C:\QtSDK)
- Download mingw-utils and extract to C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin
- Put the C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin in the %PATH%
- Download Qt Sources and extract them (C:\QtSrc)
- Download and install a perl compiler (like ActivePERL)
- Install MySQL headers and libs in a path without spaces (C:\MySQL)
Open a Command Prompt
@set QTDIR=C:\QtSrc
set MYSQLDIR=C:\MySQLcd %MYSQLDIR%\lib
reimp libmysql.lib
dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib %QTDIR%\src\plugins\sqldrivers\mysql\libmysql.acd %QTDIR%\src\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=%MYSQLDIR%\include" "LIBS+=%MYSQLDIR%\lib\liblibmysql.a" mysql.pro
mingw32-make@Then copy libmysql.dll (from %MYSQLDIR%\lib) to any folder in the %PATH%
Copy %QTDIR%\plugins\sqldrivers\qsqlmysql4.dll & qsqlmysqld4.dll to C:\QtSDK\Desktop\Qt\4.7.3\mingw\plugins\sqldriversand it should be ok.
This seems so simple afterwards... =)
-
Glad you got it working. Good luck with the rest of your project.