PDA

View Full Version : Can't build mysql plugin on w7 -64



Tottish
12th December 2010, 15:55
Hi!
So, here we go again. I've decided to develop applications on my laptop so I'm back to scratch on compiling the driver for mySQL.
I've already done it on my desktop computer (and it drove me to the edge of sanity) with the same operating system so I was hoping that the same .a and .dll's would work, but no. Unfortunately I don't remember exactly how I got it to work but I do remember it was by compiling it with nmake and it has worked fine for a good while even though I usually use minGW for compiling my applications.

Any way, Ive tied the standard way (using nmake) from the docs (http://doc.qt.nokia.com/4.7/sql-driver.html#qmysql) and I get this error a short while after running nmake:




g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-ps
eudo-reloc -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\2010.05\qt\plugins\sqldr
ivers\libqsqlmysqld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll tmp/obj
/debug_shared/main.o tmp/obj/debug_shared/qsql_mysql.o tmp/obj/debug_shared/mo
c_qsql_mysql.o -L"c:\Qt\2010.05\qt\lib" -L"c:\Qt\2010.05\qt\lib" tmp\obj\debug_
shared\qsqlmysqld_resource_res.o C:\mysql51\lib\opt\libmysql.lib -lQtSqld4 -lQtC
ored4
Creating library file: c:\Qt\2010.05\qt\plugins\sqldrivers\libqsqlmysqld4 .a
tmp/obj/debug_shared/qsql_mysql.o: In function `codec':
C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_my
sql.cpp:223: undefined reference to `mysql_character_set_name@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `qMakeError':
C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_my
sql.cpp:234: undefined reference to `mysql_error@4'
C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_my
sql.cpp:237: undefined reference to `mysql_errno@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `qMakeStmtError':
C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_my
sql.cpp:309: undefined reference to `mysql_stmt_error@4'
C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_my
sql.cpp:312: undefined reference to `mysql_stmt_errno@4'
tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/
../../../sql/drivers/mysql/qsql_mysql.cpp:358: undefined reference to `mysql_stm
t_result_metadata@4'
tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/
../../../sql/drivers/mysql/qsql_mysql.cpp:362: undefined reference to `mysql_num
_fields@4'
tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/
../../../sql/drivers/mysql/qsql_mysql.cpp:369: undefined reference to `mysql_fet
ch_field@4'
tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/
../../../sql/drivers/mysql/qsql_mysql.cpp:432: undefined reference to `mysql_fre
e_result@4'
tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/
../../../sql/drivers/mysql/qsql_mysql.cpp:438: undefined reference to `mysql_sto
re_result@4'

......

......

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/
../../../sql/drivers/mysql/qsql_mysql.cpp:1507: undefined reference to `mysql_re
al_escape_string@16'
collect2: ld returned 1 exit status
NMAKE : fatal error U1077: 'C:\Qt\2010.05\mingw\bin\g++.EXE' : return code '0x1'

Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\bin\nmake.exe"' : return code '0x2'
Stop.


Could anyone help me with this?
Thanks a lot!
/Tottish

crazymonkey
27th April 2011, 09:35
did you manage to fix this? im having the same problem

Tottish
27th April 2011, 10:33
Sorry but I didn't... at least not in any conventional sense.
When I wrote the above posts I basically sat two days straight with this problem without anything to show for it. About a week ago I spent another whole day trying to get it to work, but no dice.
This made me so frustrated since I had it all up and running on my other computer with the very same OS but can not for the life of me remember how I compiled it since I had been trying a million and a half ways.

So what did I do? (Not recommended to anyone, I know this is extremely ugly but it actually runs excellent):
So I had the SDK+compiled MySQL-plugin up'n'running on my desktop computer but not on my laptop (with the same OS), right?
1. I located the SDK install-file (think it was 2010.05), removed anything related to Qt from the laptop harddrive and then made a full install on my laptop directly in 'C:\' (where a folder named 'Qt' was generated by the install).
2. Deleted the complete content in the 'Qt'-root folder.
3. Copied the entire content of the Qt-folder from my desktop PC and pasted in the Qt-folder on my Laptop. (The install folder was the same on my Desktop PC (C:\Qt) which I'm guessing could be crucial)
4. Presto, everything seems to be working perfect(!!!).
Can't say that I expected this to work, but it did.

This has made me wonder (since I'm under the impression that compiling this driver under Win is a huge pain in the butt and that me and crazymonkey aren't the only ones that think so) why not just have a bunch of pre-compiled drivers with the necessary files to go with them for us not too experienced developers to download and use?
Or even better, provide a guide that actually works? I dare say, after all those hours I spent that I have tried most of them out there and each and every have a different approach making different statements about what one must do in order to make it work (including having to recompile Qt from source) and more importantly, none of them seem to actually do the trick out of the box. =)

I'll send the the guys at Nokia/Qt-department a note on this, shouldn't be much of a newsflash but the least I can do if I want to complain is to direct it to someone who might find it in their heart to help out. =)

Have an awesome day!
/Tottish

crazymonkey
27th April 2011, 11:49
this is such a problem, i need to interface with mysql and it has no support for ODBC (only jdbc)

so my only way to do this is to compile the mysql drivers for Qt, ive been at this for 3 days, and its so frustrating, people keep telling me to look at the support documents but they dont help i get the same errors. ive tried every guide on the internet, even the outdated ones. im so frustrated :(

Tottish
27th April 2011, 18:01
Hang in there bro. Sorry I can't be of any help. Try asking in the qt-channel on freenode IRC, those guys might be able to help.

I know you'll get it right sooner or later and when you do, be sure to write down every step of the way and post it back in this thread.
Best of luck to you!
/Tottish