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