Hi,

Basically, I follow the instructions here to build the QMYSQL plugin (except for running setup.exe, that wasn't recognized). The qmake step proceeds without error, and upon running mingw32-make, the library compiles, but then linking fails with a bunch of error messages like these:

tmp/obj/debug_shared/qsql_mysql.o: In function `codec':

C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.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_mysql.cpp:234: undefined reference to `mysql_error@4'

C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.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_mysql.cpp:309: undefined reference to `mysql_stmt_error@4'

C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.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_stmt_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_fetch_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_free_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_store_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:440: undefined reference to `mysql_free_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:437: undefined reference to `mysql_next_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:446: undefined reference to `mysql_stmt_close@4'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:452: undefined reference to `mysql_free_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:496: undefined reference to `mysql_stmt_data_seek@12'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:498: undefined reference to `mysql_stmt_fetch@4'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:513: undefined reference to `mysql_data_seek@12'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:514: undefined reference to `mysql_fetch_row@4'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:529: undefined reference to `mysql_stmt_fetch@4'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:544: undefined reference to `mysql_fetch_row@4'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:565: undefined reference to `mysql_stmt_num_rows@4'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:570: undefined reference to `mysql_num_rows@4'

tmp/obj/debug_shared/qsql_mysql.o:C:\Qt\2010.05\qt\src\plugins\sqldrive rs\mysql/../../../sql/drivers/mysql/qsql_mysql.cpp:614: undefined reference to `mysql_fetch_lengths@4'
This is a problem that has cropped up for a number of people (discussed most thoroughly in #3, #4):

#1
#2
#3
#4

But none of the discussions resolve the issue (for me)--I am already linking to the libraries specified. I get the same thing whether I use

>mingw32-make

or

>mingw32-make -I"C:/Program Files/MySQL/MySQL Server 5.1/lib/opt/libmysql.lib" -lmysql

From #4, it appears that this problem in fact arises from an incompatibility between minGW and MySQL function definitions. A patch is described there, but I don't know how to implement it or if it's appropriate for me.

Has anybody successfully built MySQL drivers in Windows (7), using MySQL 5? What did you do? Does anyone otherwise know what to do here? I get exactly the same thing when I try to build the library from within Qt Creator, via mysql.pro. Thanks--

Matt