tds-fdw / tds_fdw

A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Other
377 stars 101 forks source link

src/tds_fdw.c fatal error: postgres.h: No such file or directory #303

Closed cobolbaby closed 2 years ago

cobolbaby commented 2 years ago

Issue report

The following information is very important in order to help us to help you. Omission of the following details cause delays or could receive no attention at all.

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I./include/ -fvisibility=hidden  -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/tds_fdw.o src/tds_fdw.c
src/tds_fdw.c:32:10: fatal error: postgres.h: No such file or directory
   32 | #include "postgres.h"
      |          ^~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: src/tds_fdw.o] Error 1

Operating system

On recent GNU/Linux distributions, you can provide the content of the file /etc/os-release

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Version of tds_fdw

From a psql session, paste the outputs of running \dx

If you built the package from Git sources, also paste the output of running git log --source -n 1 on your git clone from a console

2.0.2

Version of PostgreSQL

From a psql session, paste the output of running SELECT version();

postgres@pg1201:~$ psql -c "select version();"
                                                           version                                                           
-----------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 12.9 (Debian 12.9-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 row)
cobolbaby commented 2 years ago

Before installing the tds_fdw extension, I installed other extensions and then performed an apt purge -y libssl-dev operation. Unexpectedly, the missing library caused the problem.

docker run --rm -ti --name pgtest --user root postgres:12.9 bash

$ apt-get update -y  && apt-get install -y postgresql-server-dev-12 make gcc
$ ...
$ apt purge -y libssl-dev
$ ...
$ find / -type f -name "pg_config"
# /usr/bin/pg_config
# /usr/lib/postgresql/12/bin/pg_config
$ apt install unzip curl
$ curl -sSL -o /tmp/tds_fdw-2.0.2.tar.gz https://github.com/tds-fdw/tds_fdw/archive/v2.0.2.tar.gz
$ tar -xzf /tmp/tds_fdw-2.0.2.tar.gz -C /tmp/
$ cd /tmp/tds_fdw-2.0.2
$ apt-get install -y libsybdb5 freetds-dev freetds-common
$ make USE_PGXS=1 PG_CONFIG=/usr/lib/postgresql/12/bin/pg_config