MySql plugin not working for release version of a project
-
I have MySql plugin installed and it works fine with my debug version of this project, im trying to deploy it right now and i cant make the release version work since it doesnt show 'MYSQL' as a viable option of a database. Ive built it following the documentation https://doc.qt.io/qt-6/sql-driver.html , and i didnt noticed anything mentioning that i had to make another build for the release version and im not sure what to do now... any help would be appreciated.
-
So do you have actually build a release qt-sql plugin - is there a mysql plugin without a 'd' suffix?
-
Re-run cmake and add
-DCMAKE_BUILD_TYPE=Release
to the command line.
You can also set the environment variable QT_DEBUG_PLUGINS=1 and check the output when it tries to load your plugin. With release build of your app and debug-built plugin, you will probably get something like the following, note the part at the end (this is for the debug-build of the QtCompany-supplied Postgres plugin):QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll" Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "archreq": 1, "className": "QPSQLDriverPlugin", "debug": true, "version": 331264 } "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin
-
@Christian-Ehrlicher hi, theres isnt actually, this is the one i got:
As you can see i only have the debug version, i just dont know how to build the release one...
-
Re-run cmake and add
-DCMAKE_BUILD_TYPE=Release
to the command line.
You can also set the environment variable QT_DEBUG_PLUGINS=1 and check the output when it tries to load your plugin. With release build of your app and debug-built plugin, you will probably get something like the following, note the part at the end (this is for the debug-build of the QtCompany-supplied Postgres plugin):QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll" Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QPSQL7", "QPSQL" ] }, "archreq": 1, "className": "QPSQLDriverPlugin", "debug": true, "version": 331264 } "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin
@mchinand said in MySql plugin not working for release version of a project:
Re-run cmake and add
-DCMAKE_BUILD_TYPE=Release
to the command line.Hi @mchinand, i've tried it but it didnt changed anything, it worked but it didnt created any new file... maybe i have to delete my build-sqldrivers folder?
-
@mchinand said in MySql plugin not working for release version of a project:
Re-run cmake and add
-DCMAKE_BUILD_TYPE=Release
to the command line.Hi @mchinand, i've tried it but it didnt changed anything, it worked but it didnt created any new file... maybe i have to delete my build-sqldrivers folder?
-
Hi,
Might be a silly question but did you actually also do the build and install calls afterward ?
-
@SGaist said in MySql plugin not working for release version of a project:
Hi,
Might be a silly question but did you actually also do the build and install calls afterward ?
Hi, and yes... but now that i noticed it didnt went well as i thought it actually failed locating a file:
It didnt created the qsqlmysql.dll -
From the looks of it you built directly in the sources.
What I would recommend is doing like the documentation suggests: create a build folder and redo your build for release in there so there's no leftover from your previous build that might interfere.
-
Tricky one !
Glad you found out and thanks for sharing :-)