Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake errors while building #73

Open
GaryBlackbourne opened this issue Nov 7, 2023 · 1 comment
Open

CMake errors while building #73

GaryBlackbourne opened this issue Nov 7, 2023 · 1 comment

Comments

@GaryBlackbourne
Copy link

GaryBlackbourne commented Nov 7, 2023

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.

@hasnimehdi91
Copy link

Faced the same on Rocky Linux 8 and AlmaLinux 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants