I was asked to create a C-Function to integrate with Postgres. The Postgres documentation to this kind of function is available here: Postgres documentation.
The function I am trying to compile is from the manual and it is called add_one, just for test. But I had a problem while compiling it. The command I followed of the documentation was:
cc -fPIC -c foo.c
cc -shared -o foo.so foo.o
And the problem it returned was:
[igoralberte@localhost inside-postgres]$ cc -fPIC -c serializacao.c
serializacao.c:1:10: fatal error: postgres.h: Arquivo ou diretório inexistente
#include "postgres.h"
^~~~~~~~~~~~
compilation terminated.
In English, it means: Non-existent file or directory (postgres.h).
I have tried to copy some files I thought were important to /usr/lib directory. They were on /usr/include/pgsql or on /lib64. Those files were:
- libpq.so
- libpq.so.5
- libpq.so.5.13
- libpq (directory)
- postgres_ext.h
Some important informations about my system:
- I am using CentOS 8
- System architecture: x86-64
- GCC version: gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1)
- Postgres version: 13.3
Thanks in advance!
/home/igoralberteand, if you know what you are doing,/etc,/usr/local.