Hi folks
TLDR: postgresql11-devel and postgresql12-devel need to have the
following added:
%if 0%{llvm}
%if 0%{?rhel} && 0%{?rhel} == 7
Requires: llvm5.0-devel >= 5.0 llvm-toolset-7-clang >= 4.0.1
%endif
%endif
Why?
The PGDG rpms for CentOS 7 require LLVM from EPEL and SCL. The
packages used have a nonstandard path per the specfile:
%if %llvm
%if 0%{?rhel} && 0%{?rhel} == 7
CLANG=/opt/rh/llvm-toolset-7/root/usr/bin/clang
LLVM_CONFIG=%{_libdir}/llvm5.0/bin/llvm-config --with-llvm \
%else
--with-llvm \
%endif
%endif
This path gets baked into Pg's Makefile.global where it's used by PGXS
so PGXS will invoke clang as /opt/rh/llvm-toolset-7/root/usr/bin/clang
.
But if the user installs postgresql-devel they won't get the required
tools so they'll get build errors like
+ make USE_PGXS=1 -s -j12
make: /opt/rh/llvm-toolset-7/root/usr/bin/clang: Command not found
make: /opt/rh/llvm-toolset-7/root/usr/bin/clang: Command not found
I suggest the following change to make it more maintainable. First,
where the BuildRequires are defined, change the
%if 0%{?rhel} && 0%{?rhel} == 7
BuildRequires: llvm5.0-devel >= 5.0 llvm-toolset-7-clang >= 4.0.1
%endif
to
%if 0%{?rhel} && 0%{?rhel} == 7
%global rhel7_llvm_toolset llvm5.0-devel >= 5.0 llvm-toolset-7-clang >= 4.0.1
BuildRequires: %{rhel7_llvm_toolset}
%endif
then in the %package devel section add
%if 0%{llvm}
%if 0%{?rhel} && 0%{?rhel} == 7
Requires: %{rhel7_llvm_toolset}
%endif
%endif
--
Craig Ringer http://www.2ndQuadrant.com/
2ndQuadrant - PostgreSQL Solutions for the Enterprise