QMYSQL driver not found Qt 6.5.1, I've tried all I found online, without success
-
Re: QMYSQL I've got this problem, I'm trying everything I found online, someone said that you should build the driver by yourself, I found the documentation but I didn't understand what to do. Does someone knows how to solve this problem? I've been stuck on it for three days
-
Hi and welcome to devnet,
What exactly did you try ?
What issues do you have ?
Which platform are you on ?
Which documentation did you follow ? -
@SGaist I'm currently trying to build the driver, I'm following the qt official documentation, I tried to copy the dll into the folder where all the sql libraries are(I'm working on windows 11). When I try to connect a mysql database it just says that QMYSQL driver isn't loaded
(modiified) I'm trying to build the driver, now I am trying to build it using this line: mkdir build-sqldrivers
cd build-sqldriversqt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path><platform> -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib"
cmake --build .
cmake --install .obviously I changed it with my personal paths, now the only error I get is:
CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:53 (message):
Version 6.7.0 of package Qt6 was requested but an incompatible version was
found: 6.5.1. You can pass -DQT_NO_PACKAGE_VERSION_CHECK=TRUE to disable
the version check and force the incompatible version to be used. There is
no guarantee the build will succeed. Use at your own risk. You can
silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
CMakeLists.txt:13 (find_package)CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:53 (message):
Version 6.7.0 of package Qt6 was requested but an incompatible version was
found: 6.5.1. You can pass -DQT_NO_PACKAGE_VERSION_CHECK=TRUE to disable
the version check and force the incompatible version to be used. There is
no guarantee the build will succeed. Use at your own risk. You can
silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
CMakeLists.txt:13 (find_package)CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:53 (message):
Version 6.7.0 of package Qt6 was requested but an incompatible version was
found: 6.5.1. You can pass -DQT_NO_PACKAGE_VERSION_CHECK=TRUE to disable
the version check and force the incompatible version to be used. There is
no guarantee the build will succeed. Use at your own risk. You can
silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
CMakeLists.txt:13 (find_package)CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:53 (message):
Version 6.7.0 of package Qt6 was requested but an incompatible version was
found: 6.5.1. You can pass -DQT_NO_PACKAGE_VERSION_CHECK=TRUE to disable
the version check and force the incompatible version to be used. There is
no guarantee the build will succeed. Use at your own risk. You can
silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
CMakeLists.txt:13 (find_package)CMake Error at CMakeLists.txt:13 (find_package):
Could not find a configuration file for package "Qt6" that is compatible
with requested version "6.7.0".The following configuration files were considered but not accepted:
C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.5.1
-- Configuring incomplete, errors occurred!
it works till it find the qt version -
@cpplegend said in QMYSQL driver not found Qt 6.5.1, I've tried all I found online, without success:
Version 6.7.0 of package Qt6
?? Where did this come from?
-
@JonB that's right, so I tried to put this line:-DQT_NO_PACKAGE_VERSION_CHECK=TRUE (not cheking the version of the package)
resulting in this: C:\Qt\6.5.1\build-sqldrivers>qt-cmake -G Ninja C:\Qt\6.5.1\qtbase-dev\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=C:\Qt\win64 -DMySQL_INCLUDE_DIR="C:\Program Files\MySQL\MySQL Connector C 6.1\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.lib" -DQT_NO_PACKAGE_VERSION_CHECK=TRUEthis are my paths.
then I get this output:
-- The CXX compiler identification is GNU 8.1.0
-- The C compiler identification is GNU 8.1.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Program Files/CodeBlocks/MinGW/bin/gcc.exe
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/CodeBlocks/MinGW/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/CodeBlocks/MinGW/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:33 (message):
Package Qt6 with version 6.5.1 was accepted as compatible because
QT_NO_PACKAGE_VERSION_CHECK was set to TRUE. There is no guarantee the
build will succeed. You can silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
CMakeLists.txt:13 (find_package)-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6BuildInternals/Qt6BuildInternalsConfigVersion.cmake:33 (message):
Package Qt6BuildInternals with version 6.5.1 was accepted as compatible
because QT_NO_PACKAGE_VERSION_CHECK was set to TRUE. There is no guarantee
the build will succeed. You can silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
CMakeLists.txt:13 (find_package)CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreConfigVersion.cmake:33 (message):
Package Qt6Core with version 6.5.1 was accepted as compatible because
QT_NO_PACKAGE_VERSION_CHECK was set to TRUE. There is no guarantee the
build will succeed. You can silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
CMakeLists.txt:13 (find_package)-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Sql/Qt6SqlConfigVersion.cmake:33 (message):
Package Qt6Sql with version 6.5.1 was accepted as compatible because
QT_NO_PACKAGE_VERSION_CHECK was set to TRUE. There is no guarantee the
build will succeed. You can silence this warning by passing
-DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE
Call Stack (most recent call first):
C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
CMakeLists.txt:13 (find_package)CMake Warning at C:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6/QtFindPackageHelpers.cmake:144 (find_package):
By not providing "FindMimer.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Mimer", but
CMake did not find one.Could not find a package configuration file provided by "Mimer" with any of
the following names:MimerConfig.cmake mimer-config.cmake
Add the installation prefix of "Mimer" to CMAKE_PREFIX_PATH or set
"Mimer_DIR" to a directory containing one of the above files. If "Mimer"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
configure.cmake:23 (qt_find_package)
CMakeLists.txt:35 (include)-- Configuration summary shown below. It has also been written to C:/Qt/6.5.1/build-sqldrivers/config.summary
-- Configure with --log-level=STATUS or higher to increase CMake's message verbosity. The log level does not persist across reconfigurations.-- Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... yes
PostgreSQL ............................. no
SQLite ................................. yes
Using system provided SQLite ......... no
Mimer .................................. no-- Configuring done (4.1s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Qt/6.5.1/build-sqldriversthen I run "cmake --build ." to build everything into the same folder but the main file I need (qsqlmysql.dll) is not generated.
in fact when I run build this is the output: [3/22] Building CXX object sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/smain.cpp.obj
FAILED: sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/smain.cpp.obj
C:\PROGRA~1\CODEBL~1\MinGW\bin\C__~1.EXE -DNDEBUG -DQSQLiteDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_UP_TO=0x040800 -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -DQT_WARN_DEPRECATED_UP_TO=0x070000 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_RTREE -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_LOAD_EXTENSION -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:/Qt/6.5.1/build-sqldrivers/sqlite/QSQLiteDriverPlugin_autogen/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite/../../../3rdparty/sqlite -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include -isystem C:/Qt/6.5.1/msvc2019_64/mkspecs/win32-msvc -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1/QtSql -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql -DNDEBUG -O2 -std=c++17 -w -fno-exceptions -Zc:cplusplus -permissive- -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:ternary -Zc:externConstexpr -Zc:wchar_t -bigobj -guard:cf -Gw -MD -MT sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/smain.cpp.obj -MF sqlite\CMakeFiles\QSQLiteDriverPlugin.dir\smain.cpp.obj.d -o sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/smain.cpp.obj -c C:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite/smain.cpp
C~1.EXE: error: unrecognized debug output level 'uard:cf'
C__~1.EXE: error: unrecognized command line option '-Zc:cplusplus'
C~1.EXE: error: unrecognized command line option '-permissive-'; did you mean '-fpermissive'?
C__~1.EXE: error: unrecognized command line option '-Zc:rvalueCast'
C__~1.EXE: error: unrecognized command line option '-Zc:inline'; did you mean '-Winline'?
C__~1.EXE: error: unrecognized command line option '-Zc:strictStrings'
C__~1.EXE: error: unrecognized command line option '-Zc:throwingNew'
C__~1.EXE: error: unrecognized command line option '-Zc:referenceBinding'
C__~1.EXE: error: unrecognized command line option '-Zc:ternary'
C__~1.EXE: error: unrecognized command line option '-Zc:externConstexpr'
C__~1.EXE: error: unrecognized command line option '-Zc:wchar_t'
C__~1.EXE: error: unrecognized command line option '-bigobj'
C__~1.EXE: error: unrecognized command line option '-Gw'; did you mean '-w'?
[4/22] Building C object sqlite/CMakeFiles/QSQLiteDriverPl...r/C_/Qt/6.5.1/qtbase-dev/src/3rdparty/sqlite/sqlite3.c.obj
FAILED: sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/C_/Qt/6.5.1/qtbase-dev/src/3rdparty/sqlite/sqlite3.c.obj
C:\PROGRA~1\CODEBL~1\MinGW\bin\gcc.exe -DNDEBUG -DQSQLiteDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_UP_TO=0x040800 -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -DQT_WARN_DEPRECATED_UP_TO=0x070000 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_RTREE -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_LOAD_EXTENSION -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:/Qt/6.5.1/build-sqldrivers/sqlite/QSQLiteDriverPlugin_autogen/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite/../../../3rdparty/sqlite -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include -isystem C:/Qt/6.5.1/msvc2019_64/mkspecs/win32-msvc -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1/QtSql -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql -DNDEBUG -O2 -std=c11 -w -fno-exceptions -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:ternary -Zc:externConstexpr -Zc:wchar_t -bigobj -guard:cf -Gw -MD -MT sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/C_/Qt/6.5.1/qtbase-dev/src/3rdparty/sqlite/sqlite3.c.obj -MF sqlite\CMakeFiles\QSQLiteDriverPlugin.dir\C_\Qt\6.5.1\qtbase-dev\src\3rdparty\sqlite\sqlite3.c.obj.d -o sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/C_/Qt/6.5.1/qtbase-dev/src/3rdparty/sqlite/sqlite3.c.obj -c C:/Qt/6.5.1/qtbase-dev/src/3rdparty/sqlite/sqlite3.c
gcc.exe: error: unrecognized debug output level 'uard:cf'
gcc.exe: error: unrecognized command line option '-Zc:rvalueCast'
gcc.exe: error: unrecognized command line option '-Zc:inline'; did you mean '-Winline'?
gcc.exe: error: unrecognized command line option '-Zc:strictStrings'
gcc.exe: error: unrecognized command line option '-Zc:throwingNew'
gcc.exe: error: unrecognized command line option '-Zc:referenceBinding'
gcc.exe: error: unrecognized command line option '-Zc:ternary'
gcc.exe: error: unrecognized command line option '-Zc:externConstexpr'
gcc.exe: error: unrecognized command line option '-Zc:wchar_t'
gcc.exe: error: unrecognized command line option '-bigobj'
gcc.exe: error: unrecognized command line option '-Gw'; did you mean '-w'?
[5/22] Building CXX object sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite.cpp.obj
FAILED: sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite.cpp.obj
C:\PROGRA~1\CODEBL~1\MinGW\bin\C__~1.EXE -DNDEBUG -DQSQLiteDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_UP_TO=0x040800 -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -DQT_WARN_DEPRECATED_UP_TO=0x070000 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_RTREE -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_LOAD_EXTENSION -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:/Qt/6.5.1/build-sqldrivers/sqlite/QSQLiteDriverPlugin_autogen/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite/../../../3rdparty/sqlite -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include -isystem C:/Qt/6.5.1/msvc2019_64/mkspecs/win32-msvc -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1/QtSql -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql -DNDEBUG -O2 -std=c++17 -w -fno-exceptions -Zc:cplusplus -permissive- -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:ternary -Zc:externConstexpr -Zc:wchar_t -bigobj -guard:cf -Gw -MD -MT sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite.cpp.obj -MF sqlite\CMakeFiles\QSQLiteDriverPlugin.dir\qsql_sqlite.cpp.obj.d -o sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite.cpp.obj -c C:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
C~1.EXE: error: unrecognized debug output level 'uard:cf'
C__~1.EXE: error: unrecognized command line option '-Zc:cplusplus'
C~1.EXE: error: unrecognized command line option '-permissive-'; did you mean '-fpermissive'?
C__~1.EXE: error: unrecognized command line option '-Zc:rvalueCast'
C__~1.EXE: error: unrecognized command line option '-Zc:inline'; did you mean '-Winline'?
C__~1.EXE: error: unrecognized command line option '-Zc:strictStrings'
C__~1.EXE: error: unrecognized command line option '-Zc:throwingNew'
C__~1.EXE: error: unrecognized command line option '-Zc:referenceBinding'
C__~1.EXE: error: unrecognized command line option '-Zc:ternary'
C__~1.EXE: error: unrecognized command line option '-Zc:externConstexpr'
C__~1.EXE: error: unrecognized command line option '-Zc:wchar_t'
C__~1.EXE: error: unrecognized command line option '-bigobj'
C__~1.EXE: error: unrecognized command line option '-Gw'; did you mean '-w'?
[6/22] Building CXX object sqlite/CMakeFiles/QSQLiteDriver...n.dir/QSQLiteDriverPlugin_autogen/mocs_compilation.cpp.obj
FAILED: sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/QSQLiteDriverPlugin_autogen/mocs_compilation.cpp.obj
C:\PROGRA~1\CODEBL~1\MinGW\bin\C__~1.EXE -DNDEBUG -DQSQLiteDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_UP_TO=0x040800 -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -DQT_WARN_DEPRECATED_UP_TO=0x070000 -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_RTREE -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_LOAD_EXTENSION -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:/Qt/6.5.1/build-sqldrivers/sqlite/QSQLiteDriverPlugin_autogen/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/sqlite -IC:/Qt/6.5.1/build-sqldrivers/include -IC:/Qt/6.5.1/qtbase-dev/src/plugins/sqldrivers/sqlite/../../../3rdparty/sqlite -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include -isystem C:/Qt/6.5.1/msvc2019_64/mkspecs/win32-msvc -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtCore/6.5.1/QtCore -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1 -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql/6.5.1/QtSql -isystem C:/Qt/6.5.1/msvc2019_64/include/QtSql -DNDEBUG -O2 -std=c++17 -w -fno-exceptions -Zc:cplusplus -permissive- -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:ternary -Zc:externConstexpr -Zc:wchar_t -bigobj -guard:cf -Gw -MD -MT sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/QSQLiteDriverPlugin_autogen/mocs_compilation.cpp.obj -MF sqlite\CMakeFiles\QSQLiteDriverPlugin.dir\QSQLiteDriverPlugin_autogen\mocs_compilation.cpp.obj.d -o sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/QSQLiteDriverPlugin_autogen/mocs_compilation.cpp.obj -c C:/Qt/6.5.1/build-sqldrivers/sqlite/QSQLiteDriverPlugin_autogen/mocs_compilation.cpp
C~1.EXE: error: unrecognized debug output level 'uard:cf'
C__~1.EXE: error: unrecognized command line option '-Zc:cplusplus'
C~1.EXE: error: unrecognized command line option '-permissive-'; did you mean '-fpermissive'?
C__~1.EXE: error: unrecognized command line option '-Zc:rvalueCast'
C__~1.EXE: error: unrecognized command line option '-Zc:inline'; did you mean '-Winline'?
C__~1.EXE: error: unrecognized command line option '-Zc:strictStrings'
C__~1.EXE: error: unrecognized command line option '-Zc:throwingNew'
C__~1.EXE: error: unrecognized command line option '-Zc:referenceBinding'
C__~1.EXE: error: unrecognized command line option '-Zc:ternary'
C__~1.EXE: error: unrecognized command line option '-Zc:externConstexpr'
C__~1.EXE: error: unrecognized command line option '-Zc:wchar_t'
C__~1.EXE: error: unrecognized command line option '-bigobj'
C__~1.EXE: error: unrecognized command line option '-Gw'; did you mean '-w'?
[9/22] Automatic MOC for target QMYSQLDriverPlugin
ninja: build stopped: subcommand failed.obviously when I run "cmake --install ." it says:
-- Install configuration: "Release"
-- Installing: C:/Qt/win64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfig.cmake
-- Installing: C:/Qt/win64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfigVersion.cmake
-- Installing: C:/Qt/win64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfigVersionImpl.cmake
CMake Error at mysql/cmake_install.cmake:49 (file):
file INSTALL cannot find
"C:/Qt/6.5.1/build-sqldrivers/plugins/sqldrivers/qsqlmysql.dll": No error.
Call Stack (most recent call first):
cmake_install.cmake:42 (include)I feel so stressed :(, I followed all the steps correctly, setted all the enviroment variables in order to run cmake, ninja, and the c and c++ compiler (gcc compiler) but the qsqlmysql.dll is not generated...
I also asked chatgpt, it says that maybe I didn't configure corectly the qt package to support the mysql driver, should I delete my current package and install it again?
-
@cpplegend
Your compiler is MinGW while all the options are for MSVC.Sort out which compiler you are going to use. Maybe the QMYSQL driver builds only with one or the other, I don't know. My hunch is actually that you are intending/intended to use MSVC compiler.
OTOH if you intended to use MinGW (Windows gcc) then
qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path><platform> -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib"
won't be right, where did you get that from?
-
@cpplegend said in QMYSQL driver not found Qt 6.5.1, I've tried all I found online, without success:
@JonB I got this line from the official qt documentation
Does it say that line, which has
-DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib"
can be used with the MinGW compiler?All your
-Z...
and other complaining options are for MSVC..obj
files are for MSVC. Your compiler isC:\PROGRA~1\CODEBL~1\MinGW\bin\C__~1.EXE
. Where did you select to use a MinGW compiler with MSVC options for generating code? -
@mzimmers
@JonB i don't know it just says:
How to Build the QMYSQL Plugin on Windows
You need to get the MySQL installation files (e.g. mysql-installer-web-community-8.0.22.0.msi or mariadb-connector-c-3.1.11-win64.msi). Run the installer, select custom installation and install the MySQL C Connector which matches your Qt installation (x86 or x64). After installation check that the needed files are there:<MySQL dir>/lib/libmysql.lib
<MySQL dir>/lib/libmysql.dll
<MySQL dir>/include/mysql.h
and for MariaDB<MariaDB dir>/lib/libmariadb.lib
<MariaDB dir>/lib/libmariadb.dll
<MariaDB dir>/include/mysql.h
Note: As of MySQL 8.0.19, the C Connector is no longer offered as a standalone installable component. Instead, you can get mysql.h and libmysql.* by installing the full MySQL Server (x64 only) or the MariaDB C Connector.Build the plugin as follows (here it is assumed that <MySQL dir> is C:\mysql-8.0.22-winx64):
mkdir build-sqldrivers
cd build-sqldriversqt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path><platform> -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib"
cmake --build .
cmake --install .When you distribute your application, remember to include libmysql.dll / libmariadb.dll in your installation package. It must be placed in the same folder as the application executable. libmysql.dll additionally needs the MSVC runtime libraries which can be installed with vcredist.exe
this is the link: https://doc.qt.io/qt-6/sql-driver.html
if I set the msvc compiler as an environment variable, will it work? so when I run that command it should take the msvc compiler, isn't it right?
-
@mzimmers I had a problem with the libraries and now I had to remove everything, some files were a problem for the qt framework (for exaple qt design didn't run) and I have deleted all, I am downloading the open source files again from qt, when I am done I will retry, if the error persists I will show you the problem
-
@cpplegend said in QMYSQL driver not found Qt 6.5.1, I've tried all I found online, without success:
MimerConfig.cmake
mimer-config.cmakeYou mix Qt6.5.1 and Qt6 from current git - this can not work...
-
@Christian-Ehrlicher could you tell more about it? I didn't understand, by the way I am installing it again, the open source Version of qt
-
@cpplegend said in QMYSQL driver not found Qt 6.5.1, I've tried all I found online, without success:
could you tell more about it?
What should I say more ? You've two Qt versions on your system. The binary one is 6.5.1 and the source version 6.x from git obvoiusly. This can not work.
-
@cpplegend somewhere along the line, you got multiple versions of Qt installed. You're doing the right thing by reinstalling. Other right things would be:
- use the Qt online installer instead of just cloning the repo
- use the Qt maintenance tool to add whatever components you need
- use Qt Creator for your build
- ditch all the MSVC stuff altogether.
-
@Christian-Ehrlicher ok so basicsally if I try when the new installation is done it will work? right?
-
@mzimmers okok I am doing everything right for the moment, now I am not at home but when I return I will make you know how it is doing.
@Christian-Ehrlicher @JonB @mzimmers @SGaist
thanks to everyone, I am new in this ambient (I made only one Application to practice), so every response has been helpful