PDA

View Full Version : QMYSQL Plugin does not compile



mmaayeh
12th April 2009, 12:10
I tried the instructions to compile and build the MYSQL Plugin using the known instructions:
How to Build the QMYSQL Plugin on Windows

You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):

cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro
nmake

If you are not using a Microsoft compiler, replace nmake with make in the line above.

Note: This database plugin is not supported for Windows CE.

Note: Including "-o Makefile" as an argument to qmake to tell it where to build the makefile can cause the plugin to be built in release mode only. If you are expecting a debug version to be built as well, don't use the "-o Makefile" option.

However, when do compile by changing nmake to make then I get the error:
C:\Qt\2009.01\qt\src\plugins\sqldrivers\mysql>C:\Qt\2009.01\qt\qmake\qmake "INCL
UDEPATH+=C:\Program Files\MySQL\MySQL Server 5.1\include" "LIBS+=C:\Program File
s\MySQL\MySQL Server 5.1\lib\opt\LIBMYSQL.LIB" C:\Qt\2009.01\qt\src\plugins\sqld
rivers\mysql\mysql.pro make
Could not find mkspecs for your QMAKESPEC(win32-g++) after trying:
C:/qt-greenhouse/Trolltech/Code_less_create_more/Trolltech/Code_less_cre
ate_more/Troll/4.5.0/qt\mkspecs
Error processing project file: C:/Qt/2009.01/qt/src/plugins/sqldrivers/mysql/mys
ql.pro
Cannot find file: make.

The c:\qt-greenhouse directory does not exist on my machine therefore, what should have been the correct path relative to my machine?

mmaayeh
24th April 2009, 07:43
Well, for those out there that still had an issue building a plugin especially with MySQL, I was able to successfully compile my plugin and successfully connect to MySQL Server. To make things easier I put the commands into a batch file:


call C:\Qt\2009.01\bin\qtenv.bat
C:\Qt\2009.01\qt\qmake\qmake "INCLUDEPATH+=C:\MYSQL\include" "LIBS+=C:\MYSQL\lib\opt\libmysql.lib" mysql.pro
make
pause


Download junction v1.04 and set up a symbolic link between c:\qt and C:\qt-greenhouse\Trolltech\code_less_create_more\Trollte ch\code_less_create_more\Troll\4.5.0 to avoid a bug in the hard coded QT DLLs that physically look for your QT location in the qt-greenhouse directory and subdirectories.
Furthermore, the issue was in long path names with spaces therefore, I moved the include & lib paths from the root path "C:\Program Files\MySQL\MySQL Server 5.1" to "C:\MYSQL" simply.
I added a call to the batch file qtenv.bat located on my machine call "C:\Qt\2009.01\bin\qtenv.bat" that sets up my environment variables before calling qmake and make commands.
This was my misunderstanding on my part but, in the documentation I assumed the call to make or nmake was the last parameter of qmake (assuming you are looking at documentation with word wrap). But, once I set a call to make on the next line after qmake then, everything fell into place.


The first and second points were the key for me, it seems like long file paths do not get parsed correctly left as is, I did not try but, it seems like you need to qualify folder names with spaces and I was not doing that. I am not sure yet if QT 4.5.0 has the means to qualify the folder name. Also, to get past the linking with c:\qt-greenhouse solved the issue immensely.

Well that is all, I hope this helps someone out there with the same issues.