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. Can't load sql drivers when configuring and building Qt 6.8.1 from source on linux/Ubuntu 24.04.1

Can't load sql drivers when configuring and building Qt 6.8.1 from source on linux/Ubuntu 24.04.1

Scheduled Pinned Locked Moved Solved Installation and Deployment
15 Posts 5 Posters 1.2k 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
    KingWm
    wrote on 11 Dec 2024, 22:37 last edited by KingWm 12 Nov 2024, 23:10
    #1

    The Problem

    In a fresh Ubuntu installation, I successfully built & installed PostgreSQL, Qt & Qt Creator from source. When I run my app and try to connect to the database, I get the following error:

    qt.sql.qsqldatabase: QSqlDatabase: QPSQL driver not loaded
    qt.sql.qsqldatabase: QSqlDatabase: available drivers: QSQLITE
    

    From my investigation, it appears that only the default sqlite driver is loading. Numerous attempts to use the -sql-driver configure option to build the other drivers have failed. I believe the issue is with the Qt build. The PostgreSQL & QT Creator information is included for context. I am new to this and need help. What am I missing? Surely it's something simple, right?

    The Environment

    • Building for: linux-g++ (x86_64, CPU features: )
    • Compiler: gcc 13.2.0
    • fresh Ubuntu 24.04.1 LTS installation
    • build & install PostgreSQL "T REL_17_2" from source
    • build & install Qt "T v6.8.1" from source
    • build & install Qt Creator "R origin/15.0" from source

    Source & Build Directories & PATH

    /usr/local/src/_postgresql (build)
    /usr/local/src/postgresql (src)
    /usr/local/src/_qt (build)
    /usr/local/src/qt (src)
    /usr/local/src/_qt_creator (build)
    /usr/local/src/qt_creator (src)
    
    echo $PATH
    /the usual defaults:
    /usr/local/postgresql/17.2/bin:
    /usr/local/postgresql/17.2/lib:
    /usr/local/ninja/1.12.1:
    /usr/local/qt/6.8.1/bin:
    /usr/local/qt/6.8.1/lib:
    /usr/local/qt_creator/o15.0/bin
    

    The Guides I Used

    • https://wiki.qt.io/Building_Qt_6_from_Git
    • https://doc.qt.io/qt-6/getting-sources-from-git.html
    • https://doc.qt.io/qt-6/linux-building.html
    • https://doc.qt.io/qt-6/sql-driver.html
    • https://wiki.qt.io/Building_Qt_Creator_from_Git
    • https://github.com/qt-creator/qt-creator/blob/master/README.md
    • https://wiki.qt.io/Building_Qt_Creator_from_Git_on_Ubuntu_22.04***

    *** I couldn't get everything to build until I installed the dependencies mentioned in this guide. I don't know which package(s) I needed, but it worked. I didn't use the commands, simply installed the dependencies.

    Steps to Re-Create

    clone qt from git into the source directory /src/qt/ (I can't remember the command I used but I cloned the entire tree and then checked out Tag 6.8.1)

    run configure from within the build directory /src/_qt/ WITHOUT -sql option

    ../qt/configure -init-submodules -prefix /usr/local/qt/6.8.1
    

    relevant portion of configure output without -sql-<driver> option

    -- Checking dependencies of submodule 'qtwebview'
    -- Configuring submodule 'qtbase'
    -- [QtBase] Setting build type to 'Release' as none was specified.
    -- Configuring submodule 'qtimageformats'
    

    and

    -- Configuring done (56.1s)
    -- Generating done (3.0s)
    -- Build files have been written to: /usr/local/src/_qt
    

    relevant portion of resulting config.summary

    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      Mimer .................................. no
    

    successfully clone, configure, build & install Qt Creator from source

    build & run myApp, attempt database connection using psql driver with the following error message:

    The Error Message

    The program output with QT_DEBUG_PLUGINS=1 runtime variable:

    qt.core.plugin.factoryloader: checking directory path "/usr/local/qt/6.8.1/plugins/sqldrivers" ...
    qt.core.plugin.factoryloader: looking at "libqsqlite.so"
    qt.core.plugin.loader: Found metadata in lib /usr/local/qt/6.8.1/plugins/sqldrivers/libqsqlite.so, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QSQLITE"
            ]
        },
        "archlevel": 1,
        "className": "QSQLiteDriverPlugin",
        "debug": false,
        "version": 395264
    }
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
    qt.core.plugin.factoryloader: checking directory path "/home/kingwm/src/kco_app7/build/Desktop-Debug/sqldrivers" ...
    qt.sql.qsqldatabase: QSqlDatabase: QPSQL driver not loaded
    qt.sql.qsqldatabase: QSqlDatabase: available drivers: QSQLITE
    Error opening database: QSqlError("", "Driver not loaded", "Driver not loaded")
    

    Upon Further Investigation

    The contents of the source directory (all drivers):

    root@****:/usr/local/src# ls /usr/local/src/qt/qtbase/src/plugins/sqldrivers
    CMakeLists.txt  configure.cmake  db2  ibase  mimer  mysql  oci  odbc  psql  qt_cmdline.cmake  README  sqlite
    

    The contents of the resultant installation directory (one driver.so):

    root@****:/usr/local/src/_qt# ls /usr/local/qt/6.8.1/plugins/sqldrivers
    libqsqlite.so
    

    It seems only the default sqlite driver is being loaded. At this point, I discovered the guide on sql drivers and tried to build the program with the -sql-driver option.

    from the build directory /src/_qt/, view the man page for configure:

    ../qt/configure --help
    

    partial output from --help

    + /usr/local/src/qt/qtbase/configure -top-level -help
    Usage:  configure [options] [-- cmake-options]
    
    This is a convenience script for configuring Qt with CMake.
    Options after the double dash are directly passed to CMake.
    You can pass CMake variables as configure arguments:
        configure VAR=value
    which is equivalent to
        configure -- -DVAR=value
    
    Conventions for the remaining options: When an option's description is
    followed by a list of values in brackets, the interpretation is as follows:
    'yes' represents the bare option; all other values are possible prefixes to
    the option, e.g., -no-gui. Alternatively, the value can be assigned, e.g.,
    --gui=yes. Values are listed in the order they are tried if not specified;
    'auto' is a shorthand for 'yes/no'. Solitary 'yes' and 'no' represent binary
    options without auto-detection.
    
    Database options:
    
      -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
                             db2 ibase mysql oci odbc psql sqlite mimer
                             [all auto]
      -sqlite .............. Select used sqlite [system/qt]
    

    I really want all drivers, or at least mysql, odbc & psql but can't figure out the [all auto] convention from the --help page. I tried all these combinations, got various error messages and tried to learn from them. (I know, silly me, I am new to this and have all the time in the world and no sleep requirements) -sql-psql -sql-auto -sql -sql-[psql mysql odbc] -all-sql -sql=all --sql=all -sql=all -sql-all -all-sql -all-sql-psql -sql-mysql -sql- -sql-psql=yes --sql-psql=yes --sql=yes.

    In the end, using "-sql-psql" and "-sql-psql -sql-mysql -sql-odbc" appear to be correct syntax, but they all produce the driver not loaded error.

    To keep it simple, I ran configure from within the build directory /src/_qt/ again, this time using the -sql-psql option, but WITHOUT first deleting the build directory and starting over with an empty directory.

    ../qt/configure -init-submodules -prefix /usr/local/qt/6.8.1 -sql-psql
    

    The configure script finishes with a new warning: (that that PostgreSQL is not found and there are only warnings issued)

    -- Checking dependencies of submodule 'qtwebview'
    -- Configuring submodule 'qtbase'
    -- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Release'
    [QtBase]     'sql_psql' was changed from OFF to ON
    CMake Warning at qtbase/cmake/QtFeature.cmake:896 (message):
      Due to detected feature set changes, dependent features will be re-computed
      automatically.  This might cause a lot of files to be rebuilt.  To disable
      this behavior, configure with -DQT_NO_FEATURE_AUTO_RESET=ON
    Call Stack (most recent call first):
      qtbase/cmake/QtBuildHelpers.cmake:472 (qt_internal_detect_dirty_features)
      qtbase/cmake/QtBuild.cmake:4 (qt_internal_setup_build_and_global_variables)
      qtbase/cmake/QtSetup.cmake:6 (include)
      qtbase/cmake/QtBuildRepoHelpers.cmake:21 (include)
      qtbase/cmake/QtBuildRepoHelpers.cmake:232 (qt_build_internals_set_up_private_api)
      qtbase/cmake/QtBaseHelpers.cmake:154 (qt_build_repo_begin)
      qtbase/CMakeLists.txt:32 (qt_internal_qtbase_build_repo)
    
    CMake Warning at qtbase/cmake/QtFeature.cmake:285 (message):
      Resetting 'FEATURE_sql_psql' from 'ON' to 'OFF' because it doesn't meet its
      condition after reconfiguration.  Condition expression is:
      'PostgreSQL_FOUND'
    Call Stack (most recent call first):
      qtbase/cmake/QtFeature.cmake:434 (qt_feature_check_and_save_user_provided_value)
      qtbase/cmake/QtFeature.cmake:711 (qt_evaluate_feature)
      qtbase/src/plugins/sqldrivers/CMakeLists.txt:44 (qt_feature_module_end)
    
    -- Configuring submodule 'qtimageformats'
    

    and the script finishes without any errors, only warnings

    -- Configuring done (43.7s)
    -- Generating done (2.9s)
    -- Build files have been written to: /usr/local/src/_qt
    

    relevant portion of resulting config.summary

    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      Mimer .................................. no
    

    You can see PostgreSQL isn't loaded. With the error, I didn't bother building and installing this configuration. Next, I deleted the build folder and started from scratch, again, this time using the -sql-psql option and with a clean build directory.

    ../qt/configure -init-submodules -prefix /usr/local/qt/6.8.1 -sql-psql
    

    The configure script behaved differently this time. The warning message changed and the script exited in error at the end.

    -- Checking dependencies of submodule 'qtwebview'
    -- Configuring submodule 'qtbase'
    -- [QtBase] Setting build type to 'Release' as none was specified.
    CMake Error at qtbase/cmake/QtBuildInformation.cmake:534 (message):
      Feature "sql_psql": Forcing to "ON" breaks its condition:
    
          PostgreSQL_FOUND
    
      Condition values dump:
    
          PostgreSQL_FOUND = "FALSE"
    
    Call Stack (most recent call first):
      qtbase/cmake/QtFeature.cmake:322 (qt_configure_add_report_error)
      qtbase/cmake/QtFeature.cmake:442 (qt_feature_check_and_save_internal_value)
      qtbase/cmake/QtFeature.cmake:711 (qt_evaluate_feature)
      qtbase/src/plugins/sqldrivers/CMakeLists.txt:44 (qt_feature_module_end)
    
    
    -- Configuring submodule 'qtimageformats'
    

    and finally

    ERROR: Feature "sql_psql": Forcing to "ON" breaks its condition:
        PostgreSQL_FOUND
    Condition values dump:
        PostgreSQL_FOUND = "FALSE"
    
    CMake Error at qtbase/cmake/QtBuildInformation.cmake:220 (message):
      Check the configuration messages for an error that has occurred.
    Call Stack (most recent call first):
      qtbase/cmake/QtBuildInformation.cmake:39 (qt_configure_print_summary)
      qtbase/cmake/QtBaseTopLevelHelpers.cmake:88 (qt_print_feature_summary)
      qtbase/cmake/QtBaseTopLevelHelpers.cmake:76 (qt_internal_print_top_level_info)
      CMakeLists.txt:120 (qt_internal_top_level_end)
    
    -- Configuring incomplete, errors occurred!
    CMake Error at /usr/local/src/qt/qtbase/cmake/QtProcessConfigureArgs.cmake:1139 (message):
      CMake exited with code 1.
    
    CMake Error at /usr/local/src/qt/cmake/QtIRProcessHelpers.cmake:173 (message):
      /usr/local/src/qt/qtbase/configure -top-level -prefix /usr/local/qt/6.8.1
      -sql-psql exited with status: 1
    
    Call Stack (most recent call first):
      /usr/local/src/qt/cmake/QtTopLevelHelpers.cmake:35 (qt_ir_execute_process_and_log_and_handle_error)
      /usr/local/src/qt/cmake/QtTopLevelHelpers.cmake:57 (qt_tl_run_toplevel_configure)
      /usr/local/src/qt/cmake/QtTopLevelConfigureScript.cmake:17 (qt_tl_run_main_script)
    

    Here is the relevant part of config.summary. Note that PostgreSQL is now yes, in spite of the errors.

    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. yes
      SQLite ................................. yes
        Using system provided SQLite ......... no
      Mimer .................................. no
    

    That is as far as I have been able to get. What am I missing?

    jsulmJ 1 Reply Last reply 12 Dec 2024, 06:22
    0
    • K KingWm
      11 Dec 2024, 22:37

      The Problem

      In a fresh Ubuntu installation, I successfully built & installed PostgreSQL, Qt & Qt Creator from source. When I run my app and try to connect to the database, I get the following error:

      qt.sql.qsqldatabase: QSqlDatabase: QPSQL driver not loaded
      qt.sql.qsqldatabase: QSqlDatabase: available drivers: QSQLITE
      

      From my investigation, it appears that only the default sqlite driver is loading. Numerous attempts to use the -sql-driver configure option to build the other drivers have failed. I believe the issue is with the Qt build. The PostgreSQL & QT Creator information is included for context. I am new to this and need help. What am I missing? Surely it's something simple, right?

      The Environment

      • Building for: linux-g++ (x86_64, CPU features: )
      • Compiler: gcc 13.2.0
      • fresh Ubuntu 24.04.1 LTS installation
      • build & install PostgreSQL "T REL_17_2" from source
      • build & install Qt "T v6.8.1" from source
      • build & install Qt Creator "R origin/15.0" from source

      Source & Build Directories & PATH

      /usr/local/src/_postgresql (build)
      /usr/local/src/postgresql (src)
      /usr/local/src/_qt (build)
      /usr/local/src/qt (src)
      /usr/local/src/_qt_creator (build)
      /usr/local/src/qt_creator (src)
      
      echo $PATH
      /the usual defaults:
      /usr/local/postgresql/17.2/bin:
      /usr/local/postgresql/17.2/lib:
      /usr/local/ninja/1.12.1:
      /usr/local/qt/6.8.1/bin:
      /usr/local/qt/6.8.1/lib:
      /usr/local/qt_creator/o15.0/bin
      

      The Guides I Used

      • https://wiki.qt.io/Building_Qt_6_from_Git
      • https://doc.qt.io/qt-6/getting-sources-from-git.html
      • https://doc.qt.io/qt-6/linux-building.html
      • https://doc.qt.io/qt-6/sql-driver.html
      • https://wiki.qt.io/Building_Qt_Creator_from_Git
      • https://github.com/qt-creator/qt-creator/blob/master/README.md
      • https://wiki.qt.io/Building_Qt_Creator_from_Git_on_Ubuntu_22.04***

      *** I couldn't get everything to build until I installed the dependencies mentioned in this guide. I don't know which package(s) I needed, but it worked. I didn't use the commands, simply installed the dependencies.

      Steps to Re-Create

      clone qt from git into the source directory /src/qt/ (I can't remember the command I used but I cloned the entire tree and then checked out Tag 6.8.1)

      run configure from within the build directory /src/_qt/ WITHOUT -sql option

      ../qt/configure -init-submodules -prefix /usr/local/qt/6.8.1
      

      relevant portion of configure output without -sql-<driver> option

      -- Checking dependencies of submodule 'qtwebview'
      -- Configuring submodule 'qtbase'
      -- [QtBase] Setting build type to 'Release' as none was specified.
      -- Configuring submodule 'qtimageformats'
      

      and

      -- Configuring done (56.1s)
      -- Generating done (3.0s)
      -- Build files have been written to: /usr/local/src/_qt
      

      relevant portion of resulting config.summary

      Qt Sql Drivers:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... no
        PostgreSQL ............................. no
        SQLite ................................. yes
          Using system provided SQLite ......... no
        Mimer .................................. no
      

      successfully clone, configure, build & install Qt Creator from source

      build & run myApp, attempt database connection using psql driver with the following error message:

      The Error Message

      The program output with QT_DEBUG_PLUGINS=1 runtime variable:

      qt.core.plugin.factoryloader: checking directory path "/usr/local/qt/6.8.1/plugins/sqldrivers" ...
      qt.core.plugin.factoryloader: looking at "libqsqlite.so"
      qt.core.plugin.loader: Found metadata in lib /usr/local/qt/6.8.1/plugins/sqldrivers/libqsqlite.so, metadata=
      {
          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
          "MetaData": {
              "Keys": [
                  "QSQLITE"
              ]
          },
          "archlevel": 1,
          "className": "QSQLiteDriverPlugin",
          "debug": false,
          "version": 395264
      }
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
      qt.core.plugin.factoryloader: checking directory path "/home/kingwm/src/kco_app7/build/Desktop-Debug/sqldrivers" ...
      qt.sql.qsqldatabase: QSqlDatabase: QPSQL driver not loaded
      qt.sql.qsqldatabase: QSqlDatabase: available drivers: QSQLITE
      Error opening database: QSqlError("", "Driver not loaded", "Driver not loaded")
      

      Upon Further Investigation

      The contents of the source directory (all drivers):

      root@****:/usr/local/src# ls /usr/local/src/qt/qtbase/src/plugins/sqldrivers
      CMakeLists.txt  configure.cmake  db2  ibase  mimer  mysql  oci  odbc  psql  qt_cmdline.cmake  README  sqlite
      

      The contents of the resultant installation directory (one driver.so):

      root@****:/usr/local/src/_qt# ls /usr/local/qt/6.8.1/plugins/sqldrivers
      libqsqlite.so
      

      It seems only the default sqlite driver is being loaded. At this point, I discovered the guide on sql drivers and tried to build the program with the -sql-driver option.

      from the build directory /src/_qt/, view the man page for configure:

      ../qt/configure --help
      

      partial output from --help

      + /usr/local/src/qt/qtbase/configure -top-level -help
      Usage:  configure [options] [-- cmake-options]
      
      This is a convenience script for configuring Qt with CMake.
      Options after the double dash are directly passed to CMake.
      You can pass CMake variables as configure arguments:
          configure VAR=value
      which is equivalent to
          configure -- -DVAR=value
      
      Conventions for the remaining options: When an option's description is
      followed by a list of values in brackets, the interpretation is as follows:
      'yes' represents the bare option; all other values are possible prefixes to
      the option, e.g., -no-gui. Alternatively, the value can be assigned, e.g.,
      --gui=yes. Values are listed in the order they are tried if not specified;
      'auto' is a shorthand for 'yes/no'. Solitary 'yes' and 'no' represent binary
      options without auto-detection.
      
      Database options:
      
        -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
                               db2 ibase mysql oci odbc psql sqlite mimer
                               [all auto]
        -sqlite .............. Select used sqlite [system/qt]
      

      I really want all drivers, or at least mysql, odbc & psql but can't figure out the [all auto] convention from the --help page. I tried all these combinations, got various error messages and tried to learn from them. (I know, silly me, I am new to this and have all the time in the world and no sleep requirements) -sql-psql -sql-auto -sql -sql-[psql mysql odbc] -all-sql -sql=all --sql=all -sql=all -sql-all -all-sql -all-sql-psql -sql-mysql -sql- -sql-psql=yes --sql-psql=yes --sql=yes.

      In the end, using "-sql-psql" and "-sql-psql -sql-mysql -sql-odbc" appear to be correct syntax, but they all produce the driver not loaded error.

      To keep it simple, I ran configure from within the build directory /src/_qt/ again, this time using the -sql-psql option, but WITHOUT first deleting the build directory and starting over with an empty directory.

      ../qt/configure -init-submodules -prefix /usr/local/qt/6.8.1 -sql-psql
      

      The configure script finishes with a new warning: (that that PostgreSQL is not found and there are only warnings issued)

      -- Checking dependencies of submodule 'qtwebview'
      -- Configuring submodule 'qtbase'
      -- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Release'
      [QtBase]     'sql_psql' was changed from OFF to ON
      CMake Warning at qtbase/cmake/QtFeature.cmake:896 (message):
        Due to detected feature set changes, dependent features will be re-computed
        automatically.  This might cause a lot of files to be rebuilt.  To disable
        this behavior, configure with -DQT_NO_FEATURE_AUTO_RESET=ON
      Call Stack (most recent call first):
        qtbase/cmake/QtBuildHelpers.cmake:472 (qt_internal_detect_dirty_features)
        qtbase/cmake/QtBuild.cmake:4 (qt_internal_setup_build_and_global_variables)
        qtbase/cmake/QtSetup.cmake:6 (include)
        qtbase/cmake/QtBuildRepoHelpers.cmake:21 (include)
        qtbase/cmake/QtBuildRepoHelpers.cmake:232 (qt_build_internals_set_up_private_api)
        qtbase/cmake/QtBaseHelpers.cmake:154 (qt_build_repo_begin)
        qtbase/CMakeLists.txt:32 (qt_internal_qtbase_build_repo)
      
      CMake Warning at qtbase/cmake/QtFeature.cmake:285 (message):
        Resetting 'FEATURE_sql_psql' from 'ON' to 'OFF' because it doesn't meet its
        condition after reconfiguration.  Condition expression is:
        'PostgreSQL_FOUND'
      Call Stack (most recent call first):
        qtbase/cmake/QtFeature.cmake:434 (qt_feature_check_and_save_user_provided_value)
        qtbase/cmake/QtFeature.cmake:711 (qt_evaluate_feature)
        qtbase/src/plugins/sqldrivers/CMakeLists.txt:44 (qt_feature_module_end)
      
      -- Configuring submodule 'qtimageformats'
      

      and the script finishes without any errors, only warnings

      -- Configuring done (43.7s)
      -- Generating done (2.9s)
      -- Build files have been written to: /usr/local/src/_qt
      

      relevant portion of resulting config.summary

      Qt Sql Drivers:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... no
        PostgreSQL ............................. no
        SQLite ................................. yes
          Using system provided SQLite ......... no
        Mimer .................................. no
      

      You can see PostgreSQL isn't loaded. With the error, I didn't bother building and installing this configuration. Next, I deleted the build folder and started from scratch, again, this time using the -sql-psql option and with a clean build directory.

      ../qt/configure -init-submodules -prefix /usr/local/qt/6.8.1 -sql-psql
      

      The configure script behaved differently this time. The warning message changed and the script exited in error at the end.

      -- Checking dependencies of submodule 'qtwebview'
      -- Configuring submodule 'qtbase'
      -- [QtBase] Setting build type to 'Release' as none was specified.
      CMake Error at qtbase/cmake/QtBuildInformation.cmake:534 (message):
        Feature "sql_psql": Forcing to "ON" breaks its condition:
      
            PostgreSQL_FOUND
      
        Condition values dump:
      
            PostgreSQL_FOUND = "FALSE"
      
      Call Stack (most recent call first):
        qtbase/cmake/QtFeature.cmake:322 (qt_configure_add_report_error)
        qtbase/cmake/QtFeature.cmake:442 (qt_feature_check_and_save_internal_value)
        qtbase/cmake/QtFeature.cmake:711 (qt_evaluate_feature)
        qtbase/src/plugins/sqldrivers/CMakeLists.txt:44 (qt_feature_module_end)
      
      
      -- Configuring submodule 'qtimageformats'
      

      and finally

      ERROR: Feature "sql_psql": Forcing to "ON" breaks its condition:
          PostgreSQL_FOUND
      Condition values dump:
          PostgreSQL_FOUND = "FALSE"
      
      CMake Error at qtbase/cmake/QtBuildInformation.cmake:220 (message):
        Check the configuration messages for an error that has occurred.
      Call Stack (most recent call first):
        qtbase/cmake/QtBuildInformation.cmake:39 (qt_configure_print_summary)
        qtbase/cmake/QtBaseTopLevelHelpers.cmake:88 (qt_print_feature_summary)
        qtbase/cmake/QtBaseTopLevelHelpers.cmake:76 (qt_internal_print_top_level_info)
        CMakeLists.txt:120 (qt_internal_top_level_end)
      
      -- Configuring incomplete, errors occurred!
      CMake Error at /usr/local/src/qt/qtbase/cmake/QtProcessConfigureArgs.cmake:1139 (message):
        CMake exited with code 1.
      
      CMake Error at /usr/local/src/qt/cmake/QtIRProcessHelpers.cmake:173 (message):
        /usr/local/src/qt/qtbase/configure -top-level -prefix /usr/local/qt/6.8.1
        -sql-psql exited with status: 1
      
      Call Stack (most recent call first):
        /usr/local/src/qt/cmake/QtTopLevelHelpers.cmake:35 (qt_ir_execute_process_and_log_and_handle_error)
        /usr/local/src/qt/cmake/QtTopLevelHelpers.cmake:57 (qt_tl_run_toplevel_configure)
        /usr/local/src/qt/cmake/QtTopLevelConfigureScript.cmake:17 (qt_tl_run_main_script)
      

      Here is the relevant part of config.summary. Note that PostgreSQL is now yes, in spite of the errors.

      Qt Sql Drivers:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... no
        PostgreSQL ............................. yes
        SQLite ................................. yes
          Using system provided SQLite ......... no
        Mimer .................................. no
      

      That is as far as I have been able to get. What am I missing?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 12 Dec 2024, 06:22 last edited by
      #2

      @KingWm If you want to build a SQL driver you have to install needed dependencies. For PostgreSQL you have to install libpq5 library and libpq-dev packages.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 2 Replies Last reply 12 Dec 2024, 17:22
      0
      • jsulmJ jsulm
        12 Dec 2024, 06:22

        @KingWm If you want to build a SQL driver you have to install needed dependencies. For PostgreSQL you have to install libpq5 library and libpq-dev packages.

        K Offline
        K Offline
        KingWm
        wrote on 12 Dec 2024, 17:22 last edited by
        #3

        @jsulm I don't understand. I installed PostgreSQL from source. Might installing those packages interfere with my PG installation? Also, someone else mentioned that, so I checked and according to Google, I should reconfigure my PG building to include all the developer stuff. I wanted to build PostgreSQL, pgAmin, Qt & Qt Creator from source. If I can build the dev libs from source, I would rather do that.

        This note here from the docs?
        https://doc.qt.io/qt-6/sql-driver.html
        Note: To build a driver plugin you need to have the appropriate client library for your Database Management System (DBMS). This provides access to the API exposed by the DBMS, and is typically shipped with it. Most installation programs also allow you to install "development libraries", and these are what you need. These libraries are responsible for the low-level communication with the DBMS. Also make sure to install the correct database libraries for your Qt architecture (32 or 64 bit).

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 12 Dec 2024, 17:25 last edited by
          #4

          Why did you compile postgresql by yourself? Simply use the ones from your distro...
          Where did you install postgresql to? If it's a non-default location you have to pass this to configure in a clean build dir.

          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 28 Dec 2024, 05:18
          0
          • K Offline
            K Offline
            KingWm
            wrote on 12 Dec 2024, 18:12 last edited by KingWm 12 Dec 2024, 18:12
            #5

            For practice. I installed PG from source, and all the others, because I wanted to learn how. Plus, I get a little more control over the specific version I use. I am setting up for a long term project and these are skills I need to learn.

            PostgreSQL is installed here, and I do have it on the $PATH, but I guess the compiler is not checking the path?

            /usr/local/postgresql/17.2/bin:
            /usr/local/postgresql/17.2/lib:

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 12 Dec 2024, 18:58 last edited by
              #6

              Hi,

              PATH has nothing to do with library discovery. You're working on Linux, not Windows.
              Use the -L argument to add additional paths to configure.

              On a side note, stop working as root. There's no need for that for any build activity.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              K 3 Replies Last reply 12 Dec 2024, 20:47
              1
              • SGaistS SGaist
                12 Dec 2024, 18:58

                Hi,

                PATH has nothing to do with library discovery. You're working on Linux, not Windows.
                Use the -L argument to add additional paths to configure.

                On a side note, stop working as root. There's no need for that for any build activity.

                K Offline
                K Offline
                KingWm
                wrote on 12 Dec 2024, 20:47 last edited by
                #7
                This post is deleted!
                1 Reply Last reply
                0
                • SGaistS SGaist
                  12 Dec 2024, 18:58

                  Hi,

                  PATH has nothing to do with library discovery. You're working on Linux, not Windows.
                  Use the -L argument to add additional paths to configure.

                  On a side note, stop working as root. There's no need for that for any build activity.

                  K Offline
                  K Offline
                  KingWm
                  wrote on 13 Dec 2024, 01:47 last edited by KingWm
                  #8

                  @SGaist I set the path variable because it is mentioned several times in the various docs I have read. I don't know if it is useful in this scenario or not.

                  I used -L arguments to pass the include and lib directories.

                  /usr/local/postgresql/17.2/include
                  /usr/local/postgresql/17.2/lib
                  

                  In a new error message, it complained it couldn't find Ninja, so I added my Ninja path.

                  /usr/local/ninja/1.12.1
                  

                  I am using sudo because nothing will work unless I use it. I presume it is because the source, build and install directories are all in /usr/local/.

                  I ran the following command, it fails with the same Postgres not found error.

                  ../qt/configure -init-submodules -prefix /usr/local/qt/6.8.1 -sql-psql -L /usr/local/postgresql/17.2/lib -I /usr/local/postgresql/17.2/include -- -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR=Ninja /usr/local/ninja/1.12.1
                  

                  But when I run it WITHOUT the -sql-psql option, configure completes successfully with a few warnings. One is that it ignored the the path i provided for Ninja. Again, Ninja is on the path, but if it ignores that path I provide, I don't know how it is finding Ninja unless a sub-routine is providing it.

                  + /usr/local/src/qt/qtbase/configure -top-level -prefix /usr/local/qt/6.8.1 -L /usr/local/postgresql/17.2/lib -I /usr/local/postgresql/17.2/include -- -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR=Ninja /usr/local/ninja/1.12.1
                  '/usr/bin/cmake' '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_GENERATOR=Ninja' '/usr/local/ninja/1.12.1' '-DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE' '-DCMAKE_INSTALL_PREFIX=/usr/local/qt/6.8.1' '-DQT_EXTRA_INCLUDEPATHS=/usr/local/postgresql/17.2/include' '-DQT_EXTRA_LIBDIRS=/usr/local/postgresql/17.2/lib' '-G' 'Ninja' '/usr/local/src/qt'
                  CMake Warning:
                    Ignoring extra path from command line:
                  
                     "/usr/local/ninja/1.12.1"
                  
                  -- The CXX compiler identification is GNU 13.3.0
                  -- The C compiler identification is GNU 13.3.0
                  
                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 13 Dec 2024, 05:20 last edited by
                    #9

                    Pass PostgreSQL_ROOT as written in the documentation: https://doc.qt.io/qt-6/sql-driver.html#how-to-build-the-qpsql-plugin-on-unix-and-macos

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

                    SGaistS 1 Reply Last reply 13 Dec 2024, 05:52
                    2
                    • Christian EhrlicherC Christian Ehrlicher
                      13 Dec 2024, 05:20

                      Pass PostgreSQL_ROOT as written in the documentation: https://doc.qt.io/qt-6/sql-driver.html#how-to-build-the-qpsql-plugin-on-unix-and-macos

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 13 Dec 2024, 05:52 last edited by
                      #10

                      @Christian-Ehrlicher said in Can't load sql drivers when configuring and building Qt 6.8.1 from source on linux/Ubuntu 24.04.1:

                      Pass PostgreSQL_ROOT as written in the documentation: https://doc.qt.io/qt-6/sql-driver.html#how-to-build-the-qpsql-plugin-on-unix-and-macos

                      My bad for the -L pointer ! Old Qt 5 habits.

                      @Christian-Ehrlicher is correct.

                      As for the sudo requirements, it's still wrong. The fact that you have stuff in /usr/local should have no influence unless there's a in issue with the files permissions that should be fixed.

                      As for PATH, it's only used to find executables on Linux, it has nothing to do with libraries.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2
                      • K KingWm has marked this topic as solved on 28 Dec 2024, 04:59
                      • jsulmJ jsulm
                        12 Dec 2024, 06:22

                        @KingWm If you want to build a SQL driver you have to install needed dependencies. For PostgreSQL you have to install libpq5 library and libpq-dev packages.

                        K Offline
                        K Offline
                        KingWm
                        wrote on 28 Dec 2024, 05:06 last edited by KingWm
                        #11

                        @jsulm I added libpq5 and libpq-dev packages with dependencies and my configuration completed successfully. Unfortunately, after waiting patiently for the build to complete, the install failed on the "last line", something about a missing a file. It caused me to reconsider my efforts. I am pretty sure this solved the original problem I posted about, sorry I didn't save the output.

                        I did check the docs and I didn'ts see those dependencies mentioned anywhere. I feel like the official docs should have those dependencies listed. Thank you.

                        1 Reply Last reply
                        0
                        • Christian EhrlicherC Christian Ehrlicher
                          12 Dec 2024, 17:25

                          Why did you compile postgresql by yourself? Simply use the ones from your distro...
                          Where did you install postgresql to? If it's a non-default location you have to pass this to configure in a clean build dir.

                          K Offline
                          K Offline
                          KingWm
                          wrote on 28 Dec 2024, 05:18 last edited by
                          #12

                          @Christian-Ehrlicher I was building it for the wrong reasons, I discovered. At the end of the day, I successfully built 3 packages and believe I would have eventually gotten PG done as well. I learned what I set out to learn and so I abandoned this project.

                          As it turned out, I had mis-configured my disks and my small OS drive filled up quickly. I had to start over with a fresh install and the decision to do things conventionally was easy. Thank you.

                          1 Reply Last reply
                          0
                          • SGaistS SGaist
                            12 Dec 2024, 18:58

                            Hi,

                            PATH has nothing to do with library discovery. You're working on Linux, not Windows.
                            Use the -L argument to add additional paths to configure.

                            On a side note, stop working as root. There's no need for that for any build activity.

                            K Offline
                            K Offline
                            KingWm
                            wrote on 28 Dec 2024, 05:28 last edited by
                            #13

                            @SGaist said in Can't load sql drivers when configuring and building Qt 6.8.1 from source on linux/Ubuntu 24.04.1:

                            On a side note, stop working as root. There's no need for that for any build activity.

                            I have noticed a pattern and clearly I need to change a bad habit. Thank you.

                            1 Reply Last reply
                            0
                            • Y Offline
                              Y Offline
                              Yihua Liu
                              wrote on 25 Feb 2025, 01:26 last edited by
                              #14

                              Then what is the case for oracle qoci? I run

                              ./configure -prefix /opt/qt-static -static -release -opensource -confirm-license -nomake examples -nomake tests -sql-oci -DOracle_ROOT=/home/yihua/app/yihua/product/21.0.0/client_1

                              but it still shows Resetting 'FEATURE_sql_oci' from 'ON' to 'OFF' because it doesn't meet its condition after reconfiguration. Condition expression is: 'Oracle_FOUND'. I confirmed that libclntsh.so exists under the client_1 directory

                              Christian EhrlicherC 1 Reply Last reply 25 Feb 2025, 05:14
                              0
                              • Y Yihua Liu
                                25 Feb 2025, 01:26

                                Then what is the case for oracle qoci? I run

                                ./configure -prefix /opt/qt-static -static -release -opensource -confirm-license -nomake examples -nomake tests -sql-oci -DOracle_ROOT=/home/yihua/app/yihua/product/21.0.0/client_1

                                but it still shows Resetting 'FEATURE_sql_oci' from 'ON' to 'OFF' because it doesn't meet its condition after reconfiguration. Condition expression is: 'Oracle_FOUND'. I confirmed that libclntsh.so exists under the client_1 directory

                                Christian EhrlicherC Online
                                Christian EhrlicherC Online
                                Christian Ehrlicher
                                Lifetime Qt Champion
                                wrote on 25 Feb 2025, 05:14 last edited by Christian Ehrlicher
                                #15

                                @Yihua-Liu said in Can't load sql drivers when configuring and building Qt 6.8.1 from source on linux/Ubuntu 24.04.1:

                                Then what is the case for oracle qoci? I run

                                Why do you want to recompile the complete Qt? Please follow the documentation on how to build a single sql driver: https://doc.qt.io/qt-6/sql-driver.html

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

                                1 Reply Last reply
                                1

                                • Login

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