Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. (MySQL) qsqlmysql.dll doesn't get created.
Forum Updated to NodeBB v4.3 + New Features

(MySQL) qsqlmysql.dll doesn't get created.

Scheduled Pinned Locked Moved Solved Installation and Deployment
42 Posts 4 Posters 7.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Christian EhrlicherC Christian Ehrlicher

    @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.

    T Offline
    T Offline
    Thelonious
    wrote on last edited by
    #25

    @Christian-Ehrlicher

    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.

    Christian EhrlicherC 1 Reply Last reply
    0
    • T Thelonious

      @Christian-Ehrlicher

      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.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #26

      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...

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      T 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        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...

        T Offline
        T Offline
        Thelonious
        wrote on last edited by
        #27

        @Christian-Ehrlicher

        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]
        
        SGaistS 1 Reply Last reply
        0
        • T Thelonious

          @Christian-Ehrlicher

          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]
          
          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #28

          Your system is unclean, there's no reason for the projects to be in the bin folder of your Qt installation.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          T 1 Reply Last reply
          0
          • SGaistS SGaist

            Your system is unclean, there's no reason for the projects to be in the bin folder of your Qt installation.

            T Offline
            T Offline
            Thelonious
            wrote on last edited by Thelonious
            #29

            @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\
            
            SGaistS 1 Reply Last reply
            0
            • T Thelonious

              @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\
              
              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #30

              You really should stay out of the source and the installation folders.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              T 1 Reply Last reply
              0
              • SGaistS SGaist

                You really should stay out of the source and the installation folders.

                T Offline
                T Offline
                Thelonious
                wrote on last edited by
                #31

                @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.

                SGaistS 1 Reply Last reply
                0
                • T Thelonious

                  @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.

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #32

                  The last line is important: everything happens in ˋc:/build-qt6-sqldrivers`.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  T 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    The last line is important: everything happens in ˋc:/build-qt6-sqldrivers`.

                    T Offline
                    T Offline
                    Thelonious
                    wrote on last edited by
                    #33

                    @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 path

                    C:\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.

                    SGaistS 1 Reply Last reply
                    0
                    • T Thelonious

                      @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 path

                      C:\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.

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #34

                      Are you installing it through the Qt installer ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      T 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Are you installing it through the Qt installer ?

                        T Offline
                        T Offline
                        Thelonious
                        wrote on last edited by Thelonious
                        #35

                        @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.

                        SGaistS 1 Reply Last reply
                        0
                        • T Thelonious

                          @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.

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #36

                          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.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          T 1 Reply Last reply
                          1
                          • SGaistS SGaist

                            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.

                            T Offline
                            T Offline
                            Thelonious
                            wrote on last edited by
                            #37

                            @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.

                            SGaistS 1 Reply Last reply
                            0
                            • T Thelonious

                              @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.

                              SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #38

                              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.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              T 2 Replies Last reply
                              1
                              • SGaistS SGaist

                                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.

                                T Offline
                                T Offline
                                Thelonious
                                wrote on last edited by Thelonious
                                #39

                                BREAKTHROUGH!!!

                                explanation incoming

                                1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  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.

                                  T Offline
                                  T Offline
                                  Thelonious
                                  wrote on last edited by Thelonious
                                  #40

                                  @SGaist

                                  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 and qsqlmysql.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 and qsqlmysql.pdb to the platform folder of C:\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.

                                  1 Reply Last reply
                                  0
                                  • Christian EhrlicherC Christian Ehrlicher

                                    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...

                                    T Offline
                                    T Offline
                                    Thelonious
                                    wrote on last edited by Thelonious
                                    #41

                                    @Christian-Ehrlicher

                                    Where do I find the project that builds the debug version? I have the release qsqlmysql.<dll.pdb> but not qsqlmysqld<dll.pdb>

                                    Christian EhrlicherC 1 Reply Last reply
                                    0
                                    • T Thelonious

                                      @Christian-Ehrlicher

                                      Where do I find the project that builds the debug version? I have the release qsqlmysql.<dll.pdb> but not qsqlmysqld<dll.pdb>

                                      Christian EhrlicherC Offline
                                      Christian EhrlicherC Offline
                                      Christian Ehrlicher
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #42

                                      @Thelonious You can change the build type in the msvc IDE.

                                      But as I said - use NMake Makefiles or Ninja to create both of them directly on the command line...

                                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                      Visit the Qt Academy at https://academy.qt.io/catalog

                                      1 Reply Last reply
                                      0
                                      • T Thelonious has marked this topic as solved on

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved