(MySQL) qsqlmysql.dll doesn't get created.
-
Hi and welcome to devnet,
The build folder should be out of source and out of installation tree.
There's no need for CMAKE_INSTALL_PREFIX, qt-cmake is configured to have that knowledge already.
Hi, and thank you for your response.
I can remove CMAKE_INSTALL_PREFIX from my command, delete CMakeCache.txt and rerun?
The build folder is the first one listed in the command and that should point to a folder outside fo C:\QT\ , correct?
-
Hi, and thank you for your response.
I can remove CMAKE_INSTALL_PREFIX from my command, delete CMakeCache.txt and rerun?
The build folder is the first one listed in the command and that should point to a folder outside fo C:\QT\ , correct?
It can be in a dedicated folder in the Qt folder, just not directly in one of the 6.X or 5.X.
You can create a build_driver folder and do everything there.
Out of curiosity, why not use Qt's provided cmake ?
-
It can be in a dedicated folder in the Qt folder, just not directly in one of the 6.X or 5.X.
You can create a build_driver folder and do everything there.
Out of curiosity, why not use Qt's provided cmake ?
I can use the set PATH command before I run cmake --build . ?
I wasn't aware that I could. Some of the other researching I've done showed that there used to be a .pro file for the sqldrivers and you could include the paths for ..\include and ..\lib in there and run qmake on the file but those seem outdated.
The new command i'm running:
after building the libraries I simply
> set PATH="C:\buildFolder" > cmake --build .
the build still returns
MSBuild version 17.5.1+f6fdcf537 for .NET Framework Automatic MOC for target QMYSQLDriverPlugin cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Qt\6.4.3\msvc2019_64\bin\my sql\QMYSQLDriverPlugin.vcxproj] Automatic MOC for target QODBCDriverPlugin cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Qt\6.4.3\msvc2019_64\bin\od bc\QODBCDriverPlugin.vcxproj] Automatic MOC for target QSQLiteDriverPlugin cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Qt\6.4.3\msvc2019_64\bin\sq lite\QSQLiteDriverPlugin.vcxproj]
And once again thank you for your help!
-
I can use the set PATH command before I run cmake --build . ?
I wasn't aware that I could. Some of the other researching I've done showed that there used to be a .pro file for the sqldrivers and you could include the paths for ..\include and ..\lib in there and run qmake on the file but those seem outdated.
The new command i'm running:
after building the libraries I simply
> set PATH="C:\buildFolder" > cmake --build .
the build still returns
MSBuild version 17.5.1+f6fdcf537 for .NET Framework Automatic MOC for target QMYSQLDriverPlugin cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Qt\6.4.3\msvc2019_64\bin\my sql\QMYSQLDriverPlugin.vcxproj] Automatic MOC for target QODBCDriverPlugin cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Qt\6.4.3\msvc2019_64\bin\od bc\QODBCDriverPlugin.vcxproj] Automatic MOC for target QSQLiteDriverPlugin cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [C:\Qt\6.4.3\msvc2019_64\bin\sq lite\QSQLiteDriverPlugin.vcxproj]
And once again thank you for your help!
It seems you have now things interfering. Did you do a clean configure/build of the drivers ?
-
It seems you have now things interfering. Did you do a clean configure/build of the drivers ?
Yes I believe so. Before I made this post I uninstalled QT 6.4.3 and reinstalled it to get a clean folder.
I must admit I may have misinterpreted your previous suggestion. When you say use a build folder outside of QT; that's where you want me to build those plugin files to, correct?
copy qt-make.txt to the build folder, then :
C:\buildfolder> qt-cmake C:\QT\6.4.3\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\Program Files\MySQL\MySQL Connector c 6.1\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Connector c 6.1\lib\libmysql.lib
-
Yes I believe so. Before I made this post I uninstalled QT 6.4.3 and reinstalled it to get a clean folder.
I must admit I may have misinterpreted your previous suggestion. When you say use a build folder outside of QT; that's where you want me to build those plugin files to, correct?
copy qt-make.txt to the build folder, then :
C:\buildfolder> qt-cmake C:\QT\6.4.3\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\Program Files\MySQL\MySQL Connector c 6.1\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Connector c 6.1\lib\libmysql.lib
You don't need to copy any files. Just use the full path to the executable.
-
-
mkdir build_folder cd build_folder C:/Qt/6.4.3/msvc2019_64/bin/qt-cmake <insert options here> c:/Qt/6.4.3/Src/qtbase/src/plugins/sqldrivers/mysql/ c:/Qt/6.4.3/msvc2019_64/bin/qt-cmake --build .
-
mkdir build_folder cd build_folder C:/Qt/6.4.3/msvc2019_64/bin/qt-cmake <insert options here> c:/Qt/6.4.3/Src/qtbase/src/plugins/sqldrivers/mysql/ c:/Qt/6.4.3/msvc2019_64/bin/qt-cmake --build .
Understood.
Went ahead and did that and it built the plugins in build_folder which is inside C:\Qt\6.4.3\msvc2019_65\ but not in the main path
Then I tried to run
C:\Qt\6.4.3\msvc2019_64\build_folder> cmake --build .
*qt-cmake --build . threw an error
the output remains
While I was waiting for your response (thanks again!) I searched for an answer to those errors and it was suggested that I might need to modify the CMakeLists.txt at ...\src\plugins\sqldrivers . But beyond that i'm stuck,
-
mkdir build_folder cd build_folder C:/Qt/6.4.3/msvc2019_64/bin/qt-cmake <insert options here> c:/Qt/6.4.3/Src/qtbase/src/plugins/sqldrivers/mysql/ c:/Qt/6.4.3/msvc2019_64/bin/qt-cmake --build .
I think I was able to get a good build using
C:\Qt\6.4.3\msvc2019_64\build-sqldrivers>qt-cmake -S C:\Qt\6.4.3\Src\qtbase\src\plugins\sqldrivers -B .
OUTPUT:
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19044. -- Configuring done (1.9s) -- Generating done (0.4s) CMake Warning: Manually-specified variables were not used by the project: CMAKE_TOOLCHAIN_FILE -- Build files have been written to: C:/Qt/6.4.3/msvc2019_64/build-sqldrivers
and cmake --install . yielded
CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modules directory not found in C:/Qt/6.4.3/msvc2019_64/share/cmake-3.26 -- Install configuration: "RelWithDebInfo" -- Up-to-date: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfig.cmake -- Up-to-date: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfigVersion.cmake -- Up-to-date: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfigVersionImpl.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/./plugins/sqldrivers/qsqlmysql.dll -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginTargets.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginTargets-relwithdebinfo.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginAdditionalTargetInfo.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QODBCDriverPluginConfig.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QODBCDriverPluginConfigVersion.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QODBCDriverPluginConfigVersionImpl.cmake CMake Error at odbc/cmake_install.cmake:45 (file): file INSTALL cannot find "C:/Qt/6.4.3/msvc2019_64/build-sqldrivers/plugins/sqldrivers/qsqlodbc.dll": No such file or directory. Call Stack (most recent call first): cmake_install.cmake:42 (include)
Which built qsqlmysql.dll and put it in C:\Qt\6.4.3\msvc2019_64\plugins\sqldrivers
However;
My project still doesn't load QMYSQL
Application Output:
QList("QSQLITE", "QODBC", "QPSQL")
-
I think I was able to get a good build using
C:\Qt\6.4.3\msvc2019_64\build-sqldrivers>qt-cmake -S C:\Qt\6.4.3\Src\qtbase\src\plugins\sqldrivers -B .
OUTPUT:
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19044. -- Configuring done (1.9s) -- Generating done (0.4s) CMake Warning: Manually-specified variables were not used by the project: CMAKE_TOOLCHAIN_FILE -- Build files have been written to: C:/Qt/6.4.3/msvc2019_64/build-sqldrivers
and cmake --install . yielded
CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modules directory not found in C:/Qt/6.4.3/msvc2019_64/share/cmake-3.26 -- Install configuration: "RelWithDebInfo" -- Up-to-date: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfig.cmake -- Up-to-date: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfigVersion.cmake -- Up-to-date: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginConfigVersionImpl.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/./plugins/sqldrivers/qsqlmysql.dll -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginTargets.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginTargets-relwithdebinfo.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QMYSQLDriverPluginAdditionalTargetInfo.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QODBCDriverPluginConfig.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QODBCDriverPluginConfigVersion.cmake -- Installing: C:/Qt/6.4.3/msvc2019_64/lib/cmake/Qt6Sql/Qt6QODBCDriverPluginConfigVersionImpl.cmake CMake Error at odbc/cmake_install.cmake:45 (file): file INSTALL cannot find "C:/Qt/6.4.3/msvc2019_64/build-sqldrivers/plugins/sqldrivers/qsqlodbc.dll": No such file or directory. Call Stack (most recent call first): cmake_install.cmake:42 (include)
Which built qsqlmysql.dll and put it in C:\Qt\6.4.3\msvc2019_64\plugins\sqldrivers
However;
My project still doesn't load QMYSQL
Application Output:
QList("QSQLITE", "QODBC", "QPSQL")
@Thelonious said in (MySQL) qsqlmysql.dll doesn't get created.:
My project still doesn't load QMYSQL
Then set QT_DEBUG_PLUGINS to 1 before running your app and check the output to see why the MySQL plug-in was not loaded. Probably the mysql client library could not be found.
-
@Thelonious said in (MySQL) qsqlmysql.dll doesn't get created.:
My project still doesn't load QMYSQL
Then set QT_DEBUG_PLUGINS to 1 before running your app and check the output to see why the MySQL plug-in was not loaded. Probably the mysql client library could not be found.
@jsulm said in (MySQL) qsqlmysql.dll doesn't get created.:
Probably the mysql client library could not be found
In this case the plugin would at least show up in the available plugins list.
I would guess it's the wrong Qt directory. -
@jsulm said in (MySQL) qsqlmysql.dll doesn't get created.:
Probably the mysql client library could not be found
In this case the plugin would at least show up in the available plugins list.
I would guess it's the wrong Qt directory.So I should move my recently created qsqlmysql.dll into the same folder as my project executable? Do I need to move my plugins from C:\Qt\6.4.3\msvc2019_64\build-sqldrivers?
Thanks for your help,
-
So I should move my recently created qsqlmysql.dll into the same folder as my project executable? Do I need to move my plugins from C:\Qt\6.4.3\msvc2019_64\build-sqldrivers?
Thanks for your help,
@Thelonious said in (MySQL) qsqlmysql.dll doesn't get created.:
So I should move my recently created qsqlmysql.dll into the same folder as my project executable?
I never said this. I just think that C:\Qt\6.4.3\ is not the Qt you're using while running your executable. When you would have followed @jsulm's advise we would have known more.
-
@Thelonious said in (MySQL) qsqlmysql.dll doesn't get created.:
So I should move my recently created qsqlmysql.dll into the same folder as my project executable?
I never said this. I just think that C:\Qt\6.4.3\ is not the Qt you're using while running your executable. When you would have followed @jsulm's advise we would have known more.
qt.core.plugin.factoryloader: looking at "C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL", "QMARIADB" ] }, "archlevel": 0, "className": "QMYSQLDriverPlugin", "debug": false, "version": 394240 } qt.core.plugin.factoryloader: "The plugin 'C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin
-
qt.core.plugin.factoryloader: looking at "C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll" qt.core.plugin.loader: Found metadata in lib C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QMYSQL", "QMARIADB" ] }, "archlevel": 0, "className": "QMYSQLDriverPlugin", "debug": false, "version": 394240 } qt.core.plugin.factoryloader: "The plugin 'C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" not a plugin
@Thelonious said in (MySQL) qsqlmysql.dll doesn't get created.:
qt.core.plugin.factoryloader: "The plugin 'C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
not a pluginSo you only compiled the release plugin but running a debug app.
-
@Thelonious said in (MySQL) qsqlmysql.dll doesn't get created.:
qt.core.plugin.factoryloader: "The plugin 'C:/Qt/6.4.3/msvc2019_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"
not a pluginSo you only compiled the release plugin but running a debug app.
@Christian-Ehrlicher
I apologize; the QT help article on building MySQL drivers doesn't specify how to make a debug version. Can you please point me somewhere that explains the difference or shows me hot to make the debug plugin? -
@Christian-Ehrlicher
I apologize; the QT help article on building MySQL drivers doesn't specify how to make a debug version. Can you please point me somewhere that explains the difference or shows me hot to make the debug plugin?Either open the generated solution and build the debug version (can also be done from the command line but I don't remember the commands) or use
-G Ninja
or-G NMake Makefiles
for the cmake generator - they both produce rules to create both plugins directly. Maybe we should add this to the documentation. MSBuild is not meant to be run on the command line and therefore has a lot of strange switches... -
Either open the generated solution and build the debug version (can also be done from the command line but I don't remember the commands) or use
-G Ninja
or-G NMake Makefiles
for the cmake generator - they both produce rules to create both plugins directly. Maybe we should add this to the documentation. MSBuild is not meant to be run on the command line and therefore has a lot of strange switches...@Christian-Ehrlicher
Interestingly enough after I run qt-cmake the only solution file I get is QSQLiteDriverPlugin.sln. Seems like a lot of people are having problems building the new driver.How would I got about installing ninja for use with cmake? I downloaded CMake separately.
-Thanks
-
@Christian-Ehrlicher
Interestingly enough after I run qt-cmake the only solution file I get is QSQLiteDriverPlugin.sln. Seems like a lot of people are having problems building the new driver.How would I got about installing ninja for use with cmake? I downloaded CMake separately.
-Thanks
@Thelonious said in (MySQL) qsqlmysql.dll doesn't get created.:
How would I got about installing ninja for use with cmake? I downloaded CMake separately.
If you want to use ninja, download it and put it in your PATH