How to create the plugin of MARIADB for Qt5
-
C:\Qt\5.10.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql>mingw32-make g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\utils\my_sql\my_sql\include -IC:\utils\postgresql\pgsql\include -IC:\openssl\include -IC:\PROGRA~2\MARIAD~1.2\include -IC:\Qt\5.10.1\mingw53_32\mkspecs\win32-g++ -o main.o main.cpp main.cpp:5:19: fatal error: mysql.h: No such file or directory compilation terminated. Makefile:439: recipe for target 'main.o' failed mingw32-make: *** [main.o] Error 1
-
Where exactly do you have that file in your system ?
-
C:\Program Files (x86)\MariaDB 10.2\include\mysql
C:\Program Files (x86)\MariaDB 10.2\include\mysql\server -
Then you are missing the
mysql
folder in the path given to MYSQL_INCDIR -
qmake -- MYSQL_INCDIR=C:\PROGRA~2\MARIAD~1.2\include\mysql "MYSQL_LIBDIR=C:\PROGRA~2\MARIAD~1.2\lib"
Configure summary:
Qt Sql:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... yes
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no -
Again, check what happens if you try to build the MySQL test application.
-
C:\Qt\5.10.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql>mingw32-make
g++ -Wl,-s -Wl,-subsystem,console -mthreads -o mysql.exe main.o -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -LC:\PROGRA~2\MARIAD~1.2\lib -llibmysql
C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
collect2.exe: error: ld returned 1 exit status
Makefile:64: recipe for target 'mysql.exe' failed
mingw32-make: *** [mysql.exe] Error 1My lib folder is:
C:\Program Files (x86)\MariaDB 10.2\lib
libmariadb.dll
libmariadb.lib
libmariadb.pdb
mariadbclient.lib
mysqlservices.lib -
Try setting
MYSQL_LIBS
to-lmariadb
in addition to the other variables you already set. -
qmake -- MYSQL_INCDIR=C:\PROGRA~2\MARIAD~1.2\include\mysql "MYSQL_LIBDIR=C:\PROGRA~2\MARIAD~1.2\lib" MYSQL_LIBS="-llibmariadb"
OK this work.
Thank you for your dedicated time.blackout69
-
I follow your step to build static mysql but got fail
0: set mysql=c:\mysql
1: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers
2: qmake sqldrivers.pro
3: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
4: qmake -- MYSQL_INCDIR=C:\mysql\include "MYSQL_LIBDIR=C:\mysql\lib" MYSQL_LIBS="-lmariadbclient"
got error after this step
Project ERROR: Library 'mysql' is not defined.
5: cd C:\Qt\Qt5.12.0\5.12.0\Src\qtbase\src\plugins\sqldrivers
6: qmake -- MYSQL_INCDIR=C:\mysql\include "MYSQL_LIBDIR=C:\mysql\lib" MYSQL_LIBS="-lmariadbclient"
no error after this step
7: nmake sub-mysql
got error after this step
NMAKE : fatal error U1073: 不知道如何生成“sub-mysql” Stop.
( NMAKE : fatal error U1073: don't know how to generate “sub-mysql” Stop.)could you help me to correct the steps?
I don't know which step or path is wrong.
Many thanks .