Sqldrivers: Postgresql not found while it is installed and configured (win 8.1, Psql 9.6.6, Qt 5.10.0, MSVC2015_x64)



  • My setup:

    • Windows 8.1 Pro 64bit
    • Qt 5.10.0 (in C:\Qt)
    • QMake version 3.1 (Using Qt version 5.10.0 in C:/Qt/5.10.0 /msvc2015_64/lib)
    • PostgreSQL 9.6.6 64bit (in C:\Postgresql\9.6)
    • Microsoft Visual Studio Community 2015 (Version 14.0.25431.01 Update 3)

    I'm trying to build Postgresql driver fot QT but is not found. First i went to http://doc.qt.io/qt-5/sql-driver.html and executed:

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\psql>qmake "INCLUDEPATH+=C:/Postgresql/9.6/include" "LIBS+=C:/Postgresql/9.6/lib/libpq.lib" psql.pro
    

    but got error

    Cannot read C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: File not found.
    Project ERROR: Library 'psql' is not defined.
    

    that file C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri doesn't exists so I've searched the internet and found that I need to run qmake sqldrivers.pro so

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers>qmake sqldrivers.pro
    Running configuration tests...
    Checking for DB2 (IBM)... no
    Checking for InterBase... no
    Checking for MySQL... no
    Checking for OCI (Oracle)... no
    Checking for ODBC... yes
    Checking for PostgreSQL... no
    Checking for SQLite (version 2)... no
    Checking for TDS (Sybase)... no
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... yes
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    
    Qt is now configured for building. Just run 'nmake'.
    Once everything is built, Qt is installed.
    You should NOT run 'nmake install'.
    Note that this build cannot be deployed to other machines or devices.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    WTH? I have postgresql installed and I have pg_config in path

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers>pg_config
    BINDIR = C:/POSTGR~1/9.6/bin
    DOCDIR = C:/POSTGR~1/9.6/doc
    HTMLDIR = C:/POSTGR~1/9.6/doc
    INCLUDEDIR = C:/POSTGR~1/9.6/include
    PKGINCLUDEDIR = C:/POSTGR~1/9.6/include
    INCLUDEDIR-SERVER = C:/POSTGR~1/9.6/include/server
    LIBDIR = C:/POSTGR~1/9.6/lib
    PKGLIBDIR = C:/POSTGR~1/9.6/lib
    LOCALEDIR = C:/POSTGR~1/9.6/share/locale
    MANDIR = C:/Postgresql/9.6/man
    SHAREDIR = C:/POSTGR~1/9.6/share
    SYSCONFDIR = C:/Postgresql/9.6/etc
    PGXS = C:/Postgresql/9.6/lib/pgxs/src/makefiles/pgxs.mk
    CONFIGURE = --enable-thread-safety --enable-integer-datetimes --enable-nls --with-ldap --with-openssl --with-ossp-uuid --with-libxml --with-libxslt --with-tcl --with-perl --with-python
    CC = niezarejestrowane
    CPPFLAGS = niezarejestrowane
    CFLAGS = niezarejestrowane
    CFLAGS_SL = niezarejestrowane
    LDFLAGS = niezarejestrowane
    LDFLAGS_EX = niezarejestrowane
    LDFLAGS_SL = niezarejestrowane
    LIBS = niezarejestrowane
    VERSION = PostgreSQL 9.6.6
    
    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers>
    

    Now my questions is: Why Postgresql isn't detected ?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Is your PostgreSQL installation built with the same version as Qt ?

    You should also add the "INCLUDEPATH+=C:/Postgresql/9.6/include" "LIBS+=C:/Postgresql/9.6/lib/libpq.lib" parameters to your qmake call in the sqldrivers folder.



  • I've installed binary version of Postgresql 9.6.6 from enterprisedb.com (redirected from postgresql.org for Windows binary distributions) so I don't know with which compiler was used to build it. And Qt installer was download from Qt website. I did not compile Qt ot Postgresql.

    I'll try to compile Postgresql from souces....


  • Lifetime Qt Champion

    Before building something, you can use Dependency Walker for example to check the architecture. That also must match.


  • Moderators

    @dawidp said in Sqldrivers: Postgresql not found while it is installed and configured (win 8.1, Psql 9.6.6, Qt 5.10.0, MSVC2015_x64):

    And Qt installer was download from Qt website

    The Qt installer can install any officially provided Qt version, so you should know what Qt version you actually installed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.