Error QMYSQL Plugin on Windows
-
Hello to all!
I mention that I have installed Qt 5.12.1 and I receive an error when I am trying to build QMYSQL plugin for Windows 10.
The path to sql drivers is "c:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers", and also the path to lib files is "c:\Program Files\MySQL\MySQL Server 8.0\lib"
I opened a cmd window and typed the folowing c:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers>qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/MYSQL/MySQL Server 8.0/lib/" mysql.probut no success
Give me a clue!
Thank you! -
Hi,
This question has already been asked and answered many times already. Did you follow the instructions given on these forum entries ?
-
I know, and I looked at many answer, but is not working, so if you know how to do it please help me.
Now I come with an update regarding the command from cmd:
c:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers>C:/Qt/Qt5.12.1/5.12.1/mingw73_64/bin/qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/Program Files/MYSQL/MySQL Server 8.0/lib/libmysql.lib" mysql.pro
and I get the next message
QMake has two modes, one mode for generating project files based on some heuristics, and the other for generating makefiles. Normally you shouldn't need to specify a mode, as makefile generation is the default mode for qmake, but you may use this to test qmake on an existing project Mode: -project Put qmake into project file generation mode In this mode qmake interprets files as files to be built, defaults to *; *; *; *.ts; *.xlf; *.qrc Note: The created .pro file probably will need to be edited. For example add the QT variable to specify what modules are required. -makefile Put qmake into makefile generation mode (default) In this mode qmake interprets files as project files to be processed, if skipped qmake will try to find a project file in your current working directory
-
Did you even look at the content of the folder you went into ? Noticed that there are no .pro file in there ?
You are in a Qt installation. As already suggested many times: you have to download the Qt sources.
-
Well, it's explained in the numerous threads already opened on this very forum.
No need for a link, you can get the sources directly using the Maintenance Tool available in your Qt installation.
-
Maintenance Tool does not work, I get the next message: at least one valid and enabled repository required for this action to succeed
In the Maintenance Tool, start by selecting "Update components". Then click on the Settings button.
Then a Settings window will open and in there, then click the Repositories tab, click on User defined repositories, click on the Add button and type http://download.qt-project.org/online/qtsdkrepository/windows_x86/desktop/tools_maintenance.
I tried many website but still I get the same message. -
So you used the offline installer ?
Anyway, there's not that many website: http://download.qt.io/official_releases/qt/ the
single
folder under the version folders contain the sources. Since you're on Windows get the .zip file. -
I downloaded qt-everywhere-src-5.12.1 and from what I got from https://www.seppemagiels.com/blog/create-mysql-driver-qt5-windows#mysql_path_note, I renamed the folder to Sources instead of the long qt-everywhere-src-5.12.1.
I also placed it in the Qt folder was installed in. (C:\Qt\ Qt5.12.1)
Open cmd.exe, and enter the following commands:
c:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers>C:/Qt/Qt5.12.1/5.12.1/mingw73_64/bin/qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/Program Files/MYSQL/MySQL Server 8.0/lib/libmysql.lib" mysql.pro
and again ... I'm disappointed -
That line doesn't make sense, why are you trying to execute qmake inside the sqldrivers folder from your already installed Qt ? And why are you passing once the path without space for the includes and then the one with spaces for the libraries ?
-
What is the right line ?
I have read the post from https://forum.qt.io/topic/92626/cant-connect-to-mysql-database-qmysql-driver-not-loaded/15 line by line but it doesn't fit.
Please, light me! -
I will start again.
On website https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows
first line is: cd %QTDIR%\qtbase\src\plugins\sqldrivers wich for me is:
c:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers>Now I'll go back to website
second line:
qmake -- MYSQL_INCDIR=C:\MySQL\include "MYSQL_LIBDIR=C:\MYSQL\MySQL Server <version>\lib\opt"MYSQL_INCDIR is include folder from MySql folder
MYSQL_LIBDIR is lib folder from MySql folderFor me the second line it should be something like this
c:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers>qmake -- MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 8.0\include"
When I run this line I get an error: 'qmake' is not recognized as an internal or external command,
operable program or batch file.Also I don't find the opt folder
-
@Stelian You need to call qmake from the source code directory of Qt source code you downloaded, not from your installed Qt.
This is your Qt installation: c:\Qt\Qt5.12.1\5.12.1\mingw73_64\plugins\sqldrivers
Look again at the link you posted: c:\Qt\5.10.1\Src\qtbase\src\plugins\sqldrivers is used there (in your case version would be 5.12.1)."'qmake' is not recognized as an internal or external command, operable program or batch file." - use absolute path to qmake.
-
@jsulm Thank you for your reply.
I have modified the line with this one.c:\Qt\Qt5.12.1\Sources\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 8.0\include "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 8.0\lib" but I get the same error: "qmake' is not recognized as an internal or external command, operable program or batch file" -
Use the full path to the qmake executable or start a Qt enabled command line.
-
Okay, another error.
I quit, error after error with QMYSQL driver.
I really like Qt, but I have no patience.
Thank you anyway for your help, SGaist and jsulm.ERROR: Invalid command line parameter 'Files/MySQL/MySQL'.
c:\Qt\Qt5.12.1\Sources\qtbase\src\plugins\sqldrivers>C:\Qt\Qt5.12.1\5.12.1\mingw73_64\bin\qmake -- MYSQL_INCDIR=C:/Program Files/MySQL/MySQL Server 8.0/include "MYSQL_LIBDIR=C:Program Files/MYSQL/MySQL Server 8.0/lib"
-
@Stelian This error is unrelated to Qt: you have a path with spaces (good example for why you should avoid such paths!). You need to put such paths into "":
c:\Qt\Qt5.12.1\Sources\qtbase\src\plugins\sqldrivers>C:\Qt\Qt5.12.1\5.12.1\mingw73_64\bin\qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Server 8.0/include" MYSQL_LIBDIR="C:Program Files/MYSQL/MySQL Server 8.0/lib"
"I have no patience" - well, one should have when developing software...
-
@jsulm said in Error QMYSQL Plugin on Windows:
"I have no patience" - well, one should have when developing software...
maybe it's a typo and it's supposed to be
patients
, meaning als patients are gone and there's now more time on hand for developing software:P
-
@jsulm Thank you for reply!
I,ve run c:\Qt\Qt5.12.1\Sources\qtbase\src\plugins\sqldrivers>C:\Qt\Qt5.12.1\5.12.1\mingw73_64\bin\qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Server 8.0/include" MYSQL_LIBDIR="C:Program Files/MYSQL/MySQL Server 8.0/lib"
and I get the next message:Running configuration tests... Done running configuration tests. Configure summary: Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite2 ................................ no SQLite ................................. yes Using system provided SQLite ......... no TDS (Sybase) ........................... no Qt is now configured for building. Just run 'mingw32-make'. Once everything is built, you must run 'mingw32-make install'. Qt will be installed into 'C:\Qt\Qt5.12.1\5.12.1\mingw73_64'.
And I,ve run mingw32-make
'mingw32-make' is not recognized as an internal or external command,
operable program or batch file.Do I have to add the path to make.exe in environment variables ?
But I don't find de make.exe file.
What else do I have to do ?