PDA

View Full Version : I just don´t get the MySQL Driver Compiled



alex04721
25th February 2010, 08:25
AND YES I SEARCHED FOR IT AND JUST DON´T FIND WORKING MANUALS

I am new to this board so hello guys and girls^^, i have learned C++ and now want to continue with GUI Programming in QT but i have a problem with the MySQL drivers.

My OS is Windows XP Professional SP3 and i use QT 4.6 (2010.01)

i tried
I.
cd QTDIR\..\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MySQL\MySQL Server 5.1\include" "LIBS+=C:\MySQL\MySQL Server 5.1\lib\opt\libmysql.lib" mysql.pro
(nmake)

this is the manual from the QT Documentation, it didn´t work. it works fine until qmake, then i typed in(into the command prompt) "nmake" and it tells me nmake is not a valid command, i also tried make but this one´s too invalid.


i too tried something from the QT Wiki, it doesnt work too. However WIKI is not available ATM.

someone can help me please?

schnitzel
25th February 2010, 17:02
AND YES I SEARCHED FOR IT AND JUST DON´T FIND WORKING MANUALS

I am new to this board so hello guys and girls^^, i have learned C++ and now want to continue with GUI Programming in QT but i have a problem with the MySQL drivers.

My OS is Windows XP Professional SP3 and i use QT 4.6 (2010.01)

i tried
I.
cd QTDIR\..\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MySQL\MySQL Server 5.1\include" "LIBS+=C:\MySQL\MySQL Server 5.1\lib\opt\libmysql.lib" mysql.pro
(nmake)

this is the manual from the QT Documentation, it didn´t work. it works fine until qmake, then i typed in(into the command prompt) "nmake" and it tells me nmake is not a valid command, i also tried make but this one´s too invalid.


i too tried something from the QT Wiki, it doesnt work too. However WIKI is not available ATM.

someone can help me please?

First of all, your paths for mysql contain spaces which will cause problems (at least that's the case with previous version of Qt). Instead copy lib and include files to something like 'c:\mysql\lib' and 'c:\mysql\include'.
Next, I assume you have the sdk that includes mingw, which means that any references to make or nmake should be replaced with mingw32-make. Documentation regarding this point could be a bit clearer in my opinion.

good luck

alex04721
25th February 2010, 19:34
Vielen dank schnitzel^^

Thank you very much, ill try this out tomorrow.

schnitzel
26th February 2010, 01:04
forgot to mention that you can also use short path names (8 character filename, 3 character extension) which can be obtained by 'dir /x'.

alex04721
26th February 2010, 06:24
I did this

cd QTDIR\..\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\libmysql.lib" mysql.pro
mingw32-make

everything went fine. what to do next?

schnitzel
26th February 2010, 07:50
I did this

cd QTDIR\..\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\libmysql.lib" mysql.pro
mingw32-make

everything went fine. what to do next?

so, you didn't get any error messages from the mingw32-make command? Well then congrats :D

Now you have to start using it. I think you just have to 'mingw32-make install' which will put the plugin in the right place.
Look at the Makefile where it goes.
Then write a little testapp to use mysql and see if the driver loads.

alex04721
26th February 2010, 09:02
I get


G:\Qt\2010.01\qt\src\plugins\sqldrivers\mysql>mingw32-make install
mingw32-make -f Makefile.Debug install
mingw32-make[1]: Entering directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mys
ql'
copy /y "..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll" "g:\Qt\2010.01\qt\plugi
ns\sqldrivers\qsqlmysqld4.dll"
Die Datei kann nicht in sich selbst kopiert werden.
0 Datei(en) kopiert.
mingw32-make[1]: [install_target] Error 1 (ignored)
mingw32-make[1]: Leaving directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mysq
l'
mingw32-make -f Makefile.Release install
mingw32-make[1]: Entering directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mys
ql'
copy /y "..\..\..\..\plugins\sqldrivers\qsqlmysql4.dll" "g:\Qt\2010.01\qt\plugin
s\sqldrivers\qsqlmysql4.dll"
Die Datei kann nicht in sich selbst kopiert werden.
0 Datei(en) kopiert.
mingw32-make[1]: [install_target] Error 1 (ignored)
mingw32-make[1]: Leaving directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mysq
l'

Die Datei kann nicht in sich selbst kopiert werden. - The file cannot be copied in to itself
0 Datei(en) kopiert - 0 files copied



Well i try it again beginning with the reimnp and then the qmake

edit: ive tried it again and receive the same errors, i have been very carefully so i don´t make mistakes. But thank you, at least i´m coming forward a little bit^^.

schnitzel
26th February 2010, 15:55
Well i try it again beginning with the reimnp and then the qmake

edit: ive tried it again and receive the same errors, i have been very carefully so i don´t make mistakes. But thank you, at least i´m coming forward a little bit^^.

You shouldn't have to use reimp and it looks like the dlls might have been copied to the proper place already by the make step.

..\qt\plugins\sqldrivers\qsqlmysqld4.dll is the proper location and if that file exists you are set.

good luck

alex04721
26th February 2010, 16:47
no, really there arent any dll files in my plugins\sqldrivers\mysql dir, i also still can´t connect to a mysql database.

schnitzel
26th February 2010, 17:22
no, really there arent any dll files in my plugins\sqldrivers\mysql dir, i also still can´t connect to a mysql database.

you are doing all this from a Qt command prompt - right?
try mingw32-make clean and then make again. I just tried it again and the libs gets created in the right place by the mingw32-make command, i.e. no need to run install.

alex04721
27th February 2010, 17:17
yes i do. mingw32-make clean doesnt work too. if you say it should run, something must be wrong with my qt or something. :( he still says he cant create the dll files becauser he cant copy them into himself but there are no dll files

schnitzel
27th February 2010, 19:47
yes i do. mingw32-make clean doesnt work too. if you say it should run, something must be wrong with my qt or something. :( he still says he cant create the dll files becauser he cant copy them into himself but there are no dll files

hmmm - sounds like your environment is messed up. Just copy them manually from the src tree to where they belong.
Alternatively, try reinstalling Qt.
From a fresh install of the binary installer, it will hopefully work right away, provided you use the Qt Command Prompt (you never mentioned that you did actually use this).

alex04721
28th February 2010, 19:22
sorry, i have used the qt command prompt for everything you told me. I will tryout a reinstall tommorrow, thank you very much for your help^^

alex04721
1st March 2010, 13:36
it still isnt working, if i try mingw32-make install i get this again

i have reinstalled qt some times, i have no idea why its not runnig


G:\Qt\2010.01\qt\src\plugins\sqldrivers\mysql>ming w32-make install
mingw32-make -f Makefile.Debug install
mingw32-make[1]: Entering directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mys
ql'
copy /y "..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dl l" "g:\Qt\2010.01\qt\plugi
ns\sqldrivers\qsqlmysqld4.dll"
Die Datei kann nicht in sich selbst kopiert werden.
0 Datei(en) kopiert.
mingw32-make[1]: [install_target] Error 1 (ignored)
mingw32-make[1]: Leaving directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mysq
l'
mingw32-make -f Makefile.Release install
mingw32-make[1]: Entering directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mys
ql'
copy /y "..\..\..\..\plugins\sqldrivers\qsqlmysql4.dll " "g:\Qt\2010.01\qt\plugin
s\sqldrivers\qsqlmysql4.dll"
Die Datei kann nicht in sich selbst kopiert werden.
0 Datei(en) kopiert.
mingw32-make[1]: [install_target] Error 1 (ignored)
mingw32-make[1]: Leaving directory `G:/Qt/2010.01/qt/src/plugins/sqldrivers/mysq
l'
Die Datei kann nicht in sich selbst kopiert werden. - The file cannot be copied in to itself
0 Datei(en) kopiert - 0 files copied

schnitzel
1st March 2010, 16:52
it still isnt working, if i try mingw32-make install i get this again

i have reinstalled qt some times, i have no idea why its not runnig

I'm sorry I ever mentioned the mingw32-make install part... it is NOT needed. Just mingw32-make should do the trick.

First run 'mingw32-make clean', then show us the entire console log of the 'mingw32-make' command, but please WITHOUT the 'install'. I'd like to see the entire thing.

I know you must be getting quite frustrated, but hang in there.

schnitzel
1st March 2010, 17:00
it still isnt working, if i try mingw32-make install i get this again

i have reinstalled qt some times, i have no idea why its not runnig

I'm also wondering if there could be some permission problem here - why do you install into G drive? Is that some network drive?

alex04721
2nd March 2010, 06:13
thats a long story, in short i have only 20GB on C: Harddrive(the g drive is LOCAL and i am admin of this PC). But i tried this on another Computer too with same results. I guess i´ll try an older version of QT and look what happens.



First run 'mingw32-make clean', then show us the entire console log of the 'mingw32-make' command, but please WITHOUT the 'install'. I'd like to see the entire thing.

I know you must be getting quite frustrated, but hang in there.

ok, thanks. i´ll do this now


here it is^^


G:\Qt\qt\src\plugins\sqldrivers\mysql>qmake -o Makefile "INCLUDEPATH+=C:\MySQL\i
nclude" "LIBS+=C:\MySQL\lib\opt\libmysql.lib" mysql.pro

G:\Qt\qt\src\plugins\sqldrivers\mysql>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `G:/Qt/qt/src/plugins/sqldrivers/mysql'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_STATICPLUGIN -D
QT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\
QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\mysql\includ
e" -I"c:\MySQL\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\release_stat
ic" -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\release_static\main.o main.cpp
G:/Qt/qt/bin/moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT
_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_SQL_LIB -DQ
T_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\inc
lude\QtSql" -I"..\..\..\..\include" -I"c:\mysql\include" -I"c:\MySQL\include" -I
"..\..\..\..\include\ActiveQt" -I"tmp\moc\release_static" -I"..\..\..\..\mkspecs
\win32-g++" -D__GNUC__ -DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.cpp -o tmp\
moc\release_static\qsql_mysql.moc
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_STATICPLUGIN -D
QT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\
QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\mysql\includ
e" -I"c:\MySQL\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\release_stat
ic" -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\release_static\qsql_mysql.o ..\
..\..\sql\drivers\mysql\qsql_mysql.cpp
..\..\..\sql\drivers\mysql\qsql_mysql.cpp: In member function 'virtual QSqlIndex
QMYSQLDriver::primaryIndex(const QString&) const':
..\..\..\sql\drivers\mysql\qsql_mysql.cpp:1368: warning: unused variable 'prepQ'

G:/Qt/qt/bin/moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT
_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_SQL_LIB -DQ
T_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\inc
lude\QtSql" -I"..\..\..\..\include" -I"c:\mysql\include" -I"c:\MySQL\include" -I
"..\..\..\..\include\ActiveQt" -I"tmp\moc\release_static" -I"..\..\..\..\mkspecs
\win32-g++" -D__GNUC__ -DWIN32 ..\..\..\sql\drivers\mysql\qsql_mysql.h -o tmp\mo
c\release_static\moc_qsql_mysql.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_STATICPLUGIN -D
QT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\
QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\include" -I"c:\mysql\includ
e" -I"c:\MySQL\include" -I"..\..\..\..\include\ActiveQt" -I"tmp\moc\release_stat
ic" -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\release_static\moc_qsql_mysql.o
tmp\moc\release_static\moc_qsql_mysql.cpp
ar -ru ..\..\..\..\plugins\sqldrivers\libqsqlmysql.a tmp/obj/release_static/main
.o tmp/obj/release_static/qsql_mysql.o tmp/obj/release_static/moc_qsql_mysql.o
mingw32-make[1]: Leaving directory `G:/Qt/qt/src/plugins/sqldrivers/mysql'

G:\Qt\qt\src\plugins\sqldrivers\mysql>

schnitzel
2nd March 2010, 16:49
ar -ru ..\..\..\..\plugins\sqldrivers\libqsqlmysql.a tmp/obj/release_static/main
.o tmp/obj/release_static/qsql_mysql.o tmp/obj/release_static/moc_qsql_mysql.o

according to the above, the plugin was built - can you try to locate the file libqsqlmysql.a

alex04721
3rd March 2010, 06:27
i have searched my entire HDD with Windows but there is no file called 'libqsqlmysql.a'

something is wrong, but what XD im am brainwashed

schnitzel
3rd March 2010, 17:58
i have searched my entire HDD with Windows but there is no file called 'libqsqlmysql.a'

something is wrong, but what XD im am brainwashed

G:/Qt isn't the default location. Did you move the folder after installation perhaps or did you specify different location during installation?

Look at the build log, from the folder G:/Qt/qt/src/plugins/sqldrivers/mysql the makefile is trying to create: ..\..\..\..\plugins\sqldrivers\libqsqlmysql.a
so this file should be at G:/Qt/plugins/sqldrivers/. Please tell me the files that are in this folder.
f it isn't there then look on the C: drive.
Can you try installing to default location?

alex04721
5th March 2010, 08:36
Creating library file: c:\Qt\2010.02.1\qt\plugins\sqldrivers\libqsqlmysql 4.a
mingw32-make[1]: Leaving directory `C:/Qt/2010.02.1/qt/src/plugins/sqldrivers/my
sql'

what the fuck Oo


hm... he said he created it but there is no *.a file

the file is created but i wonder, its in sqldrivers\ but not in sqldrivers\mysql

ive tested it.



QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC



edit : the qsqlmysql4.dll is created in C:\Qt\2010.02.1\qt\plugins\sqldrivers :)

schnitzel
5th March 2010, 17:09
the file is created but i wonder, its in sqldrivers\ but not in sqldrivers\mysql

ive tested it.

regarding the .a and .dll... I think the .a is an intermediate step and the archiver will create a dll from it. Yes, the destination is a bit different than the structure of the src folder - this is not that surprising to me.


the qsqlmysql4.dll is created in C:\Qt\2010.02.1\qt\plugins\sqldrivers :)

ok, we're getting closer.
Now when you start the Qt prompt, make sure you have the correct path in there, otherwise Qt won't be able to locate the plugins.
Also, make sure you are running the release version of your app, OR make sure you also build the debug version of the qslqmysql dll, which is called qsqlmysqld4.dll.

And make sure the mysql client lib is in your path.

alex04721
8th March 2010, 11:00
i do not exactly know whaht you mean. I am usually working with the QT Creator. I compiled my mysql app with the QT Creator in Release Mode so CONFIG+=release is set. But the plugin still isn´t found.

schnitzel
8th March 2010, 17:20
just for a test, create a folder and put the following in it:
QtGui4.dll
QtCore4.dll
QtSql4.dll
libgcc_s_dw2-1.dll
mingwm10.dll
<yourapp>.exe
libmysql.dll
plugins <--- create this folder and copy qslqmysql.dll into it

Then start a Qt command prompt and try running your program.

btw: you do have the following line in your .pro file right?
QT += sql

schnitzel
8th March 2010, 17:20
sorry, duplicate post