Skip to content

ci: relocate pg_client libpq dependency on macOS before packaging - #792

Merged
adsharma merged 1 commit into
mainfrom
fix/macos-libpq-rpath-relocation
Aug 9, 2026
Merged

ci: relocate pg_client libpq dependency on macOS before packaging#792
adsharma merged 1 commit into
mainfrom
fix/macos-libpq-rpath-relocation

Conversation

@adsharma

@adsharma adsharma commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Wiring for LadybugDB/extensions#48 (macOS arm64 pg_client 0.19.0 fails to load on machines with only postgresql@18 installed).

Changes

After the macOS extension build, relocate and verify the built pg_client extension before collect-extensions.py packages the artifacts:

extension/scripts/relocate-macos-libpq.sh 
extension/scripts/verify-macos-libpq-rpaths.sh 

The new macOS step rewrites the libpq install name recorded by the keg-only standalone libpq formula (/opt/homebrew/opt/libpq/lib/libpq.5.dylib) to @rpath/libpq.5.dylib with the common Homebrew locations (standalone libpq + bundled postgresql@18, /opt/homebrew and /usr/local) as LC_RPATH fallbacks, so the released binary loads in either layout.

Also bumps the extension submodule from 4bd1dc1 to 5ffb349, which pulls in the two relocation scripts from LadybugDB/extensions#49 (plus the 5 extensions commits on main since the previous pin).

Notes

  • This is a two-repo change: macos: relocate libpq to @rpath for Homebrew layout portability extensions#49 adds the scripts; this PR wires them into the build. The submodule pin points at the extensions PR branch commit 5ffb349, which stays valid regardless of merge order; once that PR merges, the pin can be advanced to the new extensions main SHA.
  • The relocation is macOS-only (if: runner.os == 'macOS'), matching where the standalone-libpq link path is recorded.
  • Scripts were validated locally: dylib linked against standalone libpq → repositioned to @rpath + 6 rpaths, verify passes, idempotent, and a simulated postgresql@18-only machine loads the patched binary.

pg_client links against the keg-only standalone 'libpq' Homebrew
formula in CI, which records /opt/homebrew/opt/libpq/lib/libpq.5.dylib
in the released binary. Machines that install libpq via
'brew install postgresql@18' only cannot resolve that path and fail to
LOAD EXTENSION (LadybugDB/extensions#48).

After the macOS extension build, run the extension repo's
scripts/relocate-macos-libpq.sh + verify-macos-libpq-rpaths.sh on the
built pg_client extension so the dependency is rewritten to
@rpath/libpq.5.dylib with the common Homebrew locations as LC_RPATH
fallbacks. Bump the extension submodule (which carries those scripts)
from 4bd1dc1 to 5ffb349.
@adsharma
adsharma merged commit a049370 into main Aug 9, 2026
7 of 10 checks passed
@adsharma
adsharma deleted the fix/macos-libpq-rpath-relocation branch August 9, 2026 04:03
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.

1 participant