Missing -devel dependency in CentOS 7 LLVM support

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: pgsql-pkg-yum <pgsql-pkg-yum(at)postgresql(dot)org>
Subject: Missing -devel dependency in CentOS 7 LLVM support
Date: 2020-02-06 09:04:40
Message-ID: CAMsr+YGzuPv3qSBp3LCrc9SnYi=iHfijdjERNNufh75+YM-92g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-pkg-yum

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

Browse pgsql-pkg-yum by date

  From Date Subject
Next Message Adam Middleton 2020-02-07 17:37:52 Southern California 2020 Linux Expo Emails
Previous Message cwlists 2020-01-30 14:00:49 Re: postgresql94 packages in PostgreSQL 12 EL6 and EL8