Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Compiled and installed QPSQL plugin, but driver still not loaded? (Win 10)



  • Hi,

    I am trying to get the PSQL plugin running for current Postgresql 13.

    This is what I have done using the command line for the right Qt version:

    call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
    cd C:\Qt\5.14.2\Src\qtbase\src\plugins\sqldrivers
    qmake -- PSQL_INCDIR="C:/Program Files/PostgreSQL/13/include" PSQL_LIBDIR="C:/Program Files/PostgreSQL/13/lib" -sql-psql
    nmake sub-psql
    nmake install
    

    Everything worked fine (no errors) and in the folder "C:\Qt\5.14.2\msvc2017_64\plugins\sqldrivers" I got the following files which were updated after runing the code previously shown (visible on the modification date):

    74cb4ca7-32a8-46d6-bb17-b85c04dd89a9-grafik.png

    The following code leads to "QPSQL driver not loaded":

    QSqlDatabase db;
        db.addDatabase("QPSQL");
    
        db.setHostName("localhost");
        db.setDatabaseName("conf");
        db.setPassword("cdt321");
        db.setUserName("postgres");
        if(db.open())
        {
        qDebug() <<"opened" ;
        db.close();
    
        }
        else
        {
        qDebug() << db.lastError().text();
        }
    

    Do you have any idea what I have done wrong?

    Thanks!


  • Lifetime Qt Champion

    @robro said in Compiled and installed QPSQL plugin, but driver still not loaded? (Win 10):

    Do you have any idea what I have done wrong?

    As always (and answered more than houndred times here) - make sure the needed dependencies of the plugin are available and in the PATH. Search the forum for more information.



  • @robro
    As per @Christian-Ehrlicher.

    Read https://forum.qt.io/topic/119267/qmysql-qpsql-qpsql7-driver-not-found/2, do that. And read the final post in that thread from the OP, for his steps for getting PSQL right.



  • I still have no success.

    Adding the postgres DLL folder to the path did not change anything.
    I also searched further and found the following thread:
    https://forum.qt.io/topic/116300/installing-postgresql-on-qt-5-15-postgresql-12-windows-10/13

    There it is stated that I need the following DLLs (adapted to version 13):

    libcrypto-1_1-x64.dll: from OpenSSL install.
    libssl-1_1-x64.dll: from OpenSSL install.
    libpq.dll: from C:\Program Files\PostgreSQL\13\lib
    libintl-8.dll: from C:\Program Files\PostgreSQL\13\bin
    libiconv-2.dll: from C:\Program Files\PostgreSQL\13\bin
    

    I installed OpenSSL and copied all DLLs into the folder with the executable.

    Still, the driver is not loaded.

    I also tried to find out what is missing using a dependency walker.
    This gives me several windows related false positives, but does not tell me anything about postgres or Qt.

    @Christian-Ehrlicher
    I can understand you. However, if you need to answer this all the time, then the documentation of Qt might not be sufficient here.
    It only states the following: "When you distribute your application, remember to include libpq.dll in your installation package. It must be placed in the same folder as the application executable." Other dependencies are not mentioned at all and adding the postgres dll folder to the path is sadly not enough.

    @JonB
    Thanks!
    The post you mentioned is for MinGW and 32 bit.
    I tried to rebuild the driver with the sources and binaries.
    It compiled again without errors but also with the DLLs I mentioned further up being present, the driver is not loaded.

    Do you have any further suggestions?

    Thanks!



  • @robro said in Compiled and installed QPSQL plugin, but driver still not loaded? (Win 10):

    Do you have any further suggestions?

    Yes, the same one as earlier. I told you to read post https://forum.qt.io/topic/119267/qmysql-qpsql-qpsql7-driver-not-found/2 and act on that, i.e. QT_DEBUG_PLUGINS to find out where the loading got to when it fell over.



  • @JonB
    Thanks!
    I tried it ealier already, but overlooked the important part.
    For me the messages make no sense, as they are the same in debug and in release mode:

    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlodbcd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QPSQL7",
                "QPSQL"
            ]
        },
        "archreq": 0,
        "className": "QPSQLDriverPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    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
    

    Do they help you?



  • @robro
    Yes! You are only interested in the last message it outputs, showing where it fell over:

    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)"

    I can tell from the d on the end of qsqlpsqld.dll that is a debug compiled DLL. And elsewhere you must be using release compiled Qt libraries? And they don't mix. That's all I can tell you! I don't do this stuff, so I don't know why it seems to have rejected the qsqlpsql.dll it looked at first and moved onto qsqlpsqld.dll, maybe the problem lies there. I don't know whether if you temporarily renamed qsqlpsqld.dll so it cannot be found you would get a clearer idea why it rejected qsqlpsql.dll.

    You'll have to await an expert to explain why that is.



  • Well, I now removed all non-debug SQL driver files from the folder.

    Then in debug mode I get the following output, which still confuses debug and non-debug libs which are not SQL related.

    I got no clue what is going on.

    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qdirect2d.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qdirect2d.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "direct2d"
            ]
        },
        "archreq": 0,
        "className": "QWindowsDirect2DIntegrationPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qdirect2d.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qdirect2dd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qdirect2dd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "direct2d"
            ]
        },
        "archreq": 1,
        "className": "QWindowsDirect2DIntegrationPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("direct2d")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qminimal.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qminimal.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 0,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qminimal.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qminimald.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qminimald.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 1,
        "className": "QMinimalIntegrationPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qoffscreen.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qoffscreen.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 0,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qoffscreen.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qoffscreend.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qoffscreend.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 1,
        "className": "QOffscreenIntegrationPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwebgl.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwebgl.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "webgl"
            ]
        },
        "archreq": 0,
        "className": "QWebGLIntegrationPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwebgl.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwebgld.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwebgld.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "webgl"
            ]
        },
        "archreq": 1,
        "className": "QWebGLIntegrationPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("webgl")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwindows.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwindows.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "windows"
            ]
        },
        "archreq": 0,
        "className": "QWindowsIntegrationPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwindows.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwindowsd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwindowsd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "windows"
            ]
        },
        "archreq": 1,
        "className": "QWindowsIntegrationPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("windows")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/platforms" ...
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwindowsd.dll"
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/platformthemes" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platformthemes/qxdgdesktopportal.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platformthemes/qxdgdesktopportal.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "xdgdesktopportal",
                "flatpak",
                "snap"
            ]
        },
        "archreq": 0,
        "className": "QXdgDesktopPortalThemePlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/platformthemes/qxdgdesktopportal.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/platformthemes/qxdgdesktopportald.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/platformthemes/qxdgdesktopportald.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "xdgdesktopportal",
                "flatpak",
                "snap"
            ]
        },
        "archreq": 1,
        "className": "QXdgDesktopPortalThemePlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/platformthemes" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/styles" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/styles/qwindowsvistastyle.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/styles/qwindowsvistastyle.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QStyleFactoryInterface",
        "MetaData": {
            "Keys": [
                "windowsvista"
            ]
        },
        "archreq": 0,
        "className": "QWindowsVistaStylePlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/styles/qwindowsvistastyle.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/styles/qwindowsvistastyled.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/styles/qwindowsvistastyled.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QStyleFactoryInterface",
        "MetaData": {
            "Keys": [
                "windowsvista"
            ]
        },
        "archreq": 1,
        "className": "QWindowsVistaStylePlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("windowsvista")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/styles" ...
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/styles/qwindowsvistastyled.dll"
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/iconengines" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/iconengines/qsvgicon.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/iconengines/qsvgicon.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz",
                "svg.gz"
            ]
        },
        "archreq": 0,
        "className": "QSvgIconPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/iconengines/qsvgicon.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/iconengines/qsvgicond.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/iconengines/qsvgicond.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz",
                "svg.gz"
            ]
        },
        "archreq": 1,
        "className": "QSvgIconPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("svg", "svgz", "svg.gz")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/iconengines" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qgif.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qgif.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "gif"
            ],
            "MimeTypes": [
                "image/gif"
            ]
        },
        "archreq": 0,
        "className": "QGifPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qgif.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qgifd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qgifd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "gif"
            ],
            "MimeTypes": [
                "image/gif"
            ]
        },
        "archreq": 1,
        "className": "QGifPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("gif")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicns.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicns.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "icns"
            ],
            "MimeTypes": [
                "image/x-icns"
            ]
        },
        "archreq": 0,
        "className": "QICNSPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicns.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicnsd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicnsd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "icns"
            ],
            "MimeTypes": [
                "image/x-icns"
            ]
        },
        "archreq": 1,
        "className": "QICNSPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("icns")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qico.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qico.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "ico",
                "cur"
            ],
            "MimeTypes": [
                "image/vnd.microsoft.icon",
                "image/vnd.microsoft.icon"
            ]
        },
        "archreq": 0,
        "className": "QICOPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qico.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicod.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicod.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "ico",
                "cur"
            ],
            "MimeTypes": [
                "image/vnd.microsoft.icon",
                "image/vnd.microsoft.icon"
            ]
        },
        "archreq": 1,
        "className": "QICOPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("ico", "cur")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qjpeg.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qjpeg.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "jpg",
                "jpeg"
            ],
            "MimeTypes": [
                "image/jpeg",
                "image/jpeg"
            ]
        },
        "archreq": 0,
        "className": "QJpegPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qjpeg.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qjpegd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qjpegd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "jpg",
                "jpeg"
            ],
            "MimeTypes": [
                "image/jpeg",
                "image/jpeg"
            ]
        },
        "archreq": 1,
        "className": "QJpegPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("jpg", "jpeg")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qsvg.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qsvg.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz"
            ],
            "MimeTypes": [
                "image/svg+xml",
                "image/svg+xml-compressed"
            ]
        },
        "archreq": 0,
        "className": "QSvgPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qsvg.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qsvgd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qsvgd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz"
            ],
            "MimeTypes": [
                "image/svg+xml",
                "image/svg+xml-compressed"
            ]
        },
        "archreq": 1,
        "className": "QSvgPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("svg", "svgz")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtga.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtga.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tga"
            ],
            "MimeTypes": [
                "image/x-tga"
            ]
        },
        "archreq": 0,
        "className": "QTgaPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtga.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtgad.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtgad.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tga"
            ],
            "MimeTypes": [
                "image/x-tga"
            ]
        },
        "archreq": 1,
        "className": "QTgaPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("tga")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtiff.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtiff.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tiff",
                "tif"
            ],
            "MimeTypes": [
                "image/tiff",
                "image/tiff"
            ]
        },
        "archreq": 0,
        "className": "QTiffPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtiff.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtiffd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtiffd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tiff",
                "tif"
            ],
            "MimeTypes": [
                "image/tiff",
                "image/tiff"
            ]
        },
        "archreq": 1,
        "className": "QTiffPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("tiff", "tif")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwbmp.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwbmp.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "wbmp"
            ],
            "MimeTypes": [
                "image/vnd.wap.wbmp"
            ]
        },
        "archreq": 0,
        "className": "QWbmpPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwbmp.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwbmpd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwbmpd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "wbmp"
            ],
            "MimeTypes": [
                "image/vnd.wap.wbmp"
            ]
        },
        "archreq": 1,
        "className": "QWbmpPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("wbmp")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwebp.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwebp.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "webp"
            ],
            "MimeTypes": [
                "image/webp"
            ]
        },
        "archreq": 0,
        "className": "QWebpPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwebp.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwebpd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwebpd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "webp"
            ],
            "MimeTypes": [
                "image/webp"
            ]
        },
        "archreq": 1,
        "className": "QWebpPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("webp")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/imageformats" ...
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qgifd.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicnsd.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicod.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qjpegd.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qsvgd.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtgad.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtiffd.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwbmpd.dll"
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwebpd.dll"
    start
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlited.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlited.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QSQLITE"
            ]
        },
        "archreq": 1,
        "className": "QSQLiteDriverPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlodbcd.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlodbcd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QODBC3",
                "QODBC"
            ]
        },
        "archreq": 1,
        "className": "QODBCDriverPlugin",
        "debug": true,
        "version": 331264
    }
    
    
    Got keys from plugin meta data ("QODBC3", "QODBC")
    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
    }
    
    
    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/sqldrivers" ...
    loaded library "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll"
    "Driver not loaded Driver not loaded"
    end
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.14.2/msvc2017_64/plugins/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/accessiblebridge" ...
    QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
    end
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/styles/qwindowsvistastyled.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qgifd.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicnsd.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qicod.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qjpegd.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qsvgd.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtgad.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qtiffd.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwbmpd.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/imageformats/qwebpd.dll" 
    QLibraryPrivate::unload succeeded on "C:/Qt/5.14.2/msvc2017_64/plugins/platforms/qwindowsd.dll" 
    

    @JonB Thanks for the help! For me you are an expert ;-)



  • @robro said in Compiled and installed QPSQL plugin, but driver still not loaded? (Win 10):

    Well, I now removed all non-debug SQL driver files from the folder.

    Like I said, I'm no expert here! But normally I would expect plugins to be compiled for release, not debug, so I suggested the other way round: rename the debug ones, retain the release ones. Even if then you still have mismatches, that's where I would have started from....



  • @JonB
    Ok, that plugins are ususally compiled in release mode is a good hint.

    I checked it only with the release DLLs present and it is bascially the same:

    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlite.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlodbc.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QODBC3",
                "QODBC"
            ]
        },
        "archreq": 0,
        "className": "QODBCDriverPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlodbc.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll"
    Found metadata in lib C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QPSQL7",
                "QPSQL"
            ]
        },
        "archreq": 0,
        "className": "QPSQLDriverPlugin",
        "debug": false,
        "version": 331264
    }
    
    
    "The plugin 'C:/Qt/5.14.2/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/rolan/Documents/Seafile/Meine_Bibliothek/Programme/Executables/PostgresSqlTest/build-PostgresSqlTest-Desktop_Qt_5_14_2_MSVC2017_64bit-Debug/debug/sqldrivers" ...
    QSqlDatabase: QPSQL driver not loaded
    

  • Lifetime Qt Champion

    Hi,

    Do you have several versions of Qt installed ?
    Did you compile the plugins with a different version of Qt than the one you are trying to use it with ?



  • Hi,

    thanks.
    Yes, I have several versions of Qt installed (also with different compilers).

    However, I compiled the driver with the same version of Qt and the same compiler I tried to use it with.
    Just to make sure, I recompiled it looking carefully on the version and compiler and nothing changed.

    I now consider not using the Qt driver but the underlying libpq direct.
    This would work out of the box.


  • Lifetime Qt Champion

    Check with a tool like Dependency Walker to see what libraries your plugin is linked against because it really looks like there's a mismatch there.



  • Ok,
    @SGaist You gave the right hint!

    Using a dependency walker on one of the plugin DLLs showed me that I had a Anaconda installation in the Windows path variable. And this includes also a version of Qt. So yes, the plugin links against another verison of Qt.

    I remvoved the Anaconda distribution from the path and tried it again, copied the correct DLLs in folder I compiled in and also into the folder the plugin DLLs are. Now the DLLs link against no Qt DLLs and they are missing.

    What is the correct procedure to make the correct DLLs available / linked?

    I mean every version of Qt should link always against DLLs of the same version. How can this be done?

    Thanks!


  • Lifetime Qt Champion

    Then that's normal, since there's no path in your PATH environment variable that contains Qt dlls, they will be missing.

    Now that this part has been sorted, check the PATH environment variable in the Run part of the Project panel, it likely still contains that folder. Remove it there as well and see if things get better.



  • @SGaist
    I do not really understand how to manage different Qt versions in parallel properly.

    I compiled the sql plugin using the command line namend "Qt 5.14.2 (MSVC 2017 64-bit)".
    So I thought it would be automatically being comfigured to use Qt 5.14.2 DLLs for compilation.

    You were right, the Anaconda paths were still in the build settings of the project trying to use the sql plugin.
    Removing the Anaconda related paths did not change anything.

    I guess adding all my Qt versions to the windows path variable is not a good idea.
    Always modifying the path to the correct version of Qt I am using at the moment seems ineffective.
    How do I prevent that a program links a wrong version like it happend here or in other words, how can you manage multiple versions of Qt?

    As you see some Qt DLLs maybe come even from other software which adds entries to the path variable.

    I am a little bit confused.


  • Lifetime Qt Champion

    @robro said in Compiled and installed QPSQL plugin, but driver still not loaded? (Win 10):

    I guess adding all my Qt versions to the windows path variable is not a good idea.

    Yes, it is not a good idea.

    "how can you manage multiple versions of Qt?" - don't add anything Qt specific to PATH. When running from QtCreator your app will use the currently activated Kit. If you want to run your app outside from QtCreator then deploy it first: https://doc.qt.io/qt-5/windows-deployment.html



  • Thank you all!

    Removing everything Qt related from the path variable of Windows and recompiling worked!


Log in to reply