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. QSqlDatabase: QPSQL driver not loaded once again!

QSqlDatabase: QPSQL driver not loaded once again!

Scheduled Pinned Locked Moved Solved Installation and Deployment
qpsqlqsqlpostgresqldeploydeploying
18 Posts 3 Posters 13.4k Views
  • 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.
  • R raven-worx
    28 Jun 2016, 11:58

    @mbnoimi
    you posted the dependency list of your application right?
    But libpq.dll is a dependency of the plugin only. And thats the reason why the loading fails i guess.

    Find the DLL on your machine (maybe in C:\Program Files\PostgreSQL\libraries)
    Then try one of the following:

    1. distribute the DLL beside the qpsql.dll plugin
    2. distribute the DLL beside your application exe
    3. add the path to the folder containing libpq.dll to the PATH environment variable (should work for sure)

    i am not 100% sure about the first 2 options though.

    M Offline
    M Offline
    mbnoimi
    wrote on 28 Jun 2016, 12:17 last edited by
    #5

    @raven-worx
    May you please read my first post carefully :) I already put libpq.dll beside my app (option 2).

    Any way I tried your 3rd suggestion but I still get same result :(

    For 1st option I'm unable to find qpsql.dll any place in Qt binaries installation!

    R 1 Reply Last reply 28 Jun 2016, 12:50
    0
    • M mbnoimi
      28 Jun 2016, 12:17

      @raven-worx
      May you please read my first post carefully :) I already put libpq.dll beside my app (option 2).

      Any way I tried your 3rd suggestion but I still get same result :(

      For 1st option I'm unable to find qpsql.dll any place in Qt binaries installation!

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 28 Jun 2016, 12:50 last edited by raven-worx
      #6

      @mbnoimi

      For 1st option I'm unable to find qpsql.dll any place in Qt binaries installation!

      For example should be in C:\Qt\5.6\msvc2015\plugins\sqldrivers

      But to make sure, you can check where the application loads the plugins by setting the QT_DEBUG_PLUGINS to a non-zero value and look out for the psql plugin.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      M 1 Reply Last reply 28 Jun 2016, 13:50
      0
      • R raven-worx
        28 Jun 2016, 12:50

        @mbnoimi

        For 1st option I'm unable to find qpsql.dll any place in Qt binaries installation!

        For example should be in C:\Qt\5.6\msvc2015\plugins\sqldrivers

        But to make sure, you can check where the application loads the plugins by setting the QT_DEBUG_PLUGINS to a non-zero value and look out for the psql plugin.

        M Offline
        M Offline
        mbnoimi
        wrote on 28 Jun 2016, 13:50 last edited by mbnoimi
        #7

        @raven-worx
        May you please read the check of QT_DEBUG_PLUGINS
        https://gist.github.com/mbnoimi/154b31a77a079c45bbdd63d4c1cfe3bc

        R 1 Reply Last reply 28 Jun 2016, 17:44
        0
        • M mbnoimi
          28 Jun 2016, 13:50

          @raven-worx
          May you please read the check of QT_DEBUG_PLUGINS
          https://gist.github.com/mbnoimi/154b31a77a079c45bbdd63d4c1cfe3bc

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 28 Jun 2016, 17:44 last edited by
          #8

          @mbnoimi
          the problem is this line

          QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/sqldrivers/qsqlpsqld.dll" : "Cannot load library C:\\Qt\\Qt5.7.0\\5.7\\mingw53_32\\plugins\\sqldrivers\\qsqlpsqld.dll: %1 is not a valid Win32 application."
          

          seems to be an psql specific error

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          M 1 Reply Last reply 29 Jun 2016, 09:35
          0
          • R raven-worx
            28 Jun 2016, 17:44

            @mbnoimi
            the problem is this line

            QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.7.0/5.7/mingw53_32/plugins/sqldrivers/qsqlpsqld.dll" : "Cannot load library C:\\Qt\\Qt5.7.0\\5.7\\mingw53_32\\plugins\\sqldrivers\\qsqlpsqld.dll: %1 is not a valid Win32 application."
            

            seems to be an psql specific error

            M Offline
            M Offline
            mbnoimi
            wrote on 29 Jun 2016, 09:35 last edited by
            #9

            Thanks @raven-worx I did I mentioned in Stackoverflow link but unfortunately I still get same result.

            NOTE: I update the log of QT_DEBUG_PLUGINS output:
            https://gist.github.com/mbnoimi/154b31a77a079c45bbdd63d4c1cfe3bc

            R 1 Reply Last reply 29 Jun 2016, 09:45
            0
            • M mbnoimi
              29 Jun 2016, 09:35

              Thanks @raven-worx I did I mentioned in Stackoverflow link but unfortunately I still get same result.

              NOTE: I update the log of QT_DEBUG_PLUGINS output:
              https://gist.github.com/mbnoimi/154b31a77a079c45bbdd63d4c1cfe3bc

              R Offline
              R Offline
              raven-worx
              Moderators
              wrote on 29 Jun 2016, 09:45 last edited by
              #10

              @mbnoimi
              so something is wrong with your psql binaries.

              Maybe a mismatch between x86 and x64?

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              M 1 Reply Last reply 29 Jun 2016, 10:11
              0
              • R raven-worx
                29 Jun 2016, 09:45

                @mbnoimi
                so something is wrong with your psql binaries.

                Maybe a mismatch between x86 and x64?

                M Offline
                M Offline
                mbnoimi
                wrote on 29 Jun 2016, 10:11 last edited by
                #11

                @raven-worx

                Maybe a mismatch between x86 and x64?

                To be of mismatching between x86 and x64 I did:

                1. Uninstalled postgres-9.3.4-4-windows-x64
                2. installed postgres-9.3.13-windows
                3. Copied runtime of postgres-9.3.13-windows beside my Qt app

                I get same error message!!!

                Now I'm pretty sure this problem is related to Qt SQL plugin so I'll try to build it by myself (I'll send the result after finish it)

                R 1 Reply Last reply 29 Jun 2016, 10:16
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 29 Jun 2016, 10:13 last edited by
                  #12

                  Hi,

                  Did you check that you have a MinGW build of PostgreSQL ?

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

                  M 1 Reply Last reply 29 Jun 2016, 10:14
                  0
                  • S SGaist
                    29 Jun 2016, 10:13

                    Hi,

                    Did you check that you have a MinGW build of PostgreSQL ?

                    M Offline
                    M Offline
                    mbnoimi
                    wrote on 29 Jun 2016, 10:14 last edited by
                    #13

                    @SGaist Usually Postgresql guys don't use MinGW so their binaries built using MSVS

                    1 Reply Last reply
                    0
                    • M mbnoimi
                      29 Jun 2016, 10:11

                      @raven-worx

                      Maybe a mismatch between x86 and x64?

                      To be of mismatching between x86 and x64 I did:

                      1. Uninstalled postgres-9.3.4-4-windows-x64
                      2. installed postgres-9.3.13-windows
                      3. Copied runtime of postgres-9.3.13-windows beside my Qt app

                      I get same error message!!!

                      Now I'm pretty sure this problem is related to Qt SQL plugin so I'll try to build it by myself (I'll send the result after finish it)

                      R Offline
                      R Offline
                      raven-worx
                      Moderators
                      wrote on 29 Jun 2016, 10:16 last edited by
                      #14

                      @mbnoimi said:

                      Now I'm pretty sure this problem is related to Qt SQL plugin so I'll try to build it by myself (I'll send the result after finish it)

                      I don't know what makes you think that but try it if you want to.

                      What is the content of your PATH env variable? Is there a reference to the psql install dir?

                      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                      If you have a question please use the forum so others can benefit from the solution in the future

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 29 Jun 2016, 10:19 last edited by
                        #15

                        Hence your problem: you are currently using the MinGW build of Qt, so unless you have a MinGW version of PostgreSQL your only option is to use a MSVC build of Qt matching the version used by PostgreSQL.

                        In any case, the PostgreSQL folks have provided a wiki page about MinGW here.

                        Hope it helps

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

                        R M 3 Replies Last reply 29 Jun 2016, 10:23
                        1
                        • S SGaist
                          29 Jun 2016, 10:19

                          Hence your problem: you are currently using the MinGW build of Qt, so unless you have a MinGW version of PostgreSQL your only option is to use a MSVC build of Qt matching the version used by PostgreSQL.

                          In any case, the PostgreSQL folks have provided a wiki page about MinGW here.

                          Hope it helps

                          R Offline
                          R Offline
                          raven-worx
                          Moderators
                          wrote on 29 Jun 2016, 10:23 last edited by
                          #16

                          @SGaist
                          that makes sense of course.
                          One would expect that the Postgresql devs would export the symbols using "C-style" to avoid such problems?!

                          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                          If you have a question please use the forum so others can benefit from the solution in the future

                          1 Reply Last reply
                          1
                          • S SGaist
                            29 Jun 2016, 10:19

                            Hence your problem: you are currently using the MinGW build of Qt, so unless you have a MinGW version of PostgreSQL your only option is to use a MSVC build of Qt matching the version used by PostgreSQL.

                            In any case, the PostgreSQL folks have provided a wiki page about MinGW here.

                            Hope it helps

                            M Offline
                            M Offline
                            mbnoimi
                            wrote on 29 Jun 2016, 10:23 last edited by
                            #17

                            @SGaist Do you know any binaries of PG built by MinGW?

                            1 Reply Last reply
                            0
                            • S SGaist
                              29 Jun 2016, 10:19

                              Hence your problem: you are currently using the MinGW build of Qt, so unless you have a MinGW version of PostgreSQL your only option is to use a MSVC build of Qt matching the version used by PostgreSQL.

                              In any case, the PostgreSQL folks have provided a wiki page about MinGW here.

                              Hope it helps

                              M Offline
                              M Offline
                              mbnoimi
                              wrote on 29 Jun 2016, 10:32 last edited by
                              #18

                              Thank you very much @SGaist and @raven-worx for helping me out. I fixed this issue by using runtime libraries from this project:
                              https://sourceforge.net/projects/postgresql-mingw-w64/

                              1 Reply Last reply
                              1

                              14/18

                              29 Jun 2016, 10:16

                              • Login

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