EnterpriseDB / mysql_fdw

PostgreSQL foreign data wrapper for MySQL
Other
523 stars 161 forks source link

postgres.h No such file or directory #203

Closed GrzegorzWalewski closed 3 years ago

GrzegorzWalewski commented 3 years ago

Hi! I was trying to run sudo make USE_PGXS=1, and run into issue: connection.c:15:10: fatal error: postgres.h: No such file or directory 15 | #include "postgres.h" | ^~~~~~~~~~~~ compilation terminated. make: *** [<builtin>: connection.o] Error 1 This problem occurs at my both computers. I was trying to fix, but everything seems to be good. Please help

surajkharage19 commented 3 years ago

Hi @GrzegorzWalewski,

It would be good if you share below additional information to troubleshoot this issue further:

1: Exact OS version 2: Exact postgres version 3: Have you added pg_config executable in your path variable? 4: How you have installed the postgres? using RPM or source code? If RPM then confirm if you have installed postgresqlXX-devel package which contains header files and libraries. 5: Output of below queries. find / -name "postgres.h" -print pg_config --includedir-server

GrzegorzWalewski commented 3 years ago
  1. Ubuntu 18.04
  2. postgres (PostgreSQL) 10.14
  3. yes
  4. RPM and yes i installed -devel package
  5. find / -name "postgres.h" -print /home/linuxbrew/.linuxbrew/Cellar/postgresql/12.4/include/postgresql/server/postgres.h

/usr/include/postgresql/9.6/server/postgres.h

pg_config --includedir-server

/usr/include/postgresql/12/server

surajkharage19 commented 3 years ago

Thanks for providing information.

As per your last update, you are compiling mysql_fdw sources against v10.15, but "pg_config --includedir-server" shows the directory path for v12. I think you need to add the pg_config binary of v10 in your PATH then make sure that you have installed the "postgresql10-devel" package at your end. I guess "postgresql10-devel" is not present at your end as I don't see "postgres.h" under postgres 10 installation directory.

GrzegorzWalewski commented 3 years ago

What I did is:

  1. Uninstall all postgresql versions I had installed: Search: dpkg -l | grep postgres Uninstall: sudo apt --purge remove [version-name] And install: sudo apt-get install postgresql-10 sudo apt install postgresql-server-dev-10 And now it worked :D Thanks for Your help <3