Skip to content

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

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 2.6.1 against the staging repo:

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

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The RPM build setup now installs the PostgreSQL development package when the spec references it and PG_MAJOR_VERSION is set. It then checks the server’s LLVM configuration and installs matching LLVM tools when needed.

Changes: PostgreSQL LLVM build setup

Layer / File(s) Summary
Install and align the build toolchain
pkg/scripts/common-functions.sh
When the RPM spec references the PostgreSQL development package and PG_MAJOR_VERSION is set, the setup installs that package and runs align_pg_llvm_toolchain. The function reads LLVM_BINPATH, installs matching LLVM packages if required, and sets CLANG through MAKEFLAGS.
Merge Risk: Minimal · up to fc76c

The change makes RPM JIT bitcode builds use the LLVM version the PostgreSQL server was built with, and it is limited to RPM specs that reference the PostgreSQL devel package. No concrete merge-blocking defect was established. Only one platform and PostgreSQL version were reported as tested.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: RPM JIT bitcode is now built with the LLVM version that the PostgreSQL server was built with. The raw summary confirms the added align_pg_llvm_toolchain() function, wh…
Description check Passed The description states the problem (EL RPM builds fail because the server's pgxs points to LLVM 21 while the system defaults to LLVM 22), the fix (porting align_pg_llvm_toolchain() and updating setup_…
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 now built with the LLVM version that the PostgreSQL server was built with. The raw summary confirms the added align_pg_llvm_toolchain() function, which reads LLVM_BINPATH from the server's Makefile.global and installs the matching llvmNN/clangNN packages. The title is specific and accurate, so the check passes.

Full details: Description check

Explanation

The description states the problem (EL RPM builds fail because the server's pgxs points to LLVM 21 while the system defaults to LLVM 22), the fix (porting align_pg_llvm_toolchain() and updating setup_dnf_build_env to install the devel package, read LLVM_BINPATH, and set CLANG through MAKEFLAGS), and a local test on AlmaLinux 9 arm64. This matches the changeset, so the check passes.

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

I’m a rabbit with a toolchain to check,
I sniffed out the LLVM path in a sec.
When clang was missing from view,
Matching tools came hopping through.
Now the build can bound along,
With CLANG set and errors gone.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 9fcc8868-437b-4bda-aaa1-6c5bef9a4a6d
Commits

Reviewing files that changed from the base of the PR and between 342fe52 and fc76cb3.

Files selected for processing: 1

  • pkg/scripts/common-functions.sh

Included review availability: This review used your included allowance. 6 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.

@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.

@rasifr
rasifr merged commit e7d66a4 into main Nov 17, 2026
36 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