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 6.7k 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.
  • J jsulm
    31 Mar 2023, 06:31

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

    C Online
    C Online
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on 31 Mar 2023, 06:33 last edited by
    #14

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

    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 31 Mar 2023, 12:48
    1
    • C Christian Ehrlicher
      31 Mar 2023, 06:33

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

      T Offline
      T Offline
      Thelonious
      wrote on 31 Mar 2023, 12:48 last edited by
      #15

      @Christian-Ehrlicher

      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,

      C 1 Reply Last reply 31 Mar 2023, 12:59
      0
      • T Thelonious
        31 Mar 2023, 12:48

        @Christian-Ehrlicher

        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,

        C Online
        C Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 31 Mar 2023, 12:59 last edited by
        #16

        @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 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 31 Mar 2023, 13:19
        0
        • C Christian Ehrlicher
          31 Mar 2023, 12:59

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

          T Offline
          T Offline
          Thelonious
          wrote on 31 Mar 2023, 13:19 last edited by Thelonious
          #17

          @Christian-Ehrlicher

          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
          
          C 1 Reply Last reply 31 Mar 2023, 13:24
          0
          • T Thelonious
            31 Mar 2023, 13:19

            @Christian-Ehrlicher

            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
            
            C Online
            C Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 31 Mar 2023, 13:24 last edited by
            #18

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

            So you only compiled the release plugin but running a debug app.

            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 31 Mar 2023, 13:32
            0
            • C Christian Ehrlicher
              31 Mar 2023, 13:24

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

              So you only compiled the release plugin but running a debug app.

              T Offline
              T Offline
              Thelonious
              wrote on 31 Mar 2023, 13:32 last edited by
              #19

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

              C 1 Reply Last reply 31 Mar 2023, 14:25
              0
              • T Thelonious
                31 Mar 2023, 13:32

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

                C Online
                C Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 31 Mar 2023, 14:25 last edited by Christian Ehrlicher
                #20

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

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

                T 2 Replies Last reply 31 Mar 2023, 14:44
                0
                • C Christian Ehrlicher
                  31 Mar 2023, 14:25

                  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 31 Mar 2023, 14:44 last edited by
                  #21

                  @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

                  C 1 Reply Last reply 31 Mar 2023, 15:01
                  0
                  • T Thelonious
                    31 Mar 2023, 14:44

                    @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

                    C Online
                    C Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 31 Mar 2023, 15:01 last edited by
                    #22

                    @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

                    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 31 Mar 2023, 15:15
                    0
                    • C Christian Ehrlicher
                      31 Mar 2023, 15:01

                      @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

                      T Offline
                      T Offline
                      Thelonious
                      wrote on 31 Mar 2023, 15:15 last edited by
                      #23

                      @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

                      C 1 Reply Last reply 31 Mar 2023, 15:20
                      0
                      • T Thelonious
                        31 Mar 2023, 15:15

                        @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

                        C Online
                        C Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 31 Mar 2023, 15:20 last edited by
                        #24

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

                        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 31 Mar 2023, 15:44
                        0
                        • C Christian Ehrlicher
                          31 Mar 2023, 15:20

                          @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 31 Mar 2023, 15:44 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.

                          C 1 Reply Last reply 31 Mar 2023, 16:32
                          0
                          • T Thelonious
                            31 Mar 2023, 15:44

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

                            C Online
                            C Online
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on 31 Mar 2023, 16:32 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 31 Mar 2023, 17:04
                            0
                            • C Christian Ehrlicher
                              31 Mar 2023, 16:32

                              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 31 Mar 2023, 17:04 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]
                              
                              S 1 Reply Last reply 31 Mar 2023, 19:02
                              0
                              • T Thelonious
                                31 Mar 2023, 17:04

                                @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]
                                
                                S Offline
                                S Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on 31 Mar 2023, 19:02 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 31 Mar 2023, 19:06
                                0
                                • S SGaist
                                  31 Mar 2023, 19:02

                                  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 31 Mar 2023, 19:06 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\
                                  
                                  S 1 Reply Last reply 31 Mar 2023, 19:09
                                  0
                                  • T Thelonious
                                    31 Mar 2023, 19:06

                                    @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\
                                    
                                    S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 31 Mar 2023, 19:09 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 31 Mar 2023, 19:16
                                    0
                                    • S SGaist
                                      31 Mar 2023, 19:09

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

                                      T Offline
                                      T Offline
                                      Thelonious
                                      wrote on 31 Mar 2023, 19:16 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.

                                      S 1 Reply Last reply 31 Mar 2023, 19:19
                                      0
                                      • T Thelonious
                                        31 Mar 2023, 19:16

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

                                        S Offline
                                        S Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on 31 Mar 2023, 19:19 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 31 Mar 2023, 19:29
                                        0
                                        • S SGaist
                                          31 Mar 2023, 19:19

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

                                          T Offline
                                          T Offline
                                          Thelonious
                                          wrote on 31 Mar 2023, 19:29 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.

                                          S 1 Reply Last reply 31 Mar 2023, 19:34
                                          0

                                          23/42

                                          31 Mar 2023, 15:15

                                          • Login

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