Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MySQL plugin creating issue



  • While compiling the Mariadb plugin, the following error message is generated in the log:

    Trying source 6 (type inline) of library mysql ...
    + cd /d C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && c:\Qt\5.15.2\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/MariaDB/MariaDB Connector C 64-bit/lib\" -llibmysql" "QMAKE_INCDIR_MYSQL = \"c:/Program Files/MariaDB/MariaDB Connector C 64-bit/include\"" C:/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    + cd /d C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& nmake clean && set MAKEFLAGS=& nmake
    > Microsoft (R) Program Maintenance Utility Version 14.28.29336.0
    > Copyright (C) Microsoft Corporation.  All rights reserved.
    > 	del main.obj
    > Could Not Find C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql\main.obj
    > Microsoft (R) Program Maintenance Utility Version 14.28.29336.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\MariaDB\MariaDB Connector C 64-bit\include" -IC:\Qt\5.15.2\msvc2019_64\mkspecs\win32-msvc -Fo @C:\Users\Kutyus\AppData\Local\Temp\nm4023.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.28.29333\bin\Hostx64\x64\cl.EXE"' : return code '0x2'
    > Stop.
    

    Same bug as on this topic: https://forum.qt.io/topic/109418/qmake-can-t-find-mysql/2, I tried the things there but it didn't help, any other suggestions maybe?
    Windows 10, MSVC 2019 I use a 64-bit compiler.

    Thank you: Kutyus



  • @Kutyus It look like you want to compile Qt 5.15.2 with MSVC2019 in 64 bit. Right?

    • You have to download MySQL Connector/C 6.1.5 from MySQL web site (beware, C not C++ and 6.1.5 not newer!!)
    • Setup build environnement by starting Qt console. Here an exemple with Qt 5.12.10 (I don't have Qt 5.15.2 installed ;) )
      8e867466-b40d-4d6c-bd13-a8b3b567858e-image.png
    • In the DOS-console setup MSVC path with
    "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
    
    • Goto plugin sources, configure, build and install
    cd  C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers
    qmake -- MYSQL_INCDIR=c:/mysql-connector-6.1.5/include MYSQL_LIBDIR=c:/mysql-connector-6.1.5/lib
    nmake
    nmake install
    

    That's it ;)


  • Lifetime Qt Champion

    You MSVC environment is not properly set up. I would guess you can't compile a simple main.cpp which includes windows.h header file too. Make sure to call the correct visual studio command prompt and that then the env is properly set up - nothing Qt can do against this.



  • @Kutyus It look like you want to compile Qt 5.15.2 with MSVC2019 in 64 bit. Right?

    • You have to download MySQL Connector/C 6.1.5 from MySQL web site (beware, C not C++ and 6.1.5 not newer!!)
    • Setup build environnement by starting Qt console. Here an exemple with Qt 5.12.10 (I don't have Qt 5.15.2 installed ;) )
      8e867466-b40d-4d6c-bd13-a8b3b567858e-image.png
    • In the DOS-console setup MSVC path with
    "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
    
    • Goto plugin sources, configure, build and install
    cd  C:\Qt\5.15.2\Src\qtbase\src\plugins\sqldrivers
    qmake -- MYSQL_INCDIR=c:/mysql-connector-6.1.5/include MYSQL_LIBDIR=c:/mysql-connector-6.1.5/lib
    nmake
    nmake install
    

    That's it ;)



  • @KroMignon I have the solution, I called the vcvarsall.bat command with a bad parameter, it worked based on that, thanks.


Log in to reply