Error building QMYSQL Plugin for Qt on Windows - qt

I recently re-installed Qt - and now I am having issues with my MySQL drivers for Qt. I now get the error:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
So I am trying to build the QMYSQL Driver. So far I have...
Downloaded the MySQL Community installer by running mysql-installer-web-community-8.0.18.0.msi
And installed the x86 version of the MySQL Connector C 6.11, which saved to C:\Program Files (x86)\MySQL\MySQL Connector C 6.1
Opened a Developer Command Prompt for VS 2017 and ran:
CD "C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers"
qmake -- MYSQL_INCDIR="C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib"
Which seems to work, as I get "yes" for MySQL:
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.12.6\msvc2017_64'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
Note: I have also tried installing the x64 version of MySQL Connector C 6.1 instead of x86, but when I run QMAKE then (after adjusting the INCDIR and LIBDIR parameters from qmake) It says 'no' for MySQL - which I believe means that I am correct to be trying to use the x86 version.
Then from the same CMD I run: nmake sub-mysql but I get the error:
c:\qt\5.12.6\src\qtbase\src\plugins\sqldrivers\mysql\qsql_mysql_p.h(60): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
main.cpp
c:\qt\5.12.6\src\qtbase\src\plugins\sqldrivers\mysql\qsql_mysql_p.h(60): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
I've checked that 'mysql.h' DOES exist in 'C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include'.
Is there something else I am missing or doing wrong?
OS: Windows 10
Qt: 5.12.6
MySQL: C Connector 6.11 x86
Compiler: MSVC 2017

Related

Qt building nmake fatal error U1077: 'cd': return code '0×2'

I am building qt5.7.0 from its source package with vs2015, following some instructions from the post How to Build Qt 5.7 Statically Using MSVC14 .
Here is my configure commands:
configure -static -debug-and-release -prefix “C:\Qt\5.7.0” -platform win32-msvc2015
Then the building processing is initiated by type nmake, but after a while it is stopped due to the error, namke fatal error U1077, as shown in the attached screenshot.
nmake clean
Download jom as a replacement of nmake for the building process (reconfigure and build)

how to build OpenBR?

When i build OpenBR on windows and when i type following code on VS2015 x86 x64 Cross Tools Command Prompt as mentioned in A hacker's guide to building, editing, and running OpenBR :
cmake -G "CodeBlocks - NMake Makefiles" -DCMAKE_PREFIX_PATH="H:/opencv-2.4.11/build/install;H:/Qt/Qt‌​5.8/5.8/msvc2015_6‌​4" -DCMAKE_INSTALL_PREFIX="./install" -DBR_INSTALL_DEPENDENCIES=ON -DCMAKE_BUILD_TYPE=Release ..
i get this error :
H:\openbr\build-msvc2015>cmake -G "CodeBlocks - NMake Makefiles" -DCMAKE_PREFIX_
PATH="H:/opencv-2.4.11/build/install;H:/Qt/Qt5.8/5.8/msvc2015_64" -DC
MAKE_INSTALL_PREFIX="./install" -DBR_INSTALL_DEPENDENCIES=ON -DCMAKE_BUILD_TYPE=
Release ..
-- The C compiler identification is MSVC 19.0.23506.0
-- The CXX compiler identification is MSVC 19.0.23506.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio
14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi
o 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studi
o 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- OpenCV ARCH: x64
-- OpenCV RUNTIME:
-- OpenCV STATIC: OFF
CMake Warning at H:/opencv-2.4.11/build-msvc2015/install/OpenCVConfig.cmake:161
(message):
Found OpenCV Windows Pack but it has not binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:88 (find_package)
CMake Error at CMakeLists.txt:88 (find_package):
Found package configuration file:
H:/opencv-2.4.11/build-msvc2015/install/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
-- Configuring incomplete, errors occurred!
See also "C:/openbr/build-msvc2015/CMakeFiles/CMakeOutput.log".
what's problem?
Try to edit OpenCVConfig.cmake file (H:/opencv-2.4.11/build-msvc2015/install/OpenCVConfig.cmake). And set OpenCV_RUNTIME to VC14:
elseif(MSVC_VERSION EQUAL 1800)
set(OpenCV_RUNTIME vc12)
elseif(MSVC_VERSION EQUAL 1900)
set(OpenCV_RUNTIME vc14)
endif()

Qt Static Building Error on Installation with command "nmake install" or "jom install"

I try to build a static and different version of Qt(5.7) from the Source Code beside another installed version from binary package (5.6.1). I have been thoroughly following this tutorial building qt static library changing the "jom" command to "nmake" (I read somewhere that jom just make the build quicker),after successfully building with "jom" command (or "nmake", both command shows no error), I finally stuck at the last step "jom install", or in this instance "nmake install". When I inputted the command, I get this error:
C:\Qt\Qt5.6.1\5.7\qt-5.7.0>nmake install
Microsoft (R) Program Maintenance Utility Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd qtbase\ && ( if not exist Makefile C:\Qt\Qt5.6.1\5.7\qt-5.7.0\qtbase\
bin\qmake C:\Qt\Qt5.6.1\5.7\qt-5.7.0\qtbase\qtbase.pro -o Makefile ) &&
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile install
Microsoft (R) Program Maintenance Utility Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd src\ && ( if not exist Makefile C:\Qt\Qt5.6.1\5.7\qt-5.7.0\qtbase\bin\qmake C:\Qt\Qt5.6.1\5.7\qt-5.7.0\qtbase\src\src.pro -o
Makefile) && "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile install
Microsoft (R) Program Maintenance Utility Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd corelib\ && ( if not exist Makefile.qtzlib C:\Qt\Qt5.6.1\5.7\qt-5.7.0
\qtbase\bin\qmake C:\Qt\Qt5.6.1\5.7\qt-5.7.0\qtbase\src\corelib\qtzlib.pro -o Ma
kefile.qtzlib ) && "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\n
make.exe" -f Makefile.qtzlib install
Microsoft (R) Program Maintenance Utility Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile.qtzlib.Debug install
Microsoft (R) Program Maintenance Utility Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.
The filename, directory name, or volume label syntax is incorrect.
NMAKE : fatal error U1077: 'if' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
I tried rebuilding the source code with both jom and nmake, reducing the environment variables path of the nmake to C:\PROGRA~2\MICROS~1.0\VC\bin, compiling all the modules one by one, still cannot do the "nmake install" or "jom install" command. Any ideas what went wrong?
Any help would be appreciated, thank you very much
The filename, directory name, or volume label syntax is incorrect.
In my case I set an unexists disk to -prefix argument of the confiture command, which cause this same error with yours.
I just simply replace all the F:(not exists) to E:(my qt is under this disk) in all Makefile and Makefile.* files, then nmake install works normally.
Hope this helps.

How to compile QT examples with QT creator and visual studio 2012 compiler?

I used the following configure options and commands to build qt5.5:
configure -developer-build -opensource -confirm-license -platform win32-msvc2013 -opengl desktop -nomake examples -nomake tests
nmake
QT is built successfully. After this, I installed QT creator 3.4.0 beta and configured qmake for qt5.5 and using Microsoft Visual studio C++ compiler 12.0 . Now when i try to build the qt3D examples using the QT creator, I am getting the following compile errors:
cpp.exe.2968.1625.jom
qtmain.lib(qtmain_win.obj) : error LNK2019: unresolved external symbol __imp__CommandLineToArgvW#8 referenced in function _WinMain#16
release\cylinder-cpp.exe : fatal error LNK1120: 1 unresolved externals
jom: C:\qt5.5\build-qt3d-Desktop-Release\examples\cylinder-cpp\Makefile.Release [release\cylinder-cpp.exe] Error 1120
jom: C:\qt5.5\build-qt3d-Desktop-Release\examples\cylinder-cpp\Makefile [release] Error 2
12:57:27: The process "C:\Qt\qtcreator-3.3.81\bin\jom.exe" exited with code 2.
Error while building/deploying project qt3d (kit: Desktop)
When executing step "Make"
12:57:27: Elapsed time: 00:03.
I understand that this error is because of winmain function missing which is required by visual studio compiler for any windows applications, However how does qt take care of it? What are the header files to be included to avoid this error for qt examples?
Please help me with your suggstions and let me know if I am missing any steps also.
I had a similar problem - I fixed it by linking Shell32.lib. See this discussion compilation of qt5.5 examples with qt creator with visual studio 2012 (msvc2012) fails for details.

Building Qt 5.2.1 from sources on Windows - OpenGL/angle error

I am trying to build QT now for 2 days but it just doesn't work. This is what I did so far:
getting source (qt-everywhere-opensource-src-5.2.1)
installing perl, python, directx 9 sdk
adding perl, python to path variable
open cmd:
CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64
set PATH=C:\Qt\Qt5.2.1source\qtbase\bin;C:\Qt\Qt5.2.1source\qtrepotools\bin;C:\Qt\Qt5.2.1source\gnuwin32\bin;%PATH%
set QMAKESPEC=win32-msvc2010
cd C:\Qt\Qt5.2.1source\
configure -debug -nomake examples -nomake tests -opensource -platform win32-msvc2010 -confirm-license (also tried with -opengl desktop)
nmake
And then I get this error message:
qplatformopenglcontext.cpp
c:\qtdev\qtbase-build\include\qtgui\../../../qtbase/src/gui/opengl/qopengl.h(55)
: fatal error C1083: Cannot open include file: 'GLES2/gl2.h': No such file or d
irectory
qopenglcontext.cpp
c:\qtdev\qtbase-build\include\qtgui\../../../qtbase/src/gui/opengl/qopengl.h(55)
: fatal error C1083: Cannot open include file: 'GLES2/gl2.h': No such file or d
irectory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
the same like here: QT_BUG but this should be fixed in 5.1.0 so I guess I do something wrong but I don´t know what :( It´s driving me crazy! I tried several different confiure settings but always the same error.
Btw: I had the same error before I installed DirectX SDK, the only thing changed after installing was the warning after performing configure doesn't show anymore.
Do you have any clue how I can get this working?
Try to install DirectX SDK.
Read more: https://qt-project.org/forums/viewthread/36324

Resources