Skip to content

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

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

Problem

The v6.0.0-beta.2 release failed on EL RPM builds in %install:

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

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 the build image no longer has the LLVM 21 tools, and clang 22 bitcode would not be readable by llvm-lto 21 anyway.

Fix

Ports align_pg_llvm_toolchain() from pgedge-enterprise-packages (common/common-functions.sh) 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 builds against the staging repo:

  • almalinux:9 arm64, PG16: build OK, llvmjit package built, all 40 bitcode files readable by LLVM 21
  • almalinux:10 arm64, PG19: build OK, same checks

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The script adds a function that aligns LLVM tools with PostgreSQL’s configured toolchain. RPM build setup installs the matching PostgreSQL devel package and runs the function when the version and RPM spec conditions are met.

Changes: RPM LLVM Alignment

Layer / File(s) Summary
Align LLVM tools
pkg/scripts/common-functions.sh
The new function checks PostgreSQL’s Makefile.global and LLVM_BINPATH. It installs versioned LLVM and Clang packages before trying generic packages when required tools are missing. It then sets CLANG through MAKEFLAGS.
Integrate alignment into RPM setup
pkg/scripts/common-functions.sh
When PG_MAJOR_VERSION is set and an RPM spec references the PostgreSQL devel package, setup installs the matching package and runs LLVM alignment. Either command’s failure returns an error.
Merge Risk: Minimal · up to 22eab

This change makes RPM builds install the LLVM and Clang version that PostgreSQL was built with, so JIT bitcode is compatible with the server. The change affects only build-time setup and a failure would be an obvious build error. No concrete merge-blocking risk was identified.

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 rea…
Description check Passed The description states the problem (EL RPM %install failure due to missing LLVM 21 tools), the fix (porting align_pg_llvm_toolchain() and related setup changes), and the testing performed. It matches …
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 reads LLVM_BINPATH and aligns the toolchain, which matches this title.

Full details: Description check

Explanation

The description states the problem (EL RPM %install failure due to missing LLVM 21 tools), the fix (porting align_pg_llvm_toolchain() and related setup changes), and the testing performed. It matches the changeset described in the raw summary.

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

A rabbit checked the toolchain at dawn,
Then found where PostgreSQL’s LLVM had gone.
Clang joined the build with a hop and a skip,
Packages lined up for the RPM trip.
“All set,” said the rabbit, and bounded along.

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: 23ca687b-30eb-4b3c-941e-9d7f9065827f
Commits

Reviewing files that changed from the base of the PR and between 71247c9 and 22eab4d.

Files selected for processing: 1

  • pkg/scripts/common-functions.sh

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

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