Unsolved building mysql plugin for qt (c++)
-
@silvio_2020 said in building mysql plugin for qt (c++):
i opened CMD in this directory after updating envirennement variable
This is wrong, you have to open your Qt command line where your compiler is correctly set up.
C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\mysql
And this is also the wrong directory according to the documentation.
-
@Christian-Ehrlicher said in building mysql plugin for qt (c++):
@silvio_2020 said in building mysql plugin for qt (c++):
i opened CMD in this directory after updating envirennement variable
This is wrong, you have to open your Qt command line where your compiler is correctly set up.
C:\Qt\5.12.6\Src\qtbase\src\plugins\sqldrivers\mysql
And this is also the wrong directory according to the documentation.
i tried with the right path (sqldrivers)
and you can see what is the result
qmake -- MYSQL_INCDIR=C:\dev\mysql-dev\include "MYSQL_LIBDIR=C:/dev/mysql-dev/lib/opt" mingw32-make sub-mysql
"error: invalid command line parameter 'mingw32-make'" -
As @Christian-Ehrlicher already pointed out, your are writing two different commands as one hence the error you are getting.
Keep them properly separated as in the documentation and @Christian-Ehrlicher's post.
-
@silvio_2020 said in building mysql plugin for qt (c++):
"error: invalid command line parameter 'mingw32-make'"
Again: This is not in the docs! These are two commands:
"qmake -- MYSQL_INCDIR=C:\dev\mysql-dev\include "MYSQL_LIBDIR=C:/dev/mysql-dev/lib/opt""
and
"mingw32-make sub-mysql"Is it so hard to follow the instructions?
/edit: here is a slightly updated document: https://doc-snapshots.qt.io/qt5-5.14/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows
-
This post is deleted! -
@Christian-Ehrlicher said in building mysql plugin for qt (c++):
@SGaist said in building mysql plugin for qt (c++):
What exact error are you getting in the logs ?
And what was your command line? Did you remove config.cache in the directory before?
what means removing config.cach ?
the same issue , when i launch the command as described it shows me
mysql..... no
what scenaro i am missing ? -
@silvio_2020 said in building mysql plugin for qt (c++):
what means removing config.cach ?
a config.cache file is created which should be removed when you try again, otherwise the search for the mysql lib will not be performed again.
what scenaro i am missing ?
You neither posted the qmake command line you're really using nor where you installed the MySQL server to / where the files mentioned in my (second) link (mysql.h, ...) are.
-
@Christian-Ehrlicher said in building mysql plugin for qt (c++):
@silvio_2020 said in building mysql plugin for qt (c++):
what means removing config.cach ?
a config.cache file is created which should be removed when you try again, otherwise the search for the mysql lib will not be performed again.
what scenaro i am missing ?
You neither posted the qmake command line you're really using nor where you installed the MySQL server to / where the files mentioned in my (second) link (mysql.h, ...) are.
this is the qmake commande line i am actually using:
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"
must i indicate the Qmake version in the commande line for building the plugin ?
i installed the c connector c 6.1.11 in C:/Program Files (x86)/MySQL/ -
@silvio_2020
Finally
mysql .......... yes
i did not deleted the config.cach
i have been deleting config.log all the time
as recap
i installed mysql c connector 6.1.11 in program files/mysql
qt already installed
i am working with mingw 64 bit
qmake command line ?
i used as described in the qt doc cute doc
lesson learned
every time you give it a new building try you must delete the config.cach
thanks for everything -
Thanks you man, you saved my life.
-
@SGaist said in building mysql plugin for qt (c++):
As @Christian-Ehrlicher already pointed out, your are writing two different commands as one hence the error you are getting.
Keep them properly separated as in the documentation and @Christian-Ehrlicher's post.
after building the plugin
and i copied both files to project path it still printing :
`C:\Qt\5.12.6\mingw73_32\bin\libmysql.dll': Shared library architecture i386 is not compatible with target architecture i386:x86-64.
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
what i'am missing ? -
@silvio_2020
I solved everything, you doc hinted me.the first thing is check the degit of your qmake, g++ and my serves. I select the 64X(highly recommend). everything should be the same digit.
I added the path of qmake.exe and g++.exe to system evironment. these two executable file is come from the qt folder. also delete the path which include the g++.exe outside of qt folder.
mine is they are under the qt folder, so it also have requirement file.
C:\Qt\5.12.6\mingw73_64\bin
C:\Qt\Tools\mingw730_64\bin\now run the cmd code
cd %QTDIR%\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" (I used the include and lib folder in msql server) mingw32-make (do not use the nmake, just make sure not be fucked by digit problem) mingw32-make install
after that you should put the "libmysql.dll" from server\lib folder to
executable. the problem done.This problem tortured me three days as the end of a year.
My English is not good, so if you get help from this, can you write something to help other newbines like me, thanks.