Solved MYSQL drive build, windows 10, qmake does not detected mysql
-
Hi, all. I am trying to build the QMYSQL drive, I followed Document (https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows)
There is no "Libs & Include Files" Module in mysql "Custom Install", so I select the folder from the sql serves.
After running the cmd:
cd C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers qmake -- "MYSQL_INCDIR=C:/MySql/MySQL Server 8.0/include" "MYSQL_LIBDIR=C:/MySql/MySQL Server 8.0/lib"
the result is :
Info: creating stash file C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\.qmake.stash Running configuration tests... Checking for DB2 (IBM)... no Checking for InterBase... no Checking for MySQL... no Checking for OCI (Oracle)... no Checking for ODBC... yes Checking for PostgreSQL... no Checking for SQLite (version 2)... no Checking for TDS (Sybase)... no Done running configuration tests. Configure summary: Qt Sql Drivers: 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 Qt is now configured for building. Just run 'mingw32-make'. Once everything is built, you must run 'mingw32-make install'. Qt will be installed into 'C:\Qt\5.12.6\mingw73_32'. Prior to reconfiguration, make sure you remove any leftovers from the previous build.
it seems like does not detected mysql. what should I do to build the mysql drive.
I just check the the mysql log
Trying source 5 (type inline) of library mysql ... + cd /d C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && C:\Qt\5.12.6\mingw73_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = C:/MySQL/lib/libmysql.lib" "QMAKE_INCDIR_MYSQL = C:/MySQL/include" C:/Qt/5.12.6/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql > Info: creating stash file C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\config.tests\.qmake.stash + cd /d C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& mingw32-make > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\MySQL\include -IC:\Qt\5.12.6\mingw73_32\mkspecs\win32-g++ -o main.o main.cpp > g++ -Wl,-s -Wl,-subsystem,console -mthreads -o mysql.exe main.o -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-win32\lib -LC:\Utils\postgresql\pgsql\lib C:\MySQL\lib\libmysql.lib > c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: main.o:main.cpp:(.text.startup+0xc): undefined reference to `mysql_get_client_version@0' > collect2.exe: error: ld returned 1 exit status > mingw32-make: *** [Makefile:66: mysql.exe] Error 1
I solved It. The lib and include file should be comes from the MySQL Connector C 6.1.
this doc is better then old one.
https://doc-snapshots.qt.io/qt5-5.14/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows
-
a lot of people want to build it in static ,but few people know how to build.
-
@cawlfj
do you know the reasib why it does not detected mysql?