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!
Forum Updated to NodeBB v4.3 + New Features

QSqlDatabase: QPSQL driver not loaded once again!

Scheduled Pinned Locked Moved Solved Installation and Deployment
qpsqlqsqlpostgresqldeploydeploying
18 Posts 3 Posters 13.6k 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 mbnoimi

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

    raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on 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
    0
    • raven-worxR raven-worx

      @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 last edited by mbnoimi
      #7

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

      raven-worxR 1 Reply Last reply
      0
      • M mbnoimi

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

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on 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
        0
        • raven-worxR raven-worx

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

          raven-worxR 1 Reply Last reply
          0
          • M mbnoimi

            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

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on 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
            0
            • raven-worxR raven-worx

              @mbnoimi
              so something is wrong with your psql binaries.

              Maybe a mismatch between x86 and x64?

              M Offline
              M Offline
              mbnoimi
              wrote on 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)

              raven-worxR 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on 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
                0
                • SGaistS SGaist

                  Hi,

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

                  M Offline
                  M Offline
                  mbnoimi
                  wrote on 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

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

                    raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on 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
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 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

                      raven-worxR M 3 Replies Last reply
                      1
                      • SGaistS SGaist

                        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

                        raven-worxR Offline
                        raven-worxR Offline
                        raven-worx
                        Moderators
                        wrote on 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
                        • SGaistS SGaist

                          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 last edited by
                          #17

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

                          1 Reply Last reply
                          0
                          • SGaistS SGaist

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

                            • Login

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