You are not logged in.
After installing libpqxx I got the following output from CMake:
CMake Error at CMakeLists.txt:31 (find_package):
By not providing "Findlibpqxx.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "libpqxx", but
CMake did not find one.Could not find a package configuration file provided by "libpqxx" with any
of the following names:libpqxxConfig.cmake
libpqxx-config.cmakeAdd the installation prefix of "libpqxx" to CMAKE_PREFIX_PATH or set
"libpqxx_DIR" to a directory containing one of the above files. If
"libpqxx" provides a separate development package or SDK, be sure it has
been installed.
Can be reproduces with simple CMakeLists.txt:
cmake_minimum_required(VERSION 3.26)
project(untitled)
set(CMAKE_CXX_STANDARD 20)
find_package(libpqxx REQUIRED)
add_executable(untitled main.cpp)My guess is that libpqxx-package is missing libpqxx-config.cmake when installed.
Last edited by nkbolg (2023-10-15 09:39:40)
Offline
Arch builds libpqxx with autotools rather than cmake so that may explain why no .cmake files are provided by the package. Arch does provide /usr/lib/pkgconfig/libpqxx.pc, is using pkg_check_modules instead of find_package an option for your use case?
Offline
Not really, I have a third-party module, that uses libpqxx as a dependency, and it's not convenient to patch it.
Can packaging libpqxx as an AUR package solve my problem?
Offline
Can packaging libpqxx as an AUR package solve my problem?
You would at the minimum have to to rename the package. For your personal use you could change the current PKGBUILD. The following switches the PKGBUILD to cmake and updates the pkgrel by .1.
diff --git a/PKGBUILD b/PKGBUILD
index 89b6bfd..1992693 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,30 +3,31 @@
pkgname=libpqxx
pkgver=7.8.1
-pkgrel=1
+pkgrel=1.1
pkgdesc='C++ client API for PostgreSQL'
url='http://pqxx.org/development/libpqxx/'
arch=('x86_64')
license=('custom')
depends=('postgresql-libs>=9.1')
-makedepends=('python')
+makedepends=('python' 'xmlto' 'doxygen' 'graphviz' 'cmake')
provides=('libpqxx.so')
source=(https://github.com/jtv/libpqxx/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('0f4c0762de45a415c9fd7357ce508666fa88b9a4a463f5fb76c235bc80dd6a84')
b2sums=('ca2a9abd138113967dea6aedbb20687c0126f081f4adb2b8c0e03a3bf04b4f528206314b1d44b5d2243228eef41d0380ff67d66747161bf43efa6da8aab50017')
build() {
- cd ${pkgname}-${pkgver}
- ./configure \
- --prefix=/usr \
- --enable-shared \
- --disable-doc
- make
+ cmake -B build -S "${pkgname}-${pkgver}" \
+ -DCMAKE_BUILD_TYPE='None' \
+ -DCMAKE_INSTALL_PREFIX='/usr' \
+ -DBUILD_SHARED_LIBS='ON' \
+ -DBUILD_DOC='ON' \
+ -Wno-dev
+ cmake --build build
}
package() {
+ DESTDIR="$pkgdir" cmake --install build
cd ${pkgname}-${pkgver}
- make prefix="${pkgdir}/usr" install
install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}Offline
I have a third-party module, that uses libpqxx as a dependency, and it's not convenient to patch it
Have you checked if that module requires cmake files to detect/use libpqxx ?
Last edited by Lone_Wolf (2023-10-16 08:36:11)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Yes, it is written in the error log that I provided. Also, when building manually using cmake these files are generated and everything works fine.
Offline
Does rebuilding the libpqxx package with the patch I provided resolve the issue for you?
Offline
Seems I have to clarify myself.
My assumptions :
You are trying to build project A using cmake .
Project A uses module B from an unknown source and needs libpqxx for that module to work.
archlinux libpqxx does not provide .cmake files and project A fails to find it because of that.
The error message posted suggests cmake-while-building-project-A only cares about finding libpqxx , not where/how it is found .
When you tell cmake-while-building-project-A to use pkgconfig files instead of cmake files, is building project A with Module B support successfull and do things work as intended ?
If my assumptions are correct there is no need to rebuild libpqxx with cmake.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
When you tell cmake-while-building-project-A to use pkgconfig files instead of cmake files, is building project A with Module B support successfull and do things work as intended ?
Is that possible without patching the project?
Offline
When you tell cmake-while-building-project-A to use pkgconfig files instead of cmake files, is building project A with Module B support successful and do things work as intended ?
I'm pretty sure that I'll need to patch cmake files of the library to make it use pkgconfig. If you'll suggest a way to do it without changing the source code of the library - that would be really helpful.
Does rebuilding the libpqxx package with the patch I provided resolve the issue for you?
Yes, many thanks, It definitely helped me to move from the previous point. Now all required files are found and find_package works as it should.
Just wanted to mention, that when running the makepkg -s I had this line:
WARNING: Cannot find library listed in 'provides': libpqxx.so
But libpqxx.so was in the libpqxx-7.8.1-1.1-x86_64.pkg.tar.zst archive and it was installed successfully. So, no clue, why was makepkg complaining.
Offline
But libpqxx.so was in the libpqxx-7.8.1-1.1-x86_64.pkg.tar.zst archive and it was installed successfully. So, no clue, why was makepkg complaining.
https://gitlab.archlinux.org/pacman/pac … sh.in#L538 does not find any matches, substituting the variables it would look something like
mapfile -t filename < <(find pkg/libpqxx -type f -name libpqxx.so\* | LC_ALL=C sort)Which produces an empty filename variable as I believe it is looking for libpqxx.so.$soversion.
Offline
Is that possible without patching the project?
maybe.
If you'll suggest a way to do it without changing the source code of the library - that would be really helpful.
There are cases where cmake can use pkgconfig files but doesn't because it doesn't look for pkgconf in the right place.
On Archlinux this occurs more often then on .deb / .rpm distros.
The lib32-llvm package is one of those cases.
It must set export PKG_CONFIG="i686-pc-linux-gnu-pkg-config" to ensure cmake finds the correct files.
I also encountered the similar case where older cmake* needed export PKG_CONFIG_PATH="/usr/bin/pkgconf" .
Whether either of them works depends entirely on how upstream wrote their cmake configuration files.
It seems worth a try.
* happened with programs using their own provided cmake version, not a systemwide cmake.
Last edited by Lone_Wolf (2023-10-17 11:16:57)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline