(MySQL) qsqlmysql.dll doesn't get created.
-
@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
-
@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
@Christian-Ehrlicher
Done and done.Running the qt-cmake -G Ninja <arguments> is returning
-- The CXX compiler identification is unknown -- The C compiler identification is unknown -- The ASM compiler identification is unknown -- Didn't find assembler CMake Error at CMakeLists.txt:7 (project): No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
Taking a look at my CMakeList.txt at ...\sqldrivers and can't find the CMAKE_CXX_COMPILER entry. I assume I need to set it to
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\Hostx64\x64\cl.exe -
@Christian-Ehrlicher
Done and done.Running the qt-cmake -G Ninja <arguments> is returning
-- The CXX compiler identification is unknown -- The C compiler identification is unknown -- The ASM compiler identification is unknown -- Didn't find assembler CMake Error at CMakeLists.txt:7 (project): No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
Taking a look at my CMakeList.txt at ...\sqldrivers and can't find the CMAKE_CXX_COMPILER entry. I assume I need to set it to
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\Hostx64\x64\cl.exe@Thelonious You don't need it to set to anything. You have to make sure that the msvc environment is properly set up the same way you did it in your previous attempts.
-
@Thelonious You don't need it to set to anything. You have to make sure that the msvc environment is properly set up the same way you did it in your previous attempts.
Still getting the same error.
I might have to use SQLite while I build my code and come back to this. Something about my environment is just not right and the QT help article on building MySQL drivers seems to be missing a lot of explanations and is giving examples for a specific and out-of-date MySQL environment. The help article doesn't specify what directory any of these commands should be run from.
-
Still getting the same error.
I might have to use SQLite while I build my code and come back to this. Something about my environment is just not right and the QT help article on building MySQL drivers seems to be missing a lot of explanations and is giving examples for a specific and out-of-date MySQL environment. The help article doesn't specify what directory any of these commands should be run from.
Since you managed to set up your compiler environment before and no no longer I don't know what you're doing wrong. Call the correct vsvars batch file to set up your msvc compiler...
-
Since you managed to set up your compiler environment before and no no longer I don't know what you're doing wrong. Call the correct vsvars batch file to set up your msvc compiler...
The difference is I'm having to add
-G Ninja
to qt-cmake.
I can make the plugins without it but when it comes time to --build the driver I get
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]
-
The difference is I'm having to add
-G Ninja
to qt-cmake.
I can make the plugins without it but when it comes time to --build the driver I get
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]
Your system is unclean, there's no reason for the projects to be in the bin folder of your Qt installation.
-
Your system is unclean, there's no reason for the projects to be in the bin folder of your Qt installation.
@SGaist qt-cmake resides in the bin folder. Everything i'm creating/building is in an adjacent "build-sqldrivers" folder at
C:\Qt\6.4.3\msvc2019_64\
-
@SGaist qt-cmake resides in the bin folder. Everything i'm creating/building is in an adjacent "build-sqldrivers" folder at
C:\Qt\6.4.3\msvc2019_64\
You really should stay out of the source and the installation folders.
-
@SGaist The help article at https://doc.qt.io/qt-6/sql-driver.html literally shows the driver building directory as bin.
Pulled directly from the article
C:\Qt\6.0.0\mingw81_64\bin\qt-cmake -G Ninja C:\Qt\6.0.0\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.0.0\mingw81_64" Configure summary: Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. yes OCI (Oracle) ........................... no ODBC ................................... yes PostgreSQL ............................. no SQLite ................................. yes Using system provided SQLite ......... no -- Configuring done -- Generating done -- Build files have been written to: C:/build-qt6-sqldrivers
It feels as though MySQL has taken a tangent from QT support; it's clear they aren't working closely together. I can go ahead and write my program using SQLite and revisit this in the future because i'm all out of ideas.
I really do appreciate all of yalls help though, there were a few moments when I thought I almost had it.
-
@SGaist The help article at https://doc.qt.io/qt-6/sql-driver.html literally shows the driver building directory as bin.
Pulled directly from the article
C:\Qt\6.0.0\mingw81_64\bin\qt-cmake -G Ninja C:\Qt\6.0.0\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.0.0\mingw81_64" Configure summary: Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. yes OCI (Oracle) ........................... no ODBC ................................... yes PostgreSQL ............................. no SQLite ................................. yes Using system provided SQLite ......... no -- Configuring done -- Generating done -- Build files have been written to: C:/build-qt6-sqldrivers
It feels as though MySQL has taken a tangent from QT support; it's clear they aren't working closely together. I can go ahead and write my program using SQLite and revisit this in the future because i'm all out of ideas.
I really do appreciate all of yalls help though, there were a few moments when I thought I almost had it.
The last line is important: everything happens in ˋc:/build-qt6-sqldrivers`.
-
@SGaist
I'm going reinstall Qt and try again.I'll open up a cmd prompt
C:\mysql
and then invoke qt-cmake using it's pathC:\Qt\6.4.3\msvc2019_64\bin\qt-cmake
I'll let you know how it goes. Ninja won't install on my system, give some sort of error regarding Microsoft Store.
-
@SGaist
I'm going reinstall Qt and try again.I'll open up a cmd prompt
C:\mysql
and then invoke qt-cmake using it's pathC:\Qt\6.4.3\msvc2019_64\bin\qt-cmake
I'll let you know how it goes. Ninja won't install on my system, give some sort of error regarding Microsoft Store.
Are you installing it through the Qt installer ?
-
@SGaist It is bundled with Qt in the
C:\Qt\Tools\Ninja\
folder but I can't "install" it. I tried searching for an answer it seems that its blocked by Microsoft Defender or something else in my environment that I can't disable. Do you think the drivers can be built without it?BTW, i'm a linux guy at heart and I'm probably going to try to set my Ubuntu environment at home for this.
-
@SGaist It is bundled with Qt in the
C:\Qt\Tools\Ninja\
folder but I can't "install" it. I tried searching for an answer it seems that its blocked by Microsoft Defender or something else in my environment that I can't disable. Do you think the drivers can be built without it?BTW, i'm a linux guy at heart and I'm probably going to try to set my Ubuntu environment at home for this.
Then there's nothing more you need to do. It should just work (tm). Ninja should be available.
On Linux you can use your distribution's Qt dev packages. It will be easier.
-
Then there's nothing more you need to do. It should just work (tm). Ninja should be available.
On Linux you can use your distribution's Qt dev packages. It will be easier.
@SGaist
Normally I have to modify the qt-cmake.bat file to direct it to the correct folder for CMake. Should I be modifying that or should I move my CMake installation folder to where its currently represented in the file? Same question for Ninja. -
@SGaist
Normally I have to modify the qt-cmake.bat file to direct it to the correct folder for CMake. Should I be modifying that or should I move my CMake installation folder to where its currently represented in the file? Same question for Ninja.You shouldn't need to do that at all.
If cmake is not found, you are likely using a terminal not configured properly.You can modify the PATH environment variable.
-
You shouldn't need to do that at all.
If cmake is not found, you are likely using a terminal not configured properly.You can modify the PATH environment variable.
BREAKTHROUGH!!!
explanation incoming
-
You shouldn't need to do that at all.
If cmake is not found, you are likely using a terminal not configured properly.You can modify the PATH environment variable.
Here's what I did and what I got.
Before I go any further I'd really like to thank you @SGaist, @Christian-Ehrlicher , @jsulm for your help. I am approaching this as a complete beginner and this is no simple task to understand.
After I got by butt out of the QT folder for building I used the Start Menu terminal entry for the platform my app will be in (MSVC2019_64) and navigated to my self-made
C:\mysql
folder.I was able to build the plugins using
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"
Once the plugins were created I was able to build
qsqlmysql.dll
andqsqlmysql.pdb
by opening the ALL_BUILD.vcxproj in visual studio and building it there (which is what I think @Christian-Ehrlicher was trying to tell me instead of using the command line).I transferred the newly made
qsqlmysql.dll
andqsqlmysql.pdb
to the platform folder ofC:\Qt\6.4.3\msvc2019_64\plugins\sqldrivers
.I believe I still have to install the drivers but this is obviously the result I've yet to get up to this point.
EDIT:
Did the same process of opening up INSTALL.vcxproj in Visual Studio and building it there and it was also a success. Now I imagine I just have the right #includes in my project and should be able to connect to MySQL. If it would benefit the community I'd be happy to write up an in depth breakdown of how this is done for my system.
-
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...Where do I find the project that builds the debug version? I have the release qsqlmysql.<dll.pdb> but not qsqlmysqld<dll.pdb>