Skip to content

Builds RPM JIT bitcode with the LLVM the PostgreSQL server was built with - #84

Merged
rasifr merged 1 commit into
mainfrom
fix/el-llvm21-toolchain
Nov 17, 2026
Merged

rasifr merged 1 commit into
mainfrom
fix/el-llvm21-toolchain

Conversation

@maqeel75

Copy link
Copy Markdown
Member

Same fix as pgEdge/spock#734.

Problem

The published pgEdge PostgreSQL servers are built with LLVM 21, so their pgxs points at /usr/lib64/llvm21/bin. AlmaLinux 9.9 / 10.3 moved the default llvm/clang to 22, so EL RPM builds no longer have the LLVM 21 tools and the bitcode install step fails:

/usr/lib64/llvm21/bin/llvm-lto: No such file or directory
make: *** [.../pgxs.mk:242: install] Error 127

(clang 22 bitcode would not be readable by llvm-lto 21 anyway.) The last releases of this repo succeeded only because they ran before that switch; the next release tag would fail on EL.

Fix

Ports align_pg_llvm_toolchain() from pgedge-enterprise-packages into pkg/scripts/common-functions.sh. setup_dnf_build_env now installs pgedge-postgresqlNN-devel, reads the server's LLVM_BINPATH, installs llvmNN/clangNN (EPEL) if missing, and sets CLANG through MAKEFLAGS so the bitcode is built and linked by the server's LLVM.

Testing

Local RPM build of 1.1 against the staging repo:

  • almalinux:9 arm64, PG16: build OK, llvmjit package built, all 2 bitcode files readable by LLVM 21

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds align_pg_llvm_toolchain() to check for PostgreSQL’s LLVM tools and set CLANG through MAKEFLAGS. RPM setup calls the function after installing the PostgreSQL development package when the specified version and RPM spec conditions match.

Merge Risk: Minimal · up to 366b2

RPM builds now use the LLVM tools that match the installed PostgreSQL server for JIT bitcode. This avoids failures when the distribution default LLVM is newer than the server's. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: RPM JIT bitcode is built with the LLVM version the PostgreSQL server was built with. The changeset adds align_pg_llvm_toolchain() to pkg/scripts/common-functions.sh, w…
Description check Passed The description states the problem (EL RPM builds fail because the default LLVM moved to 22 while the published PostgreSQL servers use LLVM 21) and the fix (porting align_pg_llvm_toolchain() and updat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: RPM JIT bitcode is built with the LLVM version the PostgreSQL server was built with. The changeset adds align_pg_llvm_toolchain() to pkg/scripts/common-functions.sh, which reads LLVM_BINPATH from Makefile.global, installs matching llvmNN/clangNN, and sets CLANG through MAKEFLAGS during RPM build setup. The title is specific and matches the objectives.

Full details: Description check

Explanation

The description states the problem (EL RPM builds fail because the default LLVM moved to 22 while the published PostgreSQL servers use LLVM 21) and the fix (porting align_pg_llvm_toolchain() and updating setup_dnf_build_env to install pgedge-postgresqlNN-devel, read LLVM_BINPATH, install matching llvm/clang, and set CLANG via MAKEFLAGS). It also gives a local test result. This is related to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d66225f and 366b2ab.

Files selected for processing: 1

  • pkg/scripts/common-functions.sh

Included review availability: This review used your included allowance. 5 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.

@rasifr
rasifr merged commit 51650ed into main Nov 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants