Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MySql plugin not working for release version of a project
Forum Updated to NodeBB v4.3 + New Features

MySql plugin not working for release version of a project

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 5 Posters 630 Views 2 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.
  • M Offline
    M Offline
    Marcusdrl
    wrote on last edited by
    #1

    I have MySql plugin installed and it works fine with my debug version of this project, im trying to deploy it right now and i cant make the release version work since it doesnt show 'MYSQL' as a viable option of a database. Ive built it following the documentation https://doc.qt.io/qt-6/sql-driver.html , and i didnt noticed anything mentioning that i had to make another build for the release version and im not sure what to do now... any help would be appreciated.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      So do you have actually build a release qt-sql plugin - is there a mysql plugin without a 'd' suffix?

      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
      • M Offline
        M Offline
        mchinand
        wrote on last edited by
        #3

        Re-run cmake and add -DCMAKE_BUILD_TYPE=Release to the command line.
        You can also set the environment variable QT_DEBUG_PLUGINS=1 and check the output when it tries to load your plugin. With release build of your app and debug-built plugin, you will probably get something like the following, note the part at the end (this is for the debug-build of the QtCompany-supplied Postgres plugin):

        QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll"
        Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll, metadata=
        {
            "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
            "MetaData": {
                "Keys": [
                    "QPSQL7",
                    "QPSQL"
                ]
            },
            "archreq": 1,
            "className": "QPSQLDriverPlugin",
            "debug": true,
            "version": 331264
        }
        
        
        "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                 not a plugin
        
        
        M 1 Reply Last reply
        0
        • M Offline
          M Offline
          Marcusdrl
          wrote on last edited by
          #4

          @Christian-Ehrlicher hi, theres isnt actually, this is the one i got:
          3dc07b4a-5dd4-4b9a-9702-e98a12879aac-image.png

          As you can see i only have the debug version, i just dont know how to build the release one...

          1 Reply Last reply
          0
          • M mchinand

            Re-run cmake and add -DCMAKE_BUILD_TYPE=Release to the command line.
            You can also set the environment variable QT_DEBUG_PLUGINS=1 and check the output when it tries to load your plugin. With release build of your app and debug-built plugin, you will probably get something like the following, note the part at the end (this is for the debug-build of the QtCompany-supplied Postgres plugin):

            QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll"
            Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll, metadata=
            {
                "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                "MetaData": {
                    "Keys": [
                        "QPSQL7",
                        "QPSQL"
                    ]
                },
                "archreq": 1,
                "className": "QPSQLDriverPlugin",
                "debug": true,
                "version": 331264
            }
            
            
            "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                     not a plugin
            
            
            M Offline
            M Offline
            Marcusdrl
            wrote on last edited by
            #5

            @mchinand said in MySql plugin not working for release version of a project:

            Re-run cmake and add -DCMAKE_BUILD_TYPE=Release to the command line.

            Hi @mchinand, i've tried it but it didnt changed anything, it worked but it didnt created any new file... maybe i have to delete my build-sqldrivers folder?

            eyllanescE 1 Reply Last reply
            0
            • M Marcusdrl

              @mchinand said in MySql plugin not working for release version of a project:

              Re-run cmake and add -DCMAKE_BUILD_TYPE=Release to the command line.

              Hi @mchinand, i've tried it but it didnt changed anything, it worked but it didnt created any new file... maybe i have to delete my build-sqldrivers folder?

              eyllanescE Offline
              eyllanescE Offline
              eyllanesc
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                Might be a silly question but did you actually also do the build and install calls afterward ?

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

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Marcusdrl
                  wrote on last edited by
                  #8

                  @SGaist said in MySql plugin not working for release version of a project:

                  Hi,

                  Might be a silly question but did you actually also do the build and install calls afterward ?

                  Hi, and yes... but now that i noticed it didnt went well as i thought it actually failed locating a file:
                  6749446e-568f-48b6-8486-2c9b800768e3-image.png
                  It didnt created the qsqlmysql.dll

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    From the looks of it you built directly in the sources.

                    What I would recommend is doing like the documentation suggests: create a build folder and redo your build for release in there so there's no leftover from your previous build that might interfere.

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

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Marcusdrl
                      wrote on last edited by
                      #10

                      So i figured out why it wasnt installing, i forgot to initialize a vcvarsall.bat instance inside my MSVCx64 CMD, everything working now, thank you for your attention @SGaist

                      1 Reply Last reply
                      1
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Tricky one !

                        Glad you found out and thanks for sharing :-)

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

                        1 Reply Last reply
                        0

                        • Login

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