0

I have installed through Mainteinance Tool Qt 5.12.5 and the sources. I have the next directories:

C:\Qt\5.12.5\Src 
C:\Qt\Tools\mingw730_32\
C:\Qt\Tools\mingw730_64\

On the other hand, I have read that downloable Postgres version is compiled with MSVC, and I must to compile my own version. I have do it following link, and now I have a postgresql version in c:\pgsql

Finally I have added c:\pgsql to user Path

Next step, I have opened PowerShell in Admin mode and I´ve gone to C:\Qt\5.12.5\Src\.

Next, set the env path for this PowerShell session: $env:Path += ";C:\Qt\Tools\mingw730_64\bin\;C:\Qt\5.12.5\Src;C:\pgsql\include\;C:\pgsql\lib\;C:\pgsql\bin\" (setting the pgsql path again....)

After that, I execute configure.bat like that:

configure -v -static -release -static-runtime -platform win32-g++ -prefix C:\Qt\5.12.5\Estatico\ -opensource -confirm-license -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -opensource -confirm-license -skip webengine -make libs -nomake tools -nomake examples -nomake tests -sql-psql

But I have get this error:

ERROR: Feature 'sql-psql' was enabled, but the pre-condition 'libs.psql' failed.

Searching in config.log I can read those lines:

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

What can I do or what is the properly way to do that? Thank you in advance.

UPDATE

There are similar question here but it hasn´t been solved, and those question ask about Visual Studio.

I want to compile it under mingw.

The solution suggested by @Soheil Armin doesn´t work too The solution suggested by @Soheil Armin works fine, but I need to delete the entire source tree and reinstall it as he suggested. If not, a new configure won't work. Also, the ^ character can be saved:

configure <your parameters> 
PSQL_LIBS="C:\pgsql\lib\libpq.a" 
-I "C:\pgsql\include" 
-L "C:\pgsql\lib"
user3733164
  • 531
  • 4
  • 17
  • Possible duplicate of [How to compile Qt 5.8 statically with PostgreSQL plugin in VS2015](https://stackoverflow.com/questions/42897652/how-to-compile-qt-5-8-statically-with-postgresql-plugin-in-vs2015) – Soheil Armin Oct 27 '19 at 08:57

1 Answers1

1

You need to explicitly define library paths of Postgres.

configure <your parameters> ^
PSQL_LIBS="C:\pgsql\lib\libpq.a" ^
-I "C:\pgsql\include" ^
-L "C:\pgsql\lib"
Soheil Armin
  • 2,725
  • 1
  • 6
  • 18
  • Thank you, but It doesn´t work for me. But I can see I haven´t libpq.lib, only libpq.a and libpq.dll. I´ll update the question – user3733164 Oct 27 '19 at 09:29
  • 1
    Ok. just use **libpq.a** as you are using mingw. Don't forget to clean configuration before retry: git submodule foreach --recursive "git clean -dfx" – Soheil Armin Oct 27 '19 at 09:39
  • Thank you again. It doesn´t work too. I haven´ t dowlnloaded source from Git...do I need any cleanup of configure even? If yes, how could I do it? – user3733164 Oct 27 '19 at 10:33
  • 1
    You can make/nmake distclean but sometime it does not work. It's better to remove the whole directory and extract it again from the archive. – Soheil Armin Oct 27 '19 at 10:36
  • Solved. The worst is that I have had to reinstall the sources each time I was wrong. It took me a long time. If not, a new configure didnt't work. The distclean doesn' t work too. Also, is not necesary write "^" symbol in the string of options. Thank you! – user3733164 Oct 27 '19 at 17:28