building qsqlmysql.dll for msvc error
-
Hello there,
I have installed Qt 15.5.1 using MaitenanceTool and I know that qsqlmysql.dll doesn't get installed in plugins, I have to build it separately.I want to generate qsqlmysql.dll for msvc.
I have the source code with me and tried the following steps:
- Opened Developer Command Prompt vs2019
- Go to "C:\Qt\5.15.1\msvc2019_64\bin" and drag and drop qtenve.bat in the command prompt and hit enter.
- Go to "C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers" in command prompt
- Entered the following lines
qmake -- MYSQL_INCDIR="C:\mysql\include" MYSQL_LIBDIR="C:\mysql\lib
(Note: I have copied include and lib folders from mysql server 8.0 to C:\mysql, include folder has mysql.h and lib folder contains libmysql.dll and libmysql.lib)
Output was like this:
Info: creating stash file C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\.qmake.stash Running configuration tests... Checking for DB2 (IBM)... no Checking for InterBase... no Checking for MySQL... yes 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 .................................. yes 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 'nmake'. Once everything is built, you must run 'nmake install'. Qt will be installed into 'C:\Qt\5.15.1\msvc2019_64'. Prior to reconfiguration, make sure you remove any leftovers from the previous build.
After this I entered the following line on command prompt:
namke
and I got the following error:
Microsoft (R) Program Maintenance Utility Version 14.29.30139.0 Copyright (C) Microsoft Corporation. All rights reserved. cd mysql\ && ( if not exist Makefile C:\Qt\5.15.1\msvc2019_64\bin\qmake.exe -o Makefile C:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro ) && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe" -f Makefile Microsoft (R) Program Maintenance Utility Version 14.29.30139.0 Copyright (C) Microsoft Corporation. All rights reserved. "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe" -f Makefile.Release Microsoft (R) Program Maintenance Utility Version 14.29.30139.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1073: don't know how to make 'C:/Program\' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop.
Can someone help me out here, What is the correct way to generate qsqlmysql.dll for msvc.
-
@mvsri said in building qsqlmysql.dll for msvc error:
What is the correct way to generate qsqlmysql.dll for msvc.
This is the correct way.
Do you have a bash/sh.exe somewhere in your PATH env var? -
@Christian-Ehrlicher No I don't have bash/sh in my PATH env
-
@mvsri said in building qsqlmysql.dll for msvc error:
MYSQL_LIBDIR="C:\mysql\lib
Forgot to copy or typo? There is a
"
missing.It looks strange. Take a look into Makefile.Release in the mysql subdir and see if you see if somewhere
C:/Program\
is referenced. -
@Christian-Ehrlicher said in building qsqlmysql.dll for msvc error:
Forgot to copy or typo?
I forgot to copy.
I looked into Makefile.Release and realised that instead ofC:\mysql\include
this It was including this
C:\Program Files\MySQL\MySQL Server 8.0\include
I deleted qmake.stash and config.cache and repeated the qmake again and this time I generated qsqlmysql.dll successfully.
Tested it with Sample Cpp code in Qt, it's working.
@Christian-Ehrlicher Thanks for the suggestion.