I am trying to install Apache AGE by following the instructions provided in the documentation. However, I was only able to install it from the source code. When I attempted to install Postgres 12 from a package manager and downloaded the latest official release of AGE (version 1.1.0), I found the following error:
src/backend/age.c:20:10: fatal error: postgres.h: No such file or directory
20 | #include "postgres.h"
| ^~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: src/backend/age.o] Error 1
I am using Ubuntu 20.04.5 LTS and have followed all the steps in the documentation, including setting the PG_CONFIG
variable. Could someone please advise me on whether I am doing something incorrectly?
2
Answers
If you are using postgresql 12, then please make sure that you are using the release of AGE for PG12. https://github.com/apache/age/releases/tag/PG12/v1.1.1-rc1
Also make sure you are giving the correct path to bin/pg_config command to PG_CONFIG.
It can be because your path to postgres.h is not right. It’s mostly inside the server folder inside postgresql folder. You can just run the command
pg_config
to check your server and postgresql path (Also run the commandsudo apt install postgresql-server-dev-XX
whereXX
is your postgresql version to install postgresql-server-dev package) and can check where postgres.h is (which I found inside server folder) and then correct the path if not.In my case the original path was
while in pg_config
INCLUDEDIR-SERVER
was pointing out toso I moved the server folder and it worked. You can check out this post for more info: How to fix 'postgres.h' file not found problem?