I have the problem that when I try to compile Qt statically, I get an error when I try to include the Postgresql drivers. If I don't include them, I have no problem. If I do it in linux including them, neither. It's only on Windows.
When I run configure it gives me the following error:
ERROR: Feature 'sql-psql' was enabled, but the pre-condition 'libs.psql' failed.
I have Postgresql installed, version 9.6.
If I look at the file config.log
, these are the lines related to psql:
test config.qtbase_sqldrivers.libraries.odbc succeeded loaded result for library config.qtbase_sqldrivers.libraries.psql Trying source 0 (type pkgConfig) of library psql ... pkg-config use disabled globally. => source produced no result. Trying source 1 (type psqlConfig) of library psql ... pg_config not found. => source produced no result. Trying source 2 (type psqlEnv) of library psql ... None of [liblibpq.dll.a liblibpq.a libpq.dll.a libpq.a libpq.lib] found in [] and global paths. => source produced no result. Trying source 3 (type psqlEnv) of library psql ... => source failed condition '!config.win32'. test config.qtbase_sqldrivers.libraries.psql FAILED
And this is the way I callconfigure.bat
configure.bat -static -debug-and-release -platform win32-g++ -prefix C:\Qt\Static\5.13.0\ -opensource -confirm-license -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -sql-psql -I "C:\Program Files\PostgreSQL\9.6\include" -L "C:\Program Files\PostgreSQL\9.6\lib\libpq.lib" -opensource -confirm-license -skip webengine -make libs -nomake tools -nomake examples -nomake tests
You are trying to compile Qt with MinGW but you may have installed a version of PostgreSQL precompiled with MSVC++. This is a suspicion because there is no proof for this in your question. With static libraries, this usually doesn't work. On the other hand, with DLLs there is greater compatibility between compilers. You should use the same compiler in both projects. So none of the 4 automatic detection methods of PgSQL have worked. You probably need to include the PgSQL bin directory in the PATH for the CMD session in which you run configure.bat