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 Driver not found (Qt5 MinGW32)
Forum Updated to NodeBB v4.3 + New Features

MySQL Driver not found (Qt5 MinGW32)

Scheduled Pinned Locked Moved Solved Installation and Deployment
22 Posts 3 Posters 6.3k 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.
  • S Offline
    S Offline
    starryeyed
    wrote on 9 Apr 2018, 11:17 last edited by
    #1

    Hello. I want to figure out how to launch built application (release) in the same way that Qt Creator launches it. Basically, if I point the app to path with libmysql.dll (using either QCoreApplication::setLibraryPaths() or qt.conf) it still will say "Driver not found". Moreover, even if I actually install Qt on target computer and rebuild the app, the only way to launch it normally is still from the Qt Creator, so I feel like I'm missing something. Maybe, proper "LIBS" or "INCLUDEPATH" in .pro file? I've tried different things, and I've tried combining those approaches, still no luck

    J 1 Reply Last reply 9 Apr 2018, 11:30
    0
    • S starryeyed
      9 Apr 2018, 11:17

      Hello. I want to figure out how to launch built application (release) in the same way that Qt Creator launches it. Basically, if I point the app to path with libmysql.dll (using either QCoreApplication::setLibraryPaths() or qt.conf) it still will say "Driver not found". Moreover, even if I actually install Qt on target computer and rebuild the app, the only way to launch it normally is still from the Qt Creator, so I feel like I'm missing something. Maybe, proper "LIBS" or "INCLUDEPATH" in .pro file? I've tried different things, and I've tried combining those approaches, still no luck

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 9 Apr 2018, 11:30 last edited by
      #2

      @starryeyed Do you use http://doc.qt.io/qt-5/windows-deployment.html? Do you deploy Qt plug-ins used by your app?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 9 Apr 2018, 11:52
      2
      • J jsulm
        9 Apr 2018, 11:30

        @starryeyed Do you use http://doc.qt.io/qt-5/windows-deployment.html? Do you deploy Qt plug-ins used by your app?

        S Offline
        S Offline
        starryeyed
        wrote on 9 Apr 2018, 11:52 last edited by
        #3

        @jsulm I tried official windeployqt.exe. It does not put "libmysql.dll" into the target directory, so I feel like when launching in my dev. environment the driver gets detected "unintentionally", and I yet have to figure out how to make app want that dll. Or windeployqt never copies 3rd party dlls, even if they're properly listed as plugins/etc.?
        Here's output of windeployqt, even though I have separately installed MinGW 5.3.0 directory in my Path env. variable, it still says "can't find GCC"

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 9 Apr 2018, 21:25 last edited by
          #4

          Hi and welcome to devnet,

          You can modify the PATH environment variable in that console to point to your MinGW installation so the related dependencies can be found.

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

          S 1 Reply Last reply 12 Apr 2018, 15:04
          0
          • S SGaist
            9 Apr 2018, 21:25

            Hi and welcome to devnet,

            You can modify the PATH environment variable in that console to point to your MinGW installation so the related dependencies can be found.

            S Offline
            S Offline
            starryeyed
            wrote on 12 Apr 2018, 15:04 last edited by
            #5

            @SGaist the problem is that required paths are already in %path%...
            One is C:\Qt\5.10.1\mingw53_32\bin
            The other is C:\Qt\Tools\mingw530_32\bin

            J 1 Reply Last reply 13 Apr 2018, 05:50
            0
            • S starryeyed
              12 Apr 2018, 15:04

              @SGaist the problem is that required paths are already in %path%...
              One is C:\Qt\5.10.1\mingw53_32\bin
              The other is C:\Qt\Tools\mingw530_32\bin

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 13 Apr 2018, 05:50 last edited by
              #6

              @starryeyed What about C:\Qt\Tools\mingw530_32\lib and its subdirectories?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              S 1 Reply Last reply 13 Apr 2018, 17:59
              1
              • J jsulm
                13 Apr 2018, 05:50

                @starryeyed What about C:\Qt\Tools\mingw530_32\lib and its subdirectories?

                S Offline
                S Offline
                starryeyed
                wrote on 13 Apr 2018, 17:59 last edited by
                #7

                @jsulm I've added the "lib" directory to %path% and now windeployqt does not produce any errors, here's it's current output. The list of files it copies still haven't change as far as I see, and it still doesn't include libmysql.dll, though I've tried adding these lines to .pro file

                
                win32: LIBS += -L"$$PWD/../../../../Program Files (x86)/MySQL/MySQL Connector C 6.1/lib/" -llibmysql
                
                INCLUDEPATH += "$$PWD/../../../../Program Files (x86)/MySQL/MySQL Connector C 6.1/include"
                DEPENDPATH += "$$PWD/../../../../Program Files (x86)/MySQL/MySQL Connector C 6.1/include"
                
                
                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 13 Apr 2018, 19:24 last edited by
                  #8

                  I'm currently not sure windeployqt tries to find the dependencies of the plugins.

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

                  S 1 Reply Last reply 15 Apr 2018, 18:11
                  1
                  • S SGaist
                    13 Apr 2018, 19:24

                    I'm currently not sure windeployqt tries to find the dependencies of the plugins.

                    S Offline
                    S Offline
                    starryeyed
                    wrote on 15 Apr 2018, 18:11 last edited by
                    #9

                    @SGaist So probably I shouldn't care much about what windeployqt copies and just add the missing dll myself, but can you give any hints on forcing the application to find it? As I've mentioned, I tried using both ::setLibraryPaths() and qt.conf to add/override the directory where it looks for plugins, no results :(
                    qt.conf for example normally overrides any paths, but the .exe is still missing the same driver, I don't understand what is missing

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 15 Apr 2018, 21:00 last edited by
                      #10

                      You should have the external dependencies (like OpenSSL etc.) in the same folder as the application in order for your application to find them.

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

                      S 1 Reply Last reply 15 Apr 2018, 23:44
                      0
                      • S SGaist
                        15 Apr 2018, 21:00

                        You should have the external dependencies (like OpenSSL etc.) in the same folder as the application in order for your application to find them.

                        S Offline
                        S Offline
                        starryeyed
                        wrote on 15 Apr 2018, 23:44 last edited by
                        #11

                        @SGaist I already did numerous tests on different machines, now tried it in IE's dev. image, still the same. "Driver not found".0_1523838234852_prahamap.png
                        I tried outputting library paths as QMessageBoxes just to see if the path is really correctly set, and it is... Here are [0] and [1] elements of QStringList that libraryPaths() returns after setting them...0_1523839504728_pathtomarosh.PNG

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 16 Apr 2018, 21:15 last edited by
                          #12

                          Did you check whether libmysql.dll itself has dependencies ?

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

                          S 1 Reply Last reply 17 Apr 2018, 14:45
                          0
                          • S SGaist
                            16 Apr 2018, 21:15

                            Did you check whether libmysql.dll itself has dependencies ?

                            S Offline
                            S Offline
                            starryeyed
                            wrote on 17 Apr 2018, 14:45 last edited by starryeyed
                            #13

                            @SGaist I can tell you two objective obesrvations, but I really don't know what to get from them.

                            • When I realised I also need to build for win32 (I initially didn't plan), instead of configuring MXE I just installed Qt on my Windows system, and copied project as it was. Everything built fine, tho when launching for 1st time I got the same error you can see on screenshot. After a google search I understood that just installing mysql C connector (which was enough in Linux) isn't enough, and copied dll to the bin folder of minGW. Until current failures in deployment I haven't encountered any plugin/driver/library related problems.

                            • If I become desperate and install the whole dev environment (qtcreator+mingw+connector's dll) onto target machine, I still can only run the app from qt creator, and the only way to fix that is to copy .exe into bin folder of mingw...

                            I guess the dll has no dependencies, otherwise I'd have to solve them too for myself. I think it's very important to understand how launch by qt creator differs from regular launch-by-shortcut. I'm sure there's some lowkey qt trickery going on which I miss and therefore fail to "show the way" to app...

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 17 Apr 2018, 20:29 last edited by
                              #14

                              Qt Creator modifies the PATH environment variable to include the Qt version used by the Kit you selected to build your application.

                              You can check its content in the Run part of the Project panel.

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

                              S 1 Reply Last reply 17 Apr 2018, 23:55
                              1
                              • S SGaist
                                17 Apr 2018, 20:29

                                Qt Creator modifies the PATH environment variable to include the Qt version used by the Kit you selected to build your application.

                                You can check its content in the Run part of the Project panel.

                                S Offline
                                S Offline
                                starryeyed
                                wrote on 17 Apr 2018, 23:55 last edited by starryeyed
                                #15

                                @SGaist Thank you for the insight! Now I have a theory. Because the application is used to find needed dlls together with everything else in QTDIR, it expects the same variable to be set on target PC. Or at least, the "Path" to contain the same things as mingw/bin directory contains on my dev machine.
                                Thing that does not add up in my theory:
                                When I just moved Linux=>Windows and built for 1st time, it was enough to copy libmysql.dll to mingw/bin path.
                                Now, if I paste that dll to Windows\System32 on a VM (which is obviously in Path), it still says "Driver not loaded". What am I missing?

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on 18 Apr 2018, 06:37 last edited by
                                  #16

                                  As I wrote before, check the .dlls with Dependency Walker to see if they have any dependencies. You can also run your application with the QT_DEBUG_PLUGINS environment variable set to one to gather more information about what is happening. You'll have to do that from the console otherwise you won't see much information.

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

                                  S 1 Reply Last reply 18 Apr 2018, 12:48
                                  1
                                  • S SGaist
                                    18 Apr 2018, 06:37

                                    As I wrote before, check the .dlls with Dependency Walker to see if they have any dependencies. You can also run your application with the QT_DEBUG_PLUGINS environment variable set to one to gather more information about what is happening. You'll have to do that from the console otherwise you won't see much information.

                                    S Offline
                                    S Offline
                                    starryeyed
                                    wrote on 18 Apr 2018, 12:48 last edited by starryeyed
                                    #17

                                    @SGaist Unforunately, didn't succeed. Tried Dependency Walker, and it will simply freeze while profiling qt app with plugins, not just mine. I've googled it, look. The dude got the same problem as me with trying to use DW, it just hangs on IMM32.DLL.
                                    I've tried opening the dll itself, here's the list of it's dependencies. 0_1524063249970_pathtomarosh.PNG
                                    I'm sure that vcruntime140.DLL causes problems, but how do I learn which Microsoft VC++ Redistributable it belongs to? I got all versions installed on dev machine, 2005-2017. Will 2008 one do?

                                    I didn't understand how to use that environment variable. I've set it to "1" inside VM as an environment variable (like Path), and launching program didn't change it... Can it really write to system variables? Maybe there's a way to launch it from cmd or with some special software? Here's a shot of cmd launch .0_1524059375388_prahamap.png

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on 18 Apr 2018, 21:13 last edited by
                                      #18

                                      AFAIK VSRUNTIME140 belongs to VS2015.

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

                                      S 1 Reply Last reply 21 Apr 2018, 09:53
                                      0
                                      • S Offline
                                        S Offline
                                        starryeyed
                                        wrote on 21 Apr 2018, 09:43 last edited by
                                        #19
                                        This post is deleted!
                                        1 Reply Last reply
                                        0
                                        • S SGaist
                                          18 Apr 2018, 21:13

                                          AFAIK VSRUNTIME140 belongs to VS2015.

                                          S Offline
                                          S Offline
                                          starryeyed
                                          wrote on 21 Apr 2018, 09:53 last edited by
                                          #20

                                          @SGaist Please guide me from a point of supposed fresh install of Windows 10. After installing x86 version of aforementioned Visual C++ 2015 Redistributable,
                                          I tried recreating "run environment" of Qt Creator, by setting the "Path" env. variable in the VM to same contents as in Qt Creator. I don't know if I'm missing any of the env. variables, but I would rather not invest into copying them manually, 1 by 1... Is there any automated tool to set env. variables or I have to come up with my own script? Also, can you please elaborate on QT_DEBUG_PLUGINS? I understood that I'm expected to set it to 1, but where is the output? To this variable, to some log file or?

                                          1 Reply Last reply
                                          0

                                          1/22

                                          9 Apr 2018, 11:17

                                          • Login

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