Thread: pg_config header files are missing - Postgres 13 - Amazon Linux 2

pg_config header files are missing - Postgres 13 - Amazon Linux 2

From
Hasan Marzooq
Date:
Hello!

We've a web application in play framework which uses Postgres 9.6 with plv8 and uuid-ossp extension. We now want to use Postgres 13 instead of 9.6. To achieve this, I'm trying to install Postgres 13 (on the same host where 9.6 is installed) with plv8 and uuid-ossp extension.

PLV8 "make" uses "pg_config" to get the latest version of Postgres (in case multiple Postgres are installed). However, when running "make" with Postgres 13's pg_config, its giving error:

cat: /usr/pgsql-13/include/server/pg_config*.h: No such file or directory

using command: make PG_CONFIG=/usr/pgsql-13/bin/pg_config

I see the header files are missing, in fact there is no "include" folder inside "/usr/pgsql-13/"
--
# ll /usr/pgsql-13
total 16
drwxr-xr-x 2 root root 4096 Dec 29 02:31 bin
drwxr-xr-x 3 root root   23 Dec 29 02:31 doc
drwxr-xr-x 3 root root 4096 Dec 29 02:31 lib
drwxr-xr-x 8 root root 4096 Dec 29 02:31 share
---

Header files (and include folder) do exist in Postgres 9.6's pg_config.

After a bit of research I found that probably installing "postgresql13-devel.x86_64" will install pg_config with headers. However, when installing "postgresql13-devel.x86_64" via yum, it says, 
--
Error: Package: postgresql13-devel-13.5-1PGDG.rhel7.x86_64 (pgdg13)
           Requires: llvm-toolset-7-clang >= 4.0.1
--
I didn't find "llvm-toolset-7-clang" from yum repo, except from the RHEL subscription manager, which is paid for non-dev stuff. So I tried to build llvm-toolset-clang from scratch, but that doesn't solve the problem.

I'm not sure why the header files of Postgres 13's pg_config are missing? It appears pg_config got installed as part of Postgres 13 itself. I'm also not sure if copying 9.6 pg_config header files to 13 is the correct way? 

What would be the next steps here? Please advise.

Some info about host machine: This is Amazon Linux 2
---
# cat /proc/version
Linux version 4.14.256-197.484.amzn2.x86_64 (mockbuild@ip-10-0-37-156) (gcc version 7.3.1 20180712 (Red Hat 7.3.1-13) (GCC)) #1 SMP Tue Nov 30 00:17:50 UTC 2021
---
--
yum list installed | grep -i postgre
postgresql13.x86_64                13.5-1PGDG.rhel7                  @pgdg13
postgresql13-contrib.x86_64        13.5-1PGDG.rhel7                  @pgdg13
postgresql13-libs.x86_64           13.5-1PGDG.rhel7                  @pgdg13
postgresql13-server.x86_64         13.5-1PGDG.rhel7                  @pgdg13
postgresql96.x86_64                9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-contrib.x86_64        9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-devel.x86_64          9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-libs.x86_64           9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-server.x86_64         9.6.24-1PGDG.rhel6                @pgdg96
---

Thanks!
Naqvi










Re: pg_config header files are missing - Postgres 13 - Amazon Linux 2

From
Magnus Hagander
Date:
On Thu, Dec 30, 2021 at 8:10 AM Hasan Marzooq <engr.naqvi@gmail.com> wrote:
>
> Hello!
>
> We've a web application in play framework which uses Postgres 9.6 with plv8 and uuid-ossp extension. We now want to
usePostgres 13 instead of 9.6. To achieve this, I'm trying to install Postgres 13 (on the same host where 9.6 is
installed)with plv8 and uuid-ossp extension. 
>
> PLV8 "make" uses "pg_config" to get the latest version of Postgres (in case multiple Postgres are installed).
However,when running "make" with Postgres 13's pg_config, its giving error: 
>
> cat: /usr/pgsql-13/include/server/pg_config*.h: No such file or directory
>
> using command: make PG_CONFIG=/usr/pgsql-13/bin/pg_config
>
> I see the header files are missing, in fact there is no "include" folder inside "/usr/pgsql-13/"
> --
> # ll /usr/pgsql-13
> total 16
> drwxr-xr-x 2 root root 4096 Dec 29 02:31 bin
> drwxr-xr-x 3 root root   23 Dec 29 02:31 doc
> drwxr-xr-x 3 root root 4096 Dec 29 02:31 lib
> drwxr-xr-x 8 root root 4096 Dec 29 02:31 share
> ---
>
> Header files (and include folder) do exist in Postgres 9.6's pg_config.
>
> After a bit of research I found that probably installing "postgresql13-devel.x86_64" will install pg_config with
headers.However, when installing "postgresql13-devel.x86_64" via yum, it says, 

> --
> Error: Package: postgresql13-devel-13.5-1PGDG.rhel7.x86_64 (pgdg13)
>            Requires: llvm-toolset-7-clang >= 4.0.1
> --
> I didn't find "llvm-toolset-7-clang" from yum repo, except from the RHEL subscription manager, which is paid for
non-devstuff. So I tried to build llvm-toolset-clang from scratch, but that doesn't solve the problem. 

Note that the PGDG repositories are not supported on Amazon Linux.
https://www.postgresql.org/download/linux/redhat/ has a list of
supported platforms for them.

On CentOS, which is, you need to run:
yum install centos-release-scl-rh

To get access to the required packages. I have no idea if the same
thing exists on Amazon Linux, but it might be worth a try.

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/



Re: pg_config header files are missing - Postgres 13 - Amazon Linux 2

From
Hasan Marzooq
Date:
Hi.
I tried "yum install centos-release-scl-rh" before but it gives the below error.
------
# yum install centos-release-scl-rh
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
213 packages excluded due to repository priority protections
No package centos-release-scl-rh available.
Error: Nothing to do
--------

Postgres 9.6 on this machine (Amazon Linux 2) is installed via PGDG repo, so I tried installing Postgres 13 as well, and I can see it has installed but only one more package I need that is "postgresql13-devel.x86_64" which needs another dependency " llvm-toolset-7-clang >= 4.0.1" that is not available from the same repo.

---
yum list installed | grep -i postgres
postgresql13.x86_64                13.5-1PGDG.rhel7                  @pgdg13
postgresql13-contrib.x86_64        13.5-1PGDG.rhel7                  @pgdg13
postgresql13-libs.x86_64           13.5-1PGDG.rhel7                  @pgdg13
postgresql13-server.x86_64         13.5-1PGDG.rhel7                  @pgdg13
postgresql96.x86_64                9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-contrib.x86_64        9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-devel.x86_64          9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-libs.x86_64           9.6.24-1PGDG.rhel6                @pgdg96
postgresql96-server.x86_64         9.6.24-1PGDG.rhel6                @pgdg96
---


On Thu, 30 Dec 2021 at 17:48, Magnus Hagander <magnus@hagander.net> wrote:
On Thu, Dec 30, 2021 at 8:10 AM Hasan Marzooq <engr.naqvi@gmail.com> wrote:
>
> Hello!
>
> We've a web application in play framework which uses Postgres 9.6 with plv8 and uuid-ossp extension. We now want to use Postgres 13 instead of 9.6. To achieve this, I'm trying to install Postgres 13 (on the same host where 9.6 is installed) with plv8 and uuid-ossp extension.
>
> PLV8 "make" uses "pg_config" to get the latest version of Postgres (in case multiple Postgres are installed). However, when running "make" with Postgres 13's pg_config, its giving error:
>
> cat: /usr/pgsql-13/include/server/pg_config*.h: No such file or directory
>
> using command: make PG_CONFIG=/usr/pgsql-13/bin/pg_config
>
> I see the header files are missing, in fact there is no "include" folder inside "/usr/pgsql-13/"
> --
> # ll /usr/pgsql-13
> total 16
> drwxr-xr-x 2 root root 4096 Dec 29 02:31 bin
> drwxr-xr-x 3 root root   23 Dec 29 02:31 doc
> drwxr-xr-x 3 root root 4096 Dec 29 02:31 lib
> drwxr-xr-x 8 root root 4096 Dec 29 02:31 share
> ---
>
> Header files (and include folder) do exist in Postgres 9.6's pg_config.
>
> After a bit of research I found that probably installing "postgresql13-devel.x86_64" will install pg_config with headers. However, when installing "postgresql13-devel.x86_64" via yum, it says,

> --
> Error: Package: postgresql13-devel-13.5-1PGDG.rhel7.x86_64 (pgdg13)
>            Requires: llvm-toolset-7-clang >= 4.0.1
> --
> I didn't find "llvm-toolset-7-clang" from yum repo, except from the RHEL subscription manager, which is paid for non-dev stuff. So I tried to build llvm-toolset-clang from scratch, but that doesn't solve the problem.

Note that the PGDG repositories are not supported on Amazon Linux.
https://www.postgresql.org/download/linux/redhat/ has a list of
supported platforms for them.

On CentOS, which is, you need to run:
yum install centos-release-scl-rh

To get access to the required packages. I have no idea if the same
thing exists on Amazon Linux, but it might be worth a try.

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/

Re: pg_config header files are missing - Postgres 13 - Amazon Linux 2

From
Adrian Klaver
Date:
On 12/30/21 18:32, Hasan Marzooq wrote:
> Hi.
> I tried "yum install centos-release-scl-rh" before but it gives the 
> below error.
> ------
> # yum install centos-release-scl-rh
> Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
> 213 packages excluded due to repository priority protections
> No package centos-release-scl-rh available.
> Error: Nothing to do
> --------
> 
> Postgres 9.6 on this machine (Amazon Linux 2) is installed via PGDG 
> repo, so I tried installing Postgres 13 as well, and I can see it has 
> installed but only one more package I need that is 
> "postgresql13-devel.x86_64" which needs another dependency " 
> llvm-toolset-7-clang >= 4.0.1" that is not available from the same repo.
> 
> ---
> yum list installed | grep -i postgres
> postgresql13.x86_64                13.5-1PGDG.rhel7                  @pgdg13
> postgresql13-contrib.x86_64        13.5-1PGDG.rhel7                  @pgdg13
> postgresql13-libs.x86_64           13.5-1PGDG.rhel7                  @pgdg13
> postgresql13-server.x86_64         13.5-1PGDG.rhel7                  @pgdg13
> postgresql96.x86_64                9.6.24-1PGDG.rhel6                @pgdg96
> postgresql96-contrib.x86_64        9.6.24-1PGDG.rhel6                @pgdg96
> postgresql96-devel.x86_64          9.6.24-1PGDG.rhel6                @pgdg96
> postgresql96-libs.x86_64           9.6.24-1PGDG.rhel6                @pgdg96
> postgresql96-server.x86_64         9.6.24-1PGDG.rhel6                @pgdg96
> ---

Not sure if it will make a difference, but your 9.6 instance is using 
the rhel6 repo and the 13 is using rhel7.



-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: pg_config header files are missing - Postgres 13 - Amazon Linux 2

From
Magnus Hagander
Date:
On Fri, Dec 31, 2021 at 3:32 AM Hasan Marzooq <engr.naqvi@gmail.com> wrote:
>
> Hi.
> I tried "yum install centos-release-scl-rh" before but it gives the below error.
> ------
> # yum install centos-release-scl-rh
> Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
> 213 packages excluded due to repository priority protections
> No package centos-release-scl-rh available.
> Error: Nothing to do
> --------
>
> Postgres 9.6 on this machine (Amazon Linux 2) is installed via PGDG repo, so I tried installing Postgres 13 as well,
andI can see it has installed but only one more package I need that is "postgresql13-devel.x86_64" which needs another
dependency" llvm-toolset-7-clang >= 4.0.1" that is not available from the same repo. 

I don't believe 9.6 was supported either, but it may have worked "by chance".

The llvm dependency comes from the JIT functionality, which was added
in PostgreSQL 11, so it not being a dependency in an older version
than that makes perfect sense.

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/



Re: pg_config header files are missing - Postgres 13 - Amazon Linux 2

From
Hasan Marzooq
Date:
This problem posted in OP is resolved. I did some workaround. I copied the required "pg_config*.h" from another machine where PG13 was installed via amazon linux 2 repos. 

> I don't believe 9.6 was supported either, but it may have worked "by chance".

I'm not sure whether it worked "by chance" or otherwise, because it looks like Amazon Linux 2 is based on "RHEL 7" as per below:

Note the "ID_LIKE": 
----
# cat /etc/*elease
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
Amazon Linux release 2 (Karoo)
----

And:
---
# rpm -E %{rhel}
7
----

Thanks!


On Sun, 2 Jan 2022 at 00:58, Magnus Hagander <magnus@hagander.net> wrote:
On Fri, Dec 31, 2021 at 3:32 AM Hasan Marzooq <engr.naqvi@gmail.com> wrote:
>
> Hi.
> I tried "yum install centos-release-scl-rh" before but it gives the below error.
> ------
> # yum install centos-release-scl-rh
> Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
> 213 packages excluded due to repository priority protections
> No package centos-release-scl-rh available.
> Error: Nothing to do
> --------
>
> Postgres 9.6 on this machine (Amazon Linux 2) is installed via PGDG repo, so I tried installing Postgres 13 as well, and I can see it has installed but only one more package I need that is "postgresql13-devel.x86_64" which needs another dependency " llvm-toolset-7-clang >= 4.0.1" that is not available from the same repo.

I don't believe 9.6 was supported either, but it may have worked "by chance".

The llvm dependency comes from the JIT functionality, which was added
in PostgreSQL 11, so it not being a dependency in an older version
than that makes perfect sense.

--
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/