Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Can't load QMySQL Drivers. Error building mysql plugin.



  • Hello,

    I know this has been posted here a lot, but I've tried checking other posts and the official documentation and nothing has helped.

    cmd.PNG

    Heres the config.log:

    Command line: "MYSQL_INCDIR=C:/Program Files/MySQL/MySQL Server 8.0/include" "MYSQL_LIBDIR=C:/Program Files/MySQL/MySQL Server 8.0/lib"
    Global lib dirs: [C:\openssl\lib C:\Utils\my_sql\mysql-5.7.25-winx64\lib C:\Utils\postgresql\pgsql\lib] []
    Global inc dirs: [C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include] []
    looking for library db2
    Trying source 0 (type inline) of library db2 ...
    sqlcli.h not found in [] and global paths.
    sqlcli1.h not found in [] and global paths.
    => source produced no result.
    Trying source 1 (type inline) of library db2 ...
    => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.db2 FAILED
    looking for library ibase
    Trying source 0 (type inline) of library ibase ...
    ibase.h not found in [] and global paths.
    => source produced no result.
    Trying source 1 (type inline) of library ibase ...
    => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.ibase FAILED
    looking for library mysql
    Trying source 0 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    => source produced no result.
    Trying source 1 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    => source produced no result.
    Trying source 2 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    => source produced no result.
    Trying source 3 (type mysqlConfig) of library mysql ...
    mysql_config not found.
    => source produced no result.
    Trying source 4 (type inline) of library mysql ...
    => source failed condition '!config.win32'.
    Trying source 5 (type inline) of library mysql ...

    • cd /d C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && C:\Qt\5.15.1\msvc2019_64\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.7.25-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = "-LC:/Program Files/MySQL/MySQL Server 8.0/lib" -llibmariadb" "QMAKE_INCDIR_MYSQL = "C:/Program Files/MySQL/MySQL Server 8.0/include"" C:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    • cd /d C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& nmake clean && set MAKEFLAGS=& nmake

    Microsoft (R) Program Maintenance Utility Version 14.27.29112.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    del main.obj
    Could Not Find C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql\main.obj
    Microsoft (R) Program Maintenance Utility Version 14.27.29112.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DNDEBUG -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -I"C:\Program Files\MySQL\MySQL Server 8.0\include" -IC:\Qt\5.15.1\msvc2019_64\mkspecs\win32-msvc -Fo @C:\Users\airru\AppData\Local\Temp\nm9AC6.tmp
    main.cpp
    .\main.cpp(3): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64\cl.EXE"' : return code '0x2'
    Stop.
    => source failed verification.
    Trying source 6 (type inline) of library mysql ...

    • cd /d C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && C:\Qt\5.15.1\msvc2019_64\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.7.25-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = "-LC:/Program Files/MySQL/MySQL Server 8.0/lib" -llibmysql" "QMAKE_INCDIR_MYSQL = "C:/Program Files/MySQL/MySQL Server 8.0/include"" C:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    • cd /d C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& nmake clean && set MAKEFLAGS=& nmake

    Microsoft (R) Program Maintenance Utility Version 14.27.29112.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    del main.obj
    Could Not Find C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql\main.obj
    Microsoft (R) Program Maintenance Utility Version 14.27.29112.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DNDEBUG -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -I"C:\Program Files\MySQL\MySQL Server 8.0\include" -IC:\Qt\5.15.1\msvc2019_64\mkspecs\win32-msvc -Fo @C:\Users\airru\AppData\Local\Temp\nm9C2D.tmp
    main.cpp
    .\main.cpp(3): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64\cl.EXE"' : return code '0x2'
    Stop.
    => source failed verification.
    Trying source 7 (type inline) of library mysql ...
    => source failed condition '!config.win32'.
    Trying source 8 (type inline) of library mysql ...
    => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.mysql FAILED
    looking for library oci
    Trying source 0 (type inline) of library oci ...
    oci.h not found in [] and global paths.
    => source produced no result.
    Trying source 1 (type inline) of library oci ...
    => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.oci FAILED
    looking for library odbc
    Trying source 0 (type inline) of library odbc ...
    sql.h not found in [] and global paths.
    sqlext.h not found in [] and global paths.
    => source produced no result.
    Trying source 1 (type inline) of library odbc ...
    => source failed condition 'config.darwin'.
    Trying source 2 (type inline) of library odbc ...
    => source failed condition '!config.win32 && !config.darwin'.
    test config.sqldrivers.libraries.odbc FAILED
    looking for library psql
    Trying source 0 (type pkgConfig) of library psql ...
    pkg-config use disabled globally.
    => source produced no result.
    Trying source 1 (type psqlConfig) of library psql ...
    pg_config not found.
    => source produced no result.
    Trying source 2 (type psqlEnv) of library psql ...
    libpq-fe.h not found in [] and global paths.
    => source produced no result.
    Trying source 3 (type psqlEnv) of library psql ...
    => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.psql FAILED
    looking for library sqlite2
    Trying source 0 (type inline) of library sqlite2 ...
    sqlite.h not found in [] and global paths.
    => source produced no result.
    test config.sqldrivers.libraries.sqlite2 FAILED
    looking for library tds
    Trying source 0 (type sybaseEnv) of library tds ...

    • cd /d C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && C:\Qt\5.15.1\msvc2019_64\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.7.25-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" C:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
    • cd /d C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& nmake clean && set MAKEFLAGS=& nmake

    Microsoft (R) Program Maintenance Utility Version 14.27.29112.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    del main.obj
    Could Not Find C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds\main.obj
    Microsoft (R) Program Maintenance Utility Version 14.27.29112.0
    Copyright (C) Microsoft Corporation. All rights reserved.
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DNDEBUG -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.15.1\msvc2019_64\mkspecs\win32-msvc -Fo @C:\Users\airru\AppData\Local\Temp\nm9DB4.tmp
    main.cpp
    .\main.cpp(2): fatal error C1083: Cannot open include file: 'sybfront.h': No such file or directory
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64\cl.EXE"' : return code '0x2'
    Stop.
    => source failed verification.
    Trying source 1 (type sybaseEnv) of library tds ...
    => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.tds FAILED

    I am using 64bit mysql 8.0.21 and msvc2019_64 for qmake and qt version 5.15.1 on windows 10.


  • Lifetime Qt Champion

    @Ranin said in Can't load QMySQL Drivers. Error building mysql plugin.:

    fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

    Your compiler setup is not complete. Make sure to run the whole stuff from the correct visual studio command prompt - Qt can't do anything against this.



  • @Christian-Ehrlicher said in Can't load QMySQL Drivers. Error building mysql plugin.:

    Your compiler setup is not complete. Make sure to run the whole stuff from the correct visual studio command prompt - Qt can't do anything against this.

    Can you clarify? My Qt project seems to build and run with msvc2019 compiler. What other setup do I have to do? I think I installed it with vs installer.


  • Lifetime Qt Champion

    As you can see windows.h is not found. This means your compiler setup inside cmd.exe is not complete. You likely forgot to use the Visual Studio Command prompt so some paths for the compiler are not correct.



  • Okay It seems I finally got it to work. I ran "vcvarsall.bat x64 windows_sdk_version" and that fixed it. Not sure if it was using older sdk or wrong architecture. Thanks for steering me in the right direction.


Log in to reply