From f7ad85360f181606e5636e907dfdf29f977c888e Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Sat, 8 Aug 2026 20:57:36 -0700 Subject: [PATCH] ci: relocate pg_client libpq dependency on macOS before packaging 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. --- .github/workflows/build-extensions.yml | 15 +++++++++++++++ extension | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-extensions.yml b/.github/workflows/build-extensions.yml index cc424b1a7..2d63e0a7a 100644 --- a/.github/workflows/build-extensions.yml +++ b/.github/workflows/build-extensions.yml @@ -173,6 +173,21 @@ jobs: MACOSX_DEPLOYMENT_TARGET: 13.3 CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_architectures }} + - name: Relocate libpq dependency for distribution (macOS) + if: runner.os == 'macOS' + # pg_client links against the keg-only standalone `libpq` Homebrew + # formula at /opt/homebrew/opt/libpq/lib/libpq.5.dylib, which is not + # present on machines that install libpq via `postgresql@18` instead. + # Relocate the dependency to @rpath with the common Homebrew locations + # as fallbacks so the released binary loads in either layout, and + # verify the result. See LadybugDB/extensions#48. + run: | + set -euo pipefail + while IFS= read -r -d '' ext; do + extension/scripts/relocate-macos-libpq.sh "$ext" + extension/scripts/verify-macos-libpq-rpaths.sh "$ext" + done < <(find extension/pg_client/build -maxdepth 1 -name '*.lbug_extension' -print0) + - name: Enable long paths (Windows) if: runner.os == 'Windows' run: | diff --git a/extension b/extension index 4bd1dc114..5ffb34943 160000 --- a/extension +++ b/extension @@ -1 +1 @@ -Subproject commit 4bd1dc1149964c8ea8eaf0a060f1a56c2d0dc4a5 +Subproject commit 5ffb349434daf52ad25921efed188faae4f35512