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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on 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

    KingWmK 1 Reply Last reply
    0
    • KingWmK Offline
      KingWmK Offline
      KingWm
      wrote on last edited by KingWm
      #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 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

        KingWmK 3 Replies Last reply
        1
        • SGaistS SGaist

          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.

          KingWmK Offline
          KingWmK Offline
          KingWm
          wrote on last edited by
          #7
          This post is deleted!
          1 Reply Last reply
          0
          • SGaistS SGaist

            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.

            KingWmK Offline
            KingWmK Offline
            KingWm
            wrote on 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 Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 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
              2
              • Christian EhrlicherC Christian Ehrlicher

                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 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
                • KingWmK KingWm has marked this topic as solved on
                • jsulmJ jsulm

                  @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.

                  KingWmK Offline
                  KingWmK Offline
                  KingWm
                  wrote on 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

                    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.

                    KingWmK Offline
                    KingWmK Offline
                    KingWm
                    wrote on 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

                      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.

                      KingWmK Offline
                      KingWmK Offline
                      KingWm
                      wrote on 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 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
                        0
                        • Y Yihua Liu

                          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 Offline
                          Christian EhrlicherC Offline
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on 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