QSqlDatabase: QPSQL driver not loaded once again!
-
I'm unable to check whether my app able to find libq.dll or not because Dependency walker doesn't show it in list of dependencies see the screenshot please.
Any way I copied it as shown up here (even I copied all expected dependencies) but unfortunately I get this annoying error message.
IMPORTANT: I get this error message even in case I run the app from Qt Creator too!!!
-
@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:- distribute the DLL beside the qpsql.dll plugin
- distribute the DLL beside your application exe
- 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.
-
@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!
-
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.
-
@raven-worx
May you please read the check of QT_DEBUG_PLUGINS
https://gist.github.com/mbnoimi/154b31a77a079c45bbdd63d4c1cfe3bc -
@mbnoimi
the problem is this lineQLibraryPrivate::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
-
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 -
@mbnoimi
so something is wrong with your psql binaries.Maybe a mismatch between x86 and x64?
-
Maybe a mismatch between x86 and x64?
To be of mismatching between x86 and x64 I did:
- Uninstalled postgres-9.3.4-4-windows-x64
- installed postgres-9.3.13-windows
- 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)
-
Hi,
Did you check that you have a MinGW build of PostgreSQL ?
-
@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?
-
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
-
@SGaist
that makes sense of course.
One would expect that the Postgresql devs would export the symbols using "C-style" to avoid such problems?! -
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/