Unsolved Compiling MySql plugin under Qt 5.14.2
-
Hi everybody,
i'am using a Windows x64, i need to use Mysql 8 in QT 5.14.2( MinGW x64)
i've started installing MySQl driver as indicated :
1-qmake -- MYSQL_INCDIR="C:\Program Files\MySQL\MySQL Server 8.0\include" "MYSQL_LIBDIR="C:\Program Files\MySQL\MySQL Server 8.0\lib"2- then when, I am using:
cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql3- and run: qmake, I'm getting :
Project ERROR: Library 'mysql' is not defined.
even if I use
qmake "INCLUDEPATH+=/usr/include/mysql"
"LIBS+=-L/usr/lib/x86_64-linux-gnu -lmysqlclient_r" mysql.proAny idea how to solve this problem?
Thank you all
-
Hi,
Step 3 should be mingw32-make, not another call to qmake.
-
Now when i enter mingw32-make as A 3rd step, it guives me : mingw32-make: *** No targets specified and no makefile found. Stop.
i tried to run the qmake in sqldrivers instead of mysql and it guives me :
-
@Anas Check config.log as qmake asks you to do. You should find information about why MySQL is disabled.
-
Hi jsulm, Thank you for your answer this is what i find in the log :
I'm sorry i'm new on QT
-
On your terminal picture, one thing that is wrong is the
make
call that is glued to the last"
. Remove that completely. It's not part of the configuration process. -
@SGaist i've read in an other forum that i should add it to make the mysql driver available, now by removing it i still have the mysql driver not available do you know please how to make it a yes
-
@Anas Please check again the log file
-
@jsulm did you take a look at the screen i've posted ?
-
@Anas said in Compiling MySql plugin under Qt 5.14.2:
did you take a look at the screen i've posted ?
Yes, I did, but since you wrote "now by removing it i still have the mysql driver not available" it would make sense to check the log again.
-
@jsulm thank you for your answer now it's giving :
sorry for the quality of the screen
-
@Anas Please post text and not screen shots.
sybfront.h header file is not found as you can see.
Take a look at https://forum.qt.io/topic/92626/cant-connect-to-mysql-database-qmysql-driver-not-loaded -
@jsulm i've done everything as indicated in the post you sent me, i think it's not the same probleme :
-i've added the bin folders in the path ,
-i've redownloaded Mysql connector and installed it
-in the cmd.exe i enter : cd C:\QT\5.14.2\Src\qtbase\src\plugins\sqldrivers- i run qmake -- MYSQL_INCDIR="C:\Mysql\MySQL Connector C 6.1\include" MYSQL_LIBDIR="C:\Mysql\MySQL Connector C 6.1\lib"
it still gives me that Mysql is not available, and in the log i still have the same error sybfront.h is not found, how can i solve this please o how can i add this file if needed
- i run qmake -- MYSQL_INCDIR="C:\Mysql\MySQL Connector C 6.1\include" MYSQL_LIBDIR="C:\Mysql\MySQL Connector C 6.1\lib"
-
it's so frustrating, Could anyone Help please ? or should i just delete QT and try something else !
-
Compiling the plugin should be easier than the loading problem.
The problem is not "sybfront.h is not found" in the last of the log, but "
mysql.h is not found
", in the middle of the log.
Your log showed that you are using C:\MySQL\MySQL Server 8.0
But later you said you run qmake with C:\Mysql\MySQL Connector C 6.1
So can you post the latest log?
But before that, are you suremysql.h
is in the C:\Mysql\MySQL Connector C 6.1\include folder?
Ah, and before run qmake again, deleteconfig.cache
file just in case.P.S. For later convenience (avoiding the loading problem), if you are not using MSVC2015 version of Qt, I recommand that do not use MySQL Connector C 6.1.10-6.1.12, using 6.1.9 or older instead.
-
Thank you Bonnie for your answer now i've succeeded to installed Mysql driver, but i still cannot connect qt to my database, how can i see where's the loaded driver please normally it's in the application output but i can't get that message, here's what i've in my debugging console
QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/accessiblebridge" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/accessiblebridge" ...
QFactoryLoader::QFactoryLoader() checking directory path "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers" ...
QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlite.dll"
Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlite.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QSQLITE"
]
},
"archreq": 0,
"className": "QSQLiteDriverPlugin",
"debug": false,
"version": 331264
}Got keys from plugin meta data ("QSQLITE")
QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"
Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QMYSQL3",
"QMYSQL"
]
},
"archreq": 0,
"className": "QMYSQLDriverPlugin",
"debug": false,
"version": 331264
}Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlodbc.dll"
Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QODBC3",
"QODBC"
]
},
"archreq": 0,
"className": "QODBCDriverPlugin",
"debug": false,
"version": 331264
}Got keys from plugin meta data ("QODBC3", "QODBC")
QFactoryLoader::QFactoryLoader() looking at "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlpsql.dll"
Found metadata in lib C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
{
"IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
"MetaData": {
"Keys": [
"QPSQL7",
"QPSQL"
]
},
"archreq": 0,
"className": "QPSQLDriverPlugin",
"debug": false,
"version": 331264
}Got keys from plugin meta data ("QPSQL7", "QPSQL")
QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/b4ck_/Documents/build-PMK-Desktop_Qt_5_14_2_MinGW_64_bit-Debug/debug/sqldrivers" ...
loaded library "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/styles/qwindowsvistastyle.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qgif.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qicns.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qico.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qjpeg.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qsvg.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qtga.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qtiff.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qwbmp.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/imageformats/qwebp.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/platforms/qwindows.dll"
QLibraryPrivate::unload succeeded on "C:/QT/5.14.2/mingw73_64/plugins/sqldrivers/qsqlmysql.dll"Thank you again for your help
-
@Anas According to the console, the mysql plugin seems to be loaded successfully.
Did you print the error message of the database?qDebug() << db.lastError().text();
And show your code please. (You can hide those ip/hostname, username and password things)
-
thank you very much Bonnie for your help it's working now, it was just a password probleme, thank you again