Error matching PostgreSQL version in build of gvmd

Following the guide for 22.4 on Rocky 9 (essentually Centos9…).

All good until I am building gvmd, I get this error. I eventried installing a new CMAKE from source (latest version), no difference. Any ideas?

-- Configuring Greenbone Vulnerability Manager...
-- The C compiler identification is GNU 11.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Install prefix: /opt/gvm
-- Looking for PostgreSQL...
CMake Error at src/CMakeLists.txt:48 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.


CMake Error at src/CMakeLists.txt:50 (message):
  Error matching PostgreSQL version.


-- Looking for xml_split...
-- Looking for xml_split... /usr/bin/xml_split
-- Looking for xsltproc...
-- Looking for xsltproc... /usr/bin/xsltproc
-- Looking for gpgme...
-- Looking for gpgme... /usr/lib64/libgpgme.so
-- Not using libtheia - licensing functions disabled
-- Looking for xmltoman...
-- Looking for xmltoman... /usr/bin/xmltoman
-- Looking for xmlmantohtml... /usr/bin/xmlmantohtml
-- Looking for xsltproc...
-- Looking for xsltproc... /usr/bin/xsltproc
-- Configuring incomplete, errors occurred!
See also "/opt/gvm/build/gvmd/CMakeFiles/CMakeOutput.log".

Postgresql server and other rpms are installed (version 13). I had no issues installing everything to this point and all the dependencies.

Alas, it is SOMETHING different between Centos Stream 9 and Rocky 9. No clue what. No errors on either up until MAKEing gvmd.

A bit disappointed the project chose to use Stream 9, as that’s literally a moving target and unfit for production. Oh well.

The error originates from this line https://github.com/greenbone/gvmd/blob/stable/src/CMakeLists.txt#L48 Even from the docs of the latest cmake release the line seems to be fine (https://cmake.org/cmake/help/latest/command/string.html?highlight=regex%20match). So I don’t have a clue what’s wrong here.

Maybe try cmake 3.18.4 the version in Debian Bullseye (https://packages.debian.org/bullseye/cmake) which is proven to be working?

2 Likes

Well, this works on Centos stream 9 (I ran into other issues later on); and With Rocky 9 it’s the SAME version of cmake (3.20), so I don’t think that’s it. But I’ll give 3.18 a whirl anyway. I also checked postgres versions, those are the same too.

The listed error above is with 99% accuracy an issue with the cmake version provided in that distro.

I believe you, but have been unable to confirm. On Rocky 9, I also tried using a new cmake built from sctatch (3.25), and also tried an OLDER cmake (3.18). Exact same result both times. (so, not using the “distro” cmake in those 2 attempts). Odd!

My current working theory is on the Rocky host, it is unable somehow to determine the postgresql version, that string is empty during the version check which causes the “argument number mismatch”. It’s not cmake, it’s how it checks for the postgres version. I am sadly not a C programmer so I can’t figure out why this check fails on Rocky bu works on Centos Stream 9. Makes no sense. I even tried removing the distro postgres and put a comunity version in there instead, the check still fails.

It’s missing something but I am stumped.

Found the following in ERROR: string sub-command REGEX, mode MATCH needs at least 5 arguments total to command. (#18737) · Issues · CMake / CMake · GitLab :

Try to escape you arguments with "" string(REGEX MATCH "set\\(ZLIB_HOME (.+)\\)" _mm "${_line}"). It is most likely ${_line} evaluating to empty string resulting in missing arg. Also, I recommend to trace such bugs with --trace-expand flag passed to CMake call.

By looking at gvmd/src/CMakeLists.txt at stable · greenbone/gvmd · GitHub it could be required to replace:

${PostgreSQL_VERSION_STRING}

by:

"${PostgreSQL_VERSION_STRING}"

to get a more meaningful message.

Well my theory is right, under Rocky 9 the cmake script is having difficulty determining the Postgres version. But I’m not a C programmer so I don’t know exactly what’s happening. I edited cmakelists.txt and quoted the postgres bit. That helped sort of.

Centos Stream 9:

-- Checking for module 'libical>=1.00'
--   Found libical, version 3.0.14
-- Looking for PostgreSQL...
-- Found PostgreSQL: /usr/lib64/libpq.so (found version "13.7")
-- Looking for xml_split...
-- Looking for xml_split... /usr/bin/xml_split

Rocky 9:

-- Checking for module 'libical>=1.00'
--   Found libical, version 3.0.14
-- Looking for PostgreSQL...
-- Found PostgreSQL: /usr/lib64/libpq.so
CMake Error at src/CMakeLists.txt:50 (message):
  Error matching PostgreSQL version.

Note the lacking “Found version NN.n” at the end of the line?

I’m open to ideas!

I am pretty sure now that it’s some weird issue with …gvmd-22.4.2/cmake/FindPostgreSQL.cmake

But I have been comparing the postgres installs on both Centos Stream 9 and Rocky 9 and everything seems absolutely identical. Libraries in certain places, include files in other certain places, but everything between the two OS’s matches up.

works on Stream 9, fails on Rocky 9.

I’m stumped.

Also not really familiar with CMake or how it works to determine the installed version on different platforms, but some posting previously included some notes about:

I recommend to trace such bugs with --trace-expand flag passed to CMake call.

man cmake has a description to this flag:

       --trace-expand
              Put cmake in trace mode.

              Like --trace, but with variables expanded.

and a few another ones which might be useful to understand why CMake isn’t able to gather the version:

       --debug-output
              Put cmake in a debug mode.

              Print extra information during the cmake run like stack traces with message(SEND_ERROR) calls.

       --debug-find
              Put cmake find commands in a debug mode.

              Print extra find call information during the cmake run to standard error. Output is designed for human consumption and not for parsing.  See also the CMAKE_FIND_DEBUG_MODE variable for debug‐
              ging a more local part of the project.

       --debug-find-pkg=<pkg>[,...]
              Put cmake find commands in a debug mode when running under calls to find_package(<pkg>), where <pkg> is an entry in the given comma-separated list of case-sensitive package names.

              Like --debug-find, but limiting scope to the specified packages.

Adding these flags to cmake could be done (AFAICT) when replacing this:

cmake $SOURCE_DIR/gvmd-$GVMD_VERSION \
  -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
*snip*

by something like e.g.

cmake $SOURCE_DIR/gvmd-$GVMD_VERSION \
  -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
  --trace-expand \
*snip*

Hope this helps to understand / determine the difference between both systems.

Yeah I did the trace expand, output below. I cannot see what the issue is.

/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(317):  string(APPEND DETAILS [/usr/include/postgresql] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(313):  if(NOT PostgreSQL_TYPE_INCLUDE_DIR )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(316):  else()
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(317):  string(APPEND DETAILS [/usr/include/pgsql/server] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(320):  if(FPHSA_FOUND_PostgreSQL )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(321):  set(PostgreSQL_FOUND TRUE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(322):  set(POSTGRESQL_FOUND TRUE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(329):  unset(FOUND_COMPONENTS_MSG )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(330):  unset(MISSING_COMPONENTS_MSG )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(332):  if(FPHSA_HANDLE_COMPONENTS )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(360):  set(VERSION_MSG  )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(361):  set(VERSION_OK TRUE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(364):  if(DEFINED PostgreSQL_FIND_VERSION )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(423):  else()
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(425):  if(DEFINED PostgreSQL_VERSION_STRING )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(430):  if(VERSION_OK )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(431):  string(APPEND DETAILS [v()] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(438):  if(PostgreSQL_FOUND )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(439):  FIND_PACKAGE_MESSAGE(PostgreSQL Found PostgreSQL: /usr/lib64/libpq.so   [/usr/lib64/libpq.so][/usr/include/postgresql][/usr/include/pgsql/server][v()] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(35):  if(NOT PostgreSQL_FIND_QUIETLY )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(36):  string(REPLACE
  details [/usr/lib64/libpq.so][/usr/include/postgresql][/usr/include/pgsql/server][v()] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(37):  set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_PostgreSQL )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(38):  if(NOT [/usr/lib64/libpq.so][/usr/include/postgresql][/usr/include/pgsql/server][v()] STREQUAL  )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(40):  message(STATUS Found PostgreSQL: /usr/lib64/libpq.so   )
-- Found PostgreSQL: /usr/lib64/libpq.so
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(44):  set(FIND_PACKAGE_MESSAGE_DETAILS_PostgreSQL [/usr/lib64/libpq.so][/usr/include/postgresql][/usr/include/pgsql/server][v()] CACHE INTERNAL Details about finding PostgreSQL )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(464):  set(PostgreSQL_FOUND TRUE PARENT_SCOPE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(465):  set(POSTGRESQL_FOUND TRUE PARENT_SCOPE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(250):  set(PostgreSQL_FOUND TRUE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(252):  function(__postgresql_import_library _target _var _config )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(271):  if(PostgreSQL_FOUND )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(272):  if(NOT TARGET PostgreSQL::PostgreSQL )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(273):  add_library(PostgreSQL::PostgreSQL UNKNOWN IMPORTED )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(274):  set_target_properties(PostgreSQL::PostgreSQL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES /usr/include/postgresql;/usr/include/pgsql/server )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(276):  __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY  )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(253):  if(_config )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(255):  else()
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(256):  set(_config_suffix  )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(259):  set(_lib /usr/lib64/libpq.so )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(260):  if(EXISTS /usr/lib64/libpq.so )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(261):  if(_config )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(265):  set_target_properties(PostgreSQL::PostgreSQL PROPERTIES IMPORTED_LOCATION /usr/lib64/libpq.so )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(277):  __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY RELEASE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(253):  if(_config )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(254):  set(_config_suffix _RELEASE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(259):  set(_lib /usr/lib64/libpq.so )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(260):  if(EXISTS /usr/lib64/libpq.so )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(261):  if(_config )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(262):  set_property(TARGET PostgreSQL::PostgreSQL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(265):  set_target_properties(PostgreSQL::PostgreSQL PROPERTIES IMPORTED_LOCATION_RELEASE /usr/lib64/libpq.so )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(278):  __postgresql_import_library(PostgreSQL::PostgreSQL PostgreSQL_LIBRARY DEBUG )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(253):  if(_config )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(254):  set(_config_suffix _DEBUG )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(259):  set(_lib PostgreSQL_LIBRARY_DEBUG-NOTFOUND )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(260):  if(EXISTS PostgreSQL_LIBRARY_DEBUG-NOTFOUND )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(280):  set(PostgreSQL_INCLUDE_DIRS /usr/include/postgresql /usr/include/pgsql/server )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(281):  set(PostgreSQL_LIBRARY_DIRS /usr/lib64 )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(284):  mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR )
/home/gvm/source/gvmd-22.4.2/src/CMakeLists.txt(45):  if(NOT PostgreSQL_FOUND )
/home/gvm/source/gvmd-22.4.2/src/CMakeLists.txt(48):  string(REGEX MATCH ^[     ]*([0-9]+)\.([0-9]+)(.*) TEMP  )
/home/gvm/source/gvmd-22.4.2/src/CMakeLists.txt(49):  if(NOT CMAKE_MATCH_1 )
/home/gvm/source/gvmd-22.4.2/src/CMakeLists.txt(50):  message(SEND_ERROR Error matching PostgreSQL version. )
CMake Error at src/CMakeLists.txt:50 (message):
  Error matching PostgreSQL version.


Found the differences. My theory confirmed, on Rocky 9 it’s just… not figuring out the postgres version. No clue why.

Rocky 9:

/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(320):  if(FPHSA_FOUND_PostgreSQL )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(321):  set(PostgreSQL_FOUND TRUE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(322):  set(POSTGRESQL_FOUND TRUE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(329):  unset(FOUND_COMPONENTS_MSG )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(330):  unset(MISSING_COMPONENTS_MSG )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(332):  if(FPHSA_HANDLE_COMPONENTS )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(360):  set(VERSION_MSG  )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(361):  set(VERSION_OK TRUE )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(364):  if(DEFINED PostgreSQL_FIND_VERSION )
/home/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(423):  else()
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(425):  if(DEFINED PostgreSQL_VERSION_STRING )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(430):  if(VERSION_OK )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(431):  string(APPEND DETAILS [v()] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(438):  if(PostgreSQL_FOUND )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(439):  FIND_PACKAGE_MESSAGE(PostgreSQL Found PostgreSQL: /usr/lib64/libpq.so   [/usr/lib64/libpq.so][/usr/include/postgresql][/usr/include/pgsql/server][v()] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(35):  if(NOT PostgreSQL_FIND_QUIETLY )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(36):  string(REPLACE
  details [/usr/lib64/libpq.so][/usr/include/postgresql][/usr/include/pgsql/server][v()] )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(37):  set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_PostgreSQL )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(38):  if(NOT [/usr/lib64/libpq.so][/usr/include/postgresql][/usr/include/pgsql/server][v()] STREQUAL  )
/home/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(40):  message(STATUS Found PostgreSQL: /usr/lib64/libpq.so   )
-- Found PostgreSQL: /usr/lib64/libpq.so


CentOS Stream 9:

/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(320):  if(FPHSA_FOUND_PostgreSQL )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(321):  set(PostgreSQL_FOUND TRUE )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(322):  set(POSTGRESQL_FOUND TRUE )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(329):  unset(FOUND_COMPONENTS_MSG )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(330):  unset(MISSING_COMPONENTS_MSG )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(332):  if(FPHSA_HANDLE_COMPONENTS )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(360):  set(VERSION_MSG  )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(361):  set(VERSION_OK TRUE )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(364):  if(DEFINED PostgreSQL_FIND_VERSION )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPostgreSQL.cmake(423):  else()
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(425):  if(DEFINED PostgreSQL_VERSION_STRING )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(426):  set(VERSION_MSG (found version "13.7") )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(430):  if(VERSION_OK )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(431):  string(APPEND DETAILS [v13.7()] )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(438):  if(PostgreSQL_FOUND )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageHandleStandardArgs.cmake(439):  FIND_PACKAGE_MESSAGE(PostgreSQL Found PostgreSQL: /usr/lib64/libpq.so (found version "13.7")  [/usr/lib64/libpq.so][/usr/include][/usr/include/pgsql/server][v13.7()] )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(35):  if(NOT PostgreSQL_FIND_QUIETLY )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(36):  string(REPLACE
  details [/usr/lib64/libpq.so][/usr/include][/usr/include/pgsql/server][v13.7()] )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(37):  set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_PostgreSQL )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(38):  if(NOT [/usr/lib64/libpq.so][/usr/include][/usr/include/pgsql/server][v13.7()] STREQUAL  )
/opt/gvm/source/gvmd-22.4.2/cmake/FindPackageMessage.cmake(40):  message(STATUS Found PostgreSQL: /usr/lib64/libpq.so (found version "13.7")  )
-- Found PostgreSQL: /usr/lib64/libpq.so (found version "13.7")

So in a desperate hail mary, I completely started over with a new Rocky9 host from scratch. Lo and behold, issue has vanished. gvmd built properly, postgres version found.

So clearly, along the way to the gvmd step, I must have missed… SOMETHING. God knows what, no idea what but clearly must have SOMEHOW been pilot error. Weird. Moving on.

1 Like

If, like me, you’re too lazy to re-install your OS you can also force the PostgreSQL_FOUND/PostgreSQL_VERSION_STRING variable value in src/CMakeLists.txt like this :

set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_SERVER_INCLUDE_DIRS})
#Force PostgreSQL_FOUND
set(PostgreSQL_FOUND “1”)
#Force PostgreSQL_VERSION_STRING=13.7
#set(PostgreSQL_VERSION_STRING “${_PostgreSQL_major_version}.${_PostgreSQL_minor_version}”)
set(PostgreSQL_VERSION_STRING “13.7”)

1 Like

You’re a saint. This worked for me too.

There is a reason for that, so please don´t complain if you run into database / performance issues :wink:

my solution was to add to cmake
-DPostgreSQL_INCLUDE_DIR=/usr/include
for rocky 9.3

/usr/local/bin/cmake $SOURCE_DIR/gvmd-$GVMD_VERSION   -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX   -DCMAKE_BUILD_TYPE=Release   -DLOCALSTATEDIR=/var   -DSYSCONFDIR=/etc   -DGVM_DATA_DIR=/var   -DGVMD_RUN_DIR=/run/gvmd   -DOPENVAS_DEFAULT_SOCKET=/run/ospd/ospd-openvas.sock   -DGVM_FEED_LOCK_PATH=/var/lib/gvm/feed-update.lock   -DSYSTEMD_SERVICE_DIR=/lib/systemd/system   -DLOGROTATE_DIR=/etc/logrotate.d  -DPostgreSQL_INCLUDE_DIR="/usr/include"
``

this worked for me on Alma linux as well