Issues with QMYSQL driver on Windows/MariaDB
-
Hi,
I have installed Qt 5.6 on Windows 7 and have MariaDB 10.1.9.
Version info from Help->About Qt Creator:
"Qt Creator 4.0.0
Based on Qt 5.6.0 (MSVC 2013, 32 bit)
Built on May 10 2016 01:09:29
From revision 605ea627cc"When I try to use QMYSQL driver to connect to a database I get the following errors:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7See code below.
I have found the dll's I think are needed in two places:
C:\Qt\5.6\mingw49_32\plugins\sqldrivers:
qsqlite.dll
qsqlited.dll
qsqlmysql.dll
qsqlmysqld.dll
qsqlpsql.dll
qsqlpsqld.dllC:\Qt\Tools\QtCreator\bin\plugins\sqldrivers:
qsqlite.dll
qsqlmysql.dll
qsqlpsql.dllAnd I have libmysql.dll here:
C:\Program Files\MariaDB 10.1\lib\libmysql.dllI copied libmysql.dll to C:\Qt\5.6\mingw49_32\bin to no avail. Also I tried to add C:\Program Files\MariaDB 10.1\lib to %PATH%.
Then I was going to try instructions from here:
http://doc.qt.io/qt-5/sql-driver.html#qmysql :cd %QTDIR%\qtbase\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MYSQL/MySQL Server <version>/lib/opt/libmysql.lib" mysql.pro
nmake [I think I should use mingw32-make.exe instead]However environment variables seems not to have been set. Although I open a cmd from: "Start->All programs->Qt->5.6->MinGW 4.9.2 (32 bit) ->Qt 5.6 for Desktop". echo %QTDIR% does show anything.
Also there seem to be no qtbase or src folder and no source files for drivers. In older Qt versions I have seen that there are main.cpp and mysql.pro files that you can build the driver from.
I know there have been many questions on the QMYSQL already, but I couldn't find these problems specifically.
Thanks!
#include <QCoreApplication> #include <QtSQL> #include <QtDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); qDebug() << QSqlDatabase::drivers(); QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("localhost"); db.setDatabaseName("dbname"); db.setUserName("root"); db.setPassword("mypassword"); if (db.open()) { qDebug() << "It's opened!"; } return a.exec(); } -
Hi and welcome to devnet,
First thing to check: is your client library also built for MinGW and not visual studio ?
If you want to rebuild the plugin yourself, then you'll have to just install the source package from the installer.
Hope it helps.
-
Hi and welcome to devnet,
First thing to check: is your client library also built for MinGW and not visual studio ?
If you want to rebuild the plugin yourself, then you'll have to just install the source package from the installer.
Hope it helps.
Thank you!
I downloaded the source now by using Qt Maintenance Tool (Update Components and checked only Qt 5.6->Source Components->Qt Source Package + LGPLv3 Source Packages). Unfortunately this seemed to have removed non-selected components. But I uninstalled Qt and reinstalled again from qt.io so now it's hopefully ok with both source and all components.
And I did get the src directory and files for MySQL:
C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>dir /b
main.cpp
mysql.json
mysql.pro
READMEBut how do I check if it's built for Visual Studio or MinGW? My QtCreator is using MinGW so I think it should be this version automatically? And do you mean the drivers in Qt's folders or libmysql.dll?
Thanks
-
The plugin is built for the compiler matching the package you choose.
I meant libmysql.dll
-
So I need to get another version of libmysql.dll which is compiled with MinGW? I found these instructions:
1) Creating the MySQL client library. Unfortunatly, the client libraries (libmysql.ddl and libmysql.lib) shipped with MySQL are compiled with the M$ compiler and are causing problems with try to link them with the MinGW compiler. Therefore, we first need to create a MinGW compatible library out of libmysql.dll. This can be done by taking the following steps: 1.cd c:\mysql\lib\opt (c:\mysql is where our MySQL is installed) 2.reimp -d libmysql.lib (reimp comes with MinGW utilities) 3.dlltool -k –input-def libmysql.def –dllname libmysql.dll –output-lib libmysql.a (http://zhucongqi.cn/blog/2012-04-19-building-the-mysql-driver-for-qt4(mingw)/)dlltool is included in C:\Qt\Tools\mingw492_32\bin. But reimp is missing although it seems to say it should be included with MinGW.
-
I tried to compile the source code but it failed with this message:
"In file included from main.cpp:36:0:
../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>"But I do have the file mysql.h:
C:\Program Files\MariaDB 10.1\include\mysql>dir mysql.h
...
2015-11-20 18:08 39 069 mysql.h
...And I Included the path with:
qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Files\MariaDB 10.1\lib\libmysql.lib" mysql.proI also tried qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include\mysql", and / and two \ instead of one backslash.
Can you see what could be wrong here?
C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Fil es\MariaDB 10.1\lib\libmysql.lib" mysql.pro C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make.exe mingw32-make.exe -f Makefile.Release all mingw32-make.exe[1]: Entering directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++1y -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_N O_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IC:/utils/postgresql/pgsql/include -IC:/utils/my_sql/my_sql/include -IC:/openssl/include -IC:\Program -IFiles\MariaDB -I10.1\include -IC:\Qt\5.6\mingw49_32\include\Q tSql\5.6.1 -IC:\Qt\5.6\mingw49_32\include\QtSql\5.6.1\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore\5.6.1 -IC:\Qt\5.6\mingw49_32\inc lude\QtCore\5.6.1\QtCore -IC:\Qt\5.6\mingw49_32\include -IC:\Qt\5.6\mingw49_32\include\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore -I.moc\release -I..\..\..\..\mkspecs\win32-g++ -o .obj\release\main.o main.cpp In file included from main.cpp:36:0: ../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. Makefile.Release:468: recipe for target '.obj/release/main.o' failed mingw32-make.exe[1]: *** [.obj/release/main.o] Error 1 mingw32-make.exe[1]: Leaving directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' makefile:38: recipe for target 'release-all' failed mingw32-make.exe: *** [release-all] Error 2 -
Windows and paths with spaces don't mix well for development. You should rather install MariaDB in a path without any space. That will save you a whole lot of trouble.
-
I tried with QODBC and this worked! Because I reinstalled Qt I got QODBC which wasn't in the previous version, I think. Followed these instructions to first install DSN from MySQL (32 bit, the 64 bit seemed not to work).
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC"); db.setDatabaseName("Driver={MySQL ODBC 5.3 Unicode Driver};DATABASE=dbname;"); db.setUserName("root"); db.setPassword("mypassword");Unless I can get the QMYSQL to work this may be an acceptable workaround. Perhaps if someone else has problem with QMYSQL they could try with QODBC from the new Qt version.
-
I tried to compile the source code but it failed with this message:
"In file included from main.cpp:36:0:
../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>"But I do have the file mysql.h:
C:\Program Files\MariaDB 10.1\include\mysql>dir mysql.h
...
2015-11-20 18:08 39 069 mysql.h
...And I Included the path with:
qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Files\MariaDB 10.1\lib\libmysql.lib" mysql.proI also tried qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include\mysql", and / and two \ instead of one backslash.
Can you see what could be wrong here?
C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Fil es\MariaDB 10.1\lib\libmysql.lib" mysql.pro C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make.exe mingw32-make.exe -f Makefile.Release all mingw32-make.exe[1]: Entering directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++1y -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_N O_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IC:/utils/postgresql/pgsql/include -IC:/utils/my_sql/my_sql/include -IC:/openssl/include -IC:\Program -IFiles\MariaDB -I10.1\include -IC:\Qt\5.6\mingw49_32\include\Q tSql\5.6.1 -IC:\Qt\5.6\mingw49_32\include\QtSql\5.6.1\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore\5.6.1 -IC:\Qt\5.6\mingw49_32\inc lude\QtCore\5.6.1\QtCore -IC:\Qt\5.6\mingw49_32\include -IC:\Qt\5.6\mingw49_32\include\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore -I.moc\release -I..\..\..\..\mkspecs\win32-g++ -o .obj\release\main.o main.cpp In file included from main.cpp:36:0: ../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. Makefile.Release:468: recipe for target '.obj/release/main.o' failed mingw32-make.exe[1]: *** [.obj/release/main.o] Error 1 mingw32-make.exe[1]: Leaving directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' makefile:38: recipe for target 'release-all' failed mingw32-make.exe: *** [release-all] Error 2@ael16 said:
I tried to compile the source code but it failed with this message:
"In file included from main.cpp:36:0:
../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>"But I do have the file mysql.h:
C:\Program Files\MariaDB 10.1\include\mysql>dir mysql.h
...
2015-11-20 18:08 39 069 mysql.h
...And I Included the path with:
qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Files\MariaDB 10.1\lib\libmysql.lib" mysql.proI also tried qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include\mysql", and / and two \ instead of one backslash.
Can you see what could be wrong here?
C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Fil es\MariaDB 10.1\lib\libmysql.lib" mysql.pro C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make.exe mingw32-make.exe -f Makefile.Release all mingw32-make.exe[1]: Entering directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++1y -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_N O_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IC:/utils/postgresql/pgsql/include -IC:/utils/my_sql/my_sql/include -IC:/openssl/include -IC:\Program -IFiles\MariaDB -I10.1\include -IC:\Qt\5.6\mingw49_32\include\Q tSql\5.6.1 -IC:\Qt\5.6\mingw49_32\include\QtSql\5.6.1\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore\5.6.1 -IC:\Qt\5.6\mingw49_32\inc lude\QtCore\5.6.1\QtCore -IC:\Qt\5.6\mingw49_32\include -IC:\Qt\5.6\mingw49_32\include\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore -I.moc\release -I..\..\..\..\mkspecs\win32-g++ -o .obj\release\main.o main.cpp In file included from main.cpp:36:0: ../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. Makefile.Release:468: recipe for target '.obj/release/main.o' failed mingw32-make.exe[1]: *** [.obj/release/main.o] Error 1 mingw32-make.exe[1]: Leaving directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' makefile:38: recipe for target 'release-all' failed mingw32-make.exe: *** [release-all] Error 2Change it to below and re-test:
#include <mysql/mysql.h>" -
@ael16, sorry, I misread your setup.
As @Hamed-Masafi indirectly pointed, your INCLUDEPATH statement doesn't include the
mysqlfolder underinclude. That's why the header wasn't found in the first place.But still, the recommendation about spaces in path holds for Windows, it's usually at link time that the trouble begins.
-
@ael16 said:
I tried to compile the source code but it failed with this message:
"In file included from main.cpp:36:0:
../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>"But I do have the file mysql.h:
C:\Program Files\MariaDB 10.1\include\mysql>dir mysql.h
...
2015-11-20 18:08 39 069 mysql.h
...And I Included the path with:
qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Files\MariaDB 10.1\lib\libmysql.lib" mysql.proI also tried qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include\mysql", and / and two \ instead of one backslash.
Can you see what could be wrong here?
C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MariaDB 10.1\include" "LIBS+=C:\Program Fil es\MariaDB 10.1\lib\libmysql.lib" mysql.pro C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make.exe mingw32-make.exe -f Makefile.Release all mingw32-make.exe[1]: Entering directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++1y -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_N O_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IC:/utils/postgresql/pgsql/include -IC:/utils/my_sql/my_sql/include -IC:/openssl/include -IC:\Program -IFiles\MariaDB -I10.1\include -IC:\Qt\5.6\mingw49_32\include\Q tSql\5.6.1 -IC:\Qt\5.6\mingw49_32\include\QtSql\5.6.1\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore\5.6.1 -IC:\Qt\5.6\mingw49_32\inc lude\QtCore\5.6.1\QtCore -IC:\Qt\5.6\mingw49_32\include -IC:\Qt\5.6\mingw49_32\include\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore -I.moc\release -I..\..\..\..\mkspecs\win32-g++ -o .obj\release\main.o main.cpp In file included from main.cpp:36:0: ../../../sql/drivers/mysql/qsql_mysql_p.h:55:19: fatal error: mysql.h: No such file or directory #include <mysql.h> ^ compilation terminated. Makefile.Release:468: recipe for target '.obj/release/main.o' failed mingw32-make.exe[1]: *** [.obj/release/main.o] Error 1 mingw32-make.exe[1]: Leaving directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' makefile:38: recipe for target 'release-all' failed mingw32-make.exe: *** [release-all] Error 2Change it to below and re-test:
#include <mysql/mysql.h>"Unfortunately it didn't help.
I changed C:\Qt\5.6\Src\qtbase\src\sql\drivers\mysql\qsql_mysql_p.h to #include <mysql/mysql.h>
Then qmake:
C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:/Program Files/MariaDB 10.1/include" "LIBS+=C:/Program Files/MariaDB 10.1/lib/libmysql.lib" mysql.proNow my Makefile has this row:
$(QMAKE) "INCLUDEPATH+=C:/Program Files/MariaDB 10.1/include" "LIBS+=C:/Program Files/MariaDB 10.1/lib/libmysql.lib" -o Makefile mysql.proThen make complains about No such file or directory #include <mysql/mysql.h>:
C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make.exe mingw32-make.exe -f Makefile.Release all mingw32-make.exe[1]: Entering directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++1y -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_N O_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IC:/utils/postgresql/pgsql/include -IC:/utils/my_sql/my_sql/include -IC:/openssl/include -IC:/Program -IFiles/MariaDB -I10.1/include -IC:\Qt\5.6\mingw49_32\include\Q tSql\5.6.1 -IC:\Qt\5.6\mingw49_32\include\QtSql\5.6.1\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore\5.6.1 -IC:\Qt\5.6\mingw49_32\inc lude\QtCore\5.6.1\QtCore -IC:\Qt\5.6\mingw49_32\include -IC:\Qt\5.6\mingw49_32\include\QtSql -IC:\Qt\5.6\mingw49_32\include\QtCore -I.moc\release -I..\..\..\..\mkspecs\win32-g++ -o .obj\release\main.o main.cpp In file included from main.cpp:36:0: ../../../sql/drivers/mysql/qsql_mysql_p.h:55:25: fatal error: mysql/mysql.h: No such file or directory #include <mysql/mysql.h> ^ compilation terminated. Makefile.Release:468: recipe for target '.obj/release/main.o' failed mingw32-make.exe[1]: *** [.obj/release/main.o] Error 1 mingw32-make.exe[1]: Leaving directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' makefile:38: recipe for target 'release-all' failed mingw32-make.exe: *** [release-all] Error 2 -
If you take a look a the the list of -I options, you'll see that each element between spaces is used. You have to quote the path itself when passing the parameter.
-
I tried on another server and got the same errors with "QMYSQL driver not loaded". But after installing the 32 bit version of MariaDB everything was ok. I will not reinstall MariaDB on the first computer atm, but this may be the error here to as I have 32 bit Qt but 64 bit MariaDB. (The new computer used MSVC though)
Thanks for pointing out the error with spaces. I tried to use many kinds of quoting but nothing seemed to work. I used the advice here with dir /x: http://seppemagiels.com/blog/create-mysql-driver-qt5-windows
qmake "INCLUDEPATH+=C:/PROGRA~1/MARIAD~1.1/include" "LIBS+=C:/PROGRA~1/MARIAD~1.1/lib/libmysql.lib" mysql.pro
This was ok. But then there was another error with make. But, as already stated, this may be solved with 32 bit MariaDB. Same error is discussed here: http://www.qtcentre.org/threads/21420-MySQL-driver-Very-strange-problem-PLEASE-HELP-ME-Thanks
But I think this can be marked solved.C:\Qt\5.6\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make.exe mingw32-make.exe -f Makefile.Release all mingw32-make.exe[1]: Entering directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' g++ -Wl,-s -shared -Wl,-subsystem,windows -Wl,--out-implib,C:\Qt\5.6\Src\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ..\..\..\..\p lugins\sqldrivers\qsqlmysql.dll .obj/release/main.o .obj/release/qsql_mysql.o .obj/release/moc_qsql_mysql_p.o -LC:\utils\postgres ql\pgsql\lib -LC:\utils\my_sql\my_sql\lib C:\PROGRA~1\MARIAD~1.1\lib\libmysql.lib -LC:\Qt\5.6\mingw49_32\lib C:\Qt\5.6\mingw49_32\ lib\libQt5Sql.a C:\Qt\5.6\mingw49_32\lib\libQt5Core.a .obj\release\qsqlmysql_resource_res.o .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x110): undefined reference to `mysql_num_rows@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x13b): undefined reference to `mysql_stmt_num_rows@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1da): undefined reference to `mysql_num_rows@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x207): undefined reference to `mysql_stmt_num_rows@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x24e): undefined reference to `mysql_stmt_insert_id@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x28a): undefined reference to `mysql_insert_id@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x478): undefined reference to `mysql_character_set_name@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x6b9): undefined reference to `mysql_errno@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x6d0): undefined reference to `mysql_field_seek@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x6fc): undefined reference to `mysql_field_seek@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x707): undefined reference to `mysql_fetch_field@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x74f): undefined reference to `mysql_fetch_field@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x911): undefined reference to `mysql_error@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x920): undefined reference to `mysql_errno@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa7a): undefined reference to `mysql_errno@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xae1): undefined reference to `mysql_stmt_error@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xaee): undefined reference to `mysql_stmt_errno@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc50): undefined reference to `mysql_fetch_row@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc97): undefined reference to `mysql_stmt_fetch@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xdb0): undefined reference to `mysql_stmt_data_seek@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xdc1): undefined reference to `mysql_stmt_fetch@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xe2e): undefined reference to `mysql_data_seek@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0xe3f): undefined reference to `mysql_fetch_row@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x12e7): undefined reference to `mysql_fetch_lengths@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2418): undefined reference to `mysql_init@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x257e): undefined reference to `mysql_ssl_set@24' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2789): undefined reference to `mysql_real_connect@32' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2894): undefined reference to `mysql_close@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2b9d): undefined reference to `mysql_set_character_set@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2bb4): undefined reference to `mysql_get_client_version@0' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2bd2): undefined reference to `mysql_thread_init@0' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2c4f): undefined reference to `mysql_real_connect@32' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2e5e): undefined reference to `mysql_ssl_set@24' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2ecb): undefined reference to `mysql_options@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2efb): undefined reference to `mysql_options@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2f2b): undefined reference to `mysql_options@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3174): undefined reference to `mysql_select_db@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x32b6): undefined reference to `mysql_close@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x32d6): undefined reference to `mysql_options@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x32f4): undefined reference to `mysql_get_server_version@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x36f4): undefined reference to `mysql_thread_end@0' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x36ff): undefined reference to `mysql_close@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3cd9): undefined reference to `mysql_list_fields@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3d36): undefined reference to `mysql_fetch_field@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3d45): undefined reference to `mysql_free_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3eda): undefined reference to `mysql_query@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x401a): undefined reference to `mysql_query@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x415a): undefined reference to `mysql_query@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x43d6): undefined reference to `mysql_get_server_version@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x47e3): undefined reference to `mysql_list_tables@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4821): undefined reference to `mysql_data_seek@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x482c): undefined reference to `mysql_fetch_row@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4914): undefined reference to `mysql_free_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4bbb): undefined reference to `mysql_num_fields@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4ca5): undefined reference to `mysql_fetch_field@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4d96): undefined reference to `mysql_stmt_result_metadata@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4dc7): undefined reference to `mysql_free_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4de8): undefined reference to `mysql_next_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4e05): undefined reference to `mysql_stmt_close@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4e2b): undefined reference to `mysql_free_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4ef0): undefined reference to `mysql_store_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x511f): undefined reference to `mysql_real_query@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5220): undefined reference to `mysql_store_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5245): undefined reference to `mysql_field_count@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5287): undefined reference to `mysql_affected_rows@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x533c): undefined reference to `mysql_fetch_field_direct@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x53bd): undefined reference to `mysql_field_count@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x557b): undefined reference to `mysql_next_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x55a3): undefined reference to `mysql_store_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x55bd): undefined reference to `mysql_field_count@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x569b): undefined reference to `mysql_free_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x56e7): undefined reference to `mysql_affected_rows@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x577b): undefined reference to `mysql_fetch_field_direct@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5944): undefined reference to `mysql_stmt_prepare@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x595d): undefined reference to `mysql_stmt_param_count@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x59dc): undefined reference to `mysql_stmt_init@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5b7a): undefined reference to `mysql_stmt_param_count@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5c29): undefined reference to `mysql_stmt_reset@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5e1a): undefined reference to `mysql_stmt_param_count@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5e33): undefined reference to `mysql_stmt_execute@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5f48): undefined reference to `mysql_stmt_affected_rows@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5f78): undefined reference to `mysql_stmt_bind_result@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5f9b): undefined reference to `mysql_stmt_store_result@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5fc9): undefined reference to `mysql_stmt_bind_result@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x604a): undefined reference to `mysql_stmt_param_count@4' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x6395): undefined reference to `mysql_stmt_bind_param@8' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x67fc): undefined reference to `mysql_stmt_attr_set@12' .obj/release/qsql_mysql.o:qsql_mysql.cpp:(.text+0x6ae9): undefined reference to `mysql_real_escape_string@16' C:/Qt/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: .obj/release/qsql_mysql.o: bad reloc address 0x4 in section `.data' collect2.exe: error: ld returned 1 exit status Makefile.Release:65: recipe for target '..\..\..\..\plugins\sqldrivers\qsqlmysql.dll' failed mingw32-make.exe[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysql.dll] Error 1 mingw32-make.exe[1]: Leaving directory 'C:/Qt/5.6/Src/qtbase/src/plugins/sqldrivers/mysql' makefile:38: recipe for target 'release-all' failed mingw32-make.exe: *** [release-all] Error 2 -
You can't mix architectures. While there should be no problem connecting to a 64bit running server with a 32bit client. Loading the 64bit libraries with a 32bit plugin will not work.