Hi, I am struggling these for three days. I tried all I can do, and I believes this can be the last problem for me.
I am trying to build the QMYSQL drive, I followed Document (https://doc.qt.io/qt-5/sql-driver.ht...gin-on-windows)
There is no "Libs & Include Files" Module in mysql "Custom Install", so I select the folder from the sql serves.
I run the code on 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"
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"
To copy to clipboard, switch view to plain text mode
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.
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.
To copy to clipboard, switch view to plain text mode
it seems like does not detected mysql.
I check the the mysql log,
Command line: "MYSQL_INCDIR=C:/MySql/MySQL Server 8.0/include" "MYSQL_LIBDIR=C:/MySql/MySQL Server 8.0/lib"
Global lib dirs: [C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib] [C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0 C:/Qt/Tools/mingw730_32/lib/gcc C:/Qt/Tools/mingw730_32/i686-w64-mingw32/lib C:/Qt/Tools/mingw730_32/lib]
Global inc dirs: [C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include] [C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++ C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/i686-w64-mingw32 C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/backward C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include-fixed C:/Qt/Tools/mingw730_32/i686-w64-mingw32/include]
.......
looking for library mysql
.....
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
Command line: "MYSQL_INCDIR=C:/MySql/MySQL Server 8.0/include" "MYSQL_LIBDIR=C:/MySql/MySQL Server 8.0/lib"
Global lib dirs: [C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib] [C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0 C:/Qt/Tools/mingw730_32/lib/gcc C:/Qt/Tools/mingw730_32/i686-w64-mingw32/lib C:/Qt/Tools/mingw730_32/lib]
Global inc dirs: [C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include] [C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++ C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/i686-w64-mingw32 C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/backward C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include-fixed C:/Qt/Tools/mingw730_32/i686-w64-mingw32/include]
.......
looking for library mysql
.....
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
To copy to clipboard, switch view to plain text mode
the problems seems like because of undefined reference to `mysql_get_client_version@0'
I checked the mysql/include. I am sure there is a "mysql.h" file, and a mysql_get_client_version function exisit, but it just a headfile, not even defined.
What should I do to build a MYSQL drive? thank you very much.
I also tried the method from the video https://www.youtube.com/watch?v=r1TbNjJSlX8&t=199s
it reported the error, library mysql is not definied.
Added after 26 minutes:
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...gin-on-windows
Bookmarks