Mostafa Emad
Mostafa Emad

Reputation: 9

QMYSQL driver not loaded windows QT 6

I am using QT version 6.8.1 and i installed sources too. Also i am using MySQL Server 8.0 and installed MySQL Connector C 6.1 and copied libmysql.dll file to C:\Qt\6.8.1\mingw_64\bin still the error the same.So, I followed a video on youtube to build the driver using cmd first setting PATH then using this command:

call C:\Qt\6.8.1\mingw_64\bin\qt-cmake.bat -G "MinGW Makefiles" . -DMySQL_INCLUDE_DIR="C:\Program Files\MySQL\MySQL Server 8.0\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.8.1\mingw_64" -DCMAKE_C_COMPILER="gcc.exe" -DCMAKE_CXX_COMPILER="g++.exe" 

But this results some warning and errors.

the result:

-- The CXX compiler identification is GNU 6.3.0
-- The C compiler identification is GNU 6.3.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/MinGW/bin/gcc.exe
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.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:/MinGW/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Warning at C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6ConfigVersion.cmake:56 (message):
  Version 6.8.1 of package Qt6 was requested but an incompatible version was
  found: 6.8.1 (64bit).  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:21 (find_package)


CMake Error at CMakeLists.txt:21 (find_package):
  Could not find a configuration file for package "Qt6" that is compatible
  with requested version "6.8.1".

  The following configuration files were considered but not accepted:

    C:/Qt/6.8.1/mingw_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.8.1 (64bit)

Upvotes: -1

Views: 133

Answers (1)

mugiseyebrows
mugiseyebrows

Reputation: 4708

Qt and plugin must be built with the same compiler, Qt 6.8.1 itself cannot be built with Mingw-w64 6.3.0, you need at least Mingw-w64 11+. Binaries produced with different major version of Mingw-w64 is not binary compatible.

If you installed Qt binaries using official installer you probably need Mingw-w64 13.1 to build a plugin. See supported platforms

Operating System Architecture Compiler Notes
Windows 10 (1809 or later) x86_64 MSVC 2022, MSVC 2019, Mingw-w64 13.1
Windows 11 x86_64 MSVC 2022, MSVC 2019, Mingw-w64 13.1
Windows on ARM ARM64 MSVC 2019/2022

You can identify compiler version using strings util

set PATH=C:\Program Files\Git\usr\bin;C:\MinGW\bin
strings C:\Qt\6.8.1\mingw_64\bin\Qt6Core.dll | grep -i mingw

Upvotes: 0

Related Questions