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