Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Installation of Postgres Driver fails (Qt 6.2.4 on Windows 10 Pro, x64)

Installation of Postgres Driver fails (Qt 6.2.4 on Windows 10 Pro, x64)

Scheduled Pinned Locked Moved Solved Installation and Deployment
5 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kerehclam
    wrote on last edited by
    #1

    To install the Postgres (Version 14) driver I followed the documentation in [https://doc.qt.io/qt-6.2/sql-driver.html](link url).

    The first step

    C:\Qt\6.2.4\mingw_64\bin\qt-cmake -G Ninja C:\Qt\6.2.4\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX="C:\Qt\6.2.4\mingw_64" -DCMAKE_INCLUDE_PATH="D:\Programme\Postgre\include" -DCMAKE_LIBRARY_PATH="D:\Programme\Postgre\lib"
    

    works without problems.

    Result:

    Configure summary:
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... yes
      PostgreSQL ............................. yes
      SQLite ................................. yes
        Using system provided SQLite ......... no
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /cygdrive/c/Qt/6.2.4/Src/qtbase/src/plugins/build-sqldrivers
    

    Then I call

    cmake --build .
    

    with the result:

    [1/16] Automatic MOC for target QPSQLDriverPlugin
    FAILED: psql/QPSQLDriverPlugin_autogen/timestamp
    cd /cygdrive/c/Qt/6.2.4/Src/qtbase/src/plugins/build-sqldrivers/psql && /usr/bin/cmake.exe -E cmake_autogen /cygdrive/c/Qt/6.2.4/Src/qtbase/src/plugins/build-sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin_autogen.dir/AutogenInfo.json RelWithDebInfo && /usr/bin/cmake.exe -E touch /cygdrive/c/Qt/6.2.4/Src/qtbase/src/plugins/build-sqldrivers/psql/QPSQLDriverPlugin_autogen/timestamp
    
    AutoMoc subprocess error
    ------------------------
    The content generation command for "BIN:/psql/QPSQLDriverPlugin_autogen/moc_predefs.h" failed.
    
    Command
    -------
    /cygdrive/c/Qt/Tools/mingw1120_64/bin/c++.exe -dM -E -c /usr/share/cmake-3.17.3/Modules/CMakeCXXCompilerABI.cpp -DMINGW_HAS_SECURE_API=1 -DQPSQLDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -DUNICODE -DWIN32 -DWIN64 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -IC:/Qt/6.2.4/Src/qtbase/src/plugins/sqldrivers/psql -I/cygdrive/c/Qt/6.2.4/Src/qtbase/src/plugins/build-sqldrivers/psql -I/cygdrive/c/Qt/6.2.4/Src/qtbase/src/plugins/build-sqldrivers/include -ID:/Programme/Postgre/include -I/usr/include/postgresql/server -IC:/Qt/6.2.4/mingw_64/include/QtCore -IC:/Qt/6.2.4/mingw_64/include -IC:/Qt/6.2.4/mingw_64/mkspecs/win32-g++ -IC:/Qt/6.2.4/mingw_64/include/QtCore/6.2.4 -IC:/Qt/6.2.4/mingw_64/include/QtCore/6.2.4/QtCore -IC:/Qt/6.2.4/mingw_64/include/QtSql/6.2.4 -IC:/Qt/6.2.4/mingw_64/include/QtSql/6.2.4/QtSql -IC:/Qt/6.2.4/mingw_64/include/QtSql
    
    Output
    ------
    

    I already spent quite some time on this, googled a lot but still can't get it running.
    Thanks for any help.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Remove your cygwin installation from the PATH.
      Also the psql driver is shipped by default - why do you want to recompile it?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      K 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        Remove your cygwin installation from the PATH.
        Also the psql driver is shipped by default - why do you want to recompile it?

        K Offline
        K Offline
        kerehclam
        wrote on last edited by
        #3

        @Christian-Ehrlicher
        Does that mean that I do not have to build the plugin as stated in the 6.2.4 documentation?
        Why is the driver then not loaded into a program (I tried it with the SQL Web Browser example)?

        Thanks a lot for answering dumb questions...

        Btw.: removing cygwin from the PATH did not prevent the error.

        Christian EhrlicherC 1 Reply Last reply
        0
        • K kerehclam

          @Christian-Ehrlicher
          Does that mean that I do not have to build the plugin as stated in the 6.2.4 documentation?
          Why is the driver then not loaded into a program (I tried it with the SQL Web Browser example)?

          Thanks a lot for answering dumb questions...

          Btw.: removing cygwin from the PATH did not prevent the error.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @kerehclam said in Installation of Postgres Driver fails (Qt 6.2.4 on Windows 10 Pro, x64):

          Btw.: removing cygwin from the PATH did not prevent the error.

          It does - you have to start over with a clean dir.

          Take a look if the postgresql plugin is available in <QTDIR>/plugins/sqldrivers.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          K 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @kerehclam said in Installation of Postgres Driver fails (Qt 6.2.4 on Windows 10 Pro, x64):

            Btw.: removing cygwin from the PATH did not prevent the error.

            It does - you have to start over with a clean dir.

            Take a look if the postgresql plugin is available in <QTDIR>/plugins/sqldrivers.

            K Offline
            K Offline
            kerehclam
            wrote on last edited by
            #5

            @Christian-Ehrlicher
            qsqlpsql.dll is present in folder C:\Qt\6.2.4\mingw_64\plugins\sqldrivers.
            So I guess what I did was unnessecary. Thanks for showing me patiently...

            After some additional searches I found why the driver was not loaded at runtime (reason was missing PATH entries for Postgre files in the runtime configuration of the project in QtCreator). Now everything works. Thanks a lot...

            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved