You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently building version 22.6.1 on Fedora 38, and encountered an error. While running cmake :
CMake Error at CMakeLists.txt:116 (string):
string sub-command REGEX, mode MATCH needs at least 5 arguments total to
command.
CMake Error at CMakeLists.txt:118 (message):
Error matching PostgreSQL version.
I have spent some time debugging and found that there are two main problems.
Delusive error message with regex
In CMakeLists.txt:116 the variable PostgreSQL_VERSION_STRING is empty, which creates the first error, because there is nothing there. This can be bypassed by quoting the variable to "${PostgreSQL_VERSION_STRING}" which removes the first, unnecessary and delusive error message.
Not found version to an installed package
The second error is caused by the version query algorithm in cmake/FindPostgreSQL.cmake. To my current understanding, this script iterates through the include paths, and find all files named: pg_config*.h. Then iterates through these files and tries to find a specific C macro called #define PG_VERSION_NUM <some-version-info>. I have tweaked my way around this problem, by adding the next line to CMakeLists.txt before the find_package call:
set(PostgreSQL_INCLUDE_DIR "/usr/include")
Apparently CMake on this distribution fails to find the appropriate include directory, and after this modification the package seems to compile without further trouble .
I am not sure if there is any other, more elegant way of getting rid of these errors, as I am far from an expert in cmake, but this may worth a fix.
The text was updated successfully, but these errors were encountered:
I am currently building version 22.6.1 on Fedora 38, and encountered an error. While running cmake :
I have spent some time debugging and found that there are two main problems.
Delusive error message with regex
In CMakeLists.txt:116 the variable
PostgreSQL_VERSION_STRING
is empty, which creates the first error, because there is nothing there. This can be bypassed by quoting the variable to"${PostgreSQL_VERSION_STRING}"
which removes the first, unnecessary and delusive error message.Not found version to an installed package
The second error is caused by the version query algorithm in
cmake/FindPostgreSQL.cmake
. To my current understanding, this script iterates through the include paths, and find all files named:pg_config*.h
. Then iterates through these files and tries to find a specific C macro called#define PG_VERSION_NUM <some-version-info>
. I have tweaked my way around this problem, by adding the next line to CMakeLists.txt before thefind_package
call:Apparently CMake on this distribution fails to find the appropriate include directory, and after this modification the package seems to compile without further trouble .
I am not sure if there is any other, more elegant way of getting rid of these errors, as I am far from an expert in cmake, but this may worth a fix.
The text was updated successfully, but these errors were encountered: