Compile MySQL plugin for Qt
-
Hello,
first, sorry about the topic 20mins ago, I messed up with the versions...
I'll try to be as comprehensible as possible (I'm not a native english speaker).I just downloaded the SDK 1.1, with Qt Creator 2.1.
Inside it, there is no MySQL driver; I know I have to compile it myself.My question is:
Can't I compile this libmysql.a from the pack I just downloaded ? or do I have to download the Qt sources, compile them with the mysql options and all that just to get the libmysql.a.ps: I can't try "this":http://developer.qt.nokia.com/forums/viewthread/5698/, since there is no mysql.pro in the SDK 1.1
[updated the title, Tobias]
-
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.
-
-
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.
-
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... =)