Building QMYSQL / MARIADB with Qt 6.3.0
-
Sorry, I have done that correct, I just found it.
That doesn't seem to have done anything, in fact it was already set towards 1 when I checked. The online installer also seems to have CMake 3.21.1 64-bit showing as installed under Developer and Designer Tools. -
If the environment variable is properly defined, you should have a dump of information about the plugins being loaded and why they failed.
-
@SGaist
I'm assuming this would be{ "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL", "QMARIADB" ] }, "archlevel": 0, "className": "QMYSQLDriverPlugin", "debug": true, "version": 393728 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB") qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
Along with this line.
qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" cannot load: Cannot load library C:\Qt\6.3.0\mingw_64\plugins\sqldrivers\qsqlmysql.dll: The specified module could not be found. qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\\Qt\\6.3.0\\mingw_64\\plugins\\sqldrivers\\qsqlmysql.dll: The specified module could not be found."
Since that's the sqldriver folder, I checked. Results are above. I can only guess that there's a missing .debug file, or that the .dll is incompatible with Qt for some reason. -
Maybe a silly question but are you sure that the dll you have now is from the correct compiler ?
-
You do not have to rebuild everything. Just the plugin.
-
@SGaist
I'm not entirely sure how to build it based on the documentation. I have the files for MariaDB location in the right folders when it comes to the .lib, .dll and .h files. Problem is that I'm not sure where I should be for building the plugins when it comes to the command prompt.mkdir build-sqldrivers cd build-sqldrivers qt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib" cmake --build . cmake --install .
I'm not entirely sure where I should be located within my file structure to build the plugins, inside of the Qt 6.3.0 folder? The bin folder of the Qt 6.3.0 folder perhaps? qt-cmake doesn't seem to be recgonised as a command, so I assume it's located somewhere inside of the Qt folder.
'qt-cmake' is not recognized as an internal or external command, operable program or batch file.
I also do not know what Ninja refers to within the command. Do I need to install this too?
-
Try with just cmake in place of qt-cmake.
As for Ninja, it's also available through the installer.
-
@SGaist
Since I'm using and building for MariaDBqt-cmake -G Ninja <qt_installation_path>\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=<qt_installation_path>\<platform> -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib"
The DMySQL and DMySQL_LIBRARY should probably be replaced with DMariaDB or some equivalent, correct? The locations will change, but obviously those are where I've installed the relevant files.
-
From memory, no, MariaDB is a drop in replacement so it would not make sense to complicate the build system for that.