Summary
Seems like a packaging compatibility issue, and could use a UX enhancement to not trip up new users working with homebrew on macOS.
The official macOS arm64 build of libpg_client.lbug_extension 0.19.0
references this absolute libpq path:
/opt/homebrew/opt/libpq/lib/libpq.5.dylib
That file is provided by Homebrew's standalone libpq formula. It is not
present on a machine that has PostgreSQL 18 installed only through the
postgresql@18 brew formula.
The same library is available at a different path on that installation:
/opt/homebrew/lib/postgresql@18/libpq.5.dylib
Because the extension records the first path in its install name, Ladybug
cannot load it on this setup. Relinking a copy of the extension to the second
path fixes the problem.
Environment
- PostgreSQL 18.4 installed with Homebrew
postgresql@18
- macOS arm64
pg_client extension binary 0.19.0 from the official release
liblbug 0.19.1
- Standalone Homebrew
libpq formula not installed
Reproduction
Install PostgreSQL with brew install postgresql@18, without installing the
separate libpq formula. Then inspect the extension and the two possible
library paths:
otool -L libpg_client.lbug_extension | grep libpq
# /opt/homebrew/opt/libpq/lib/libpq.5.dylib (compatibility version 5.0.0, ...)
ls /opt/homebrew/opt/libpq/lib/libpq.5.dylib
# ls: no such file or directory
ls /opt/homebrew/lib/postgresql@18/libpq.5.dylib
# /opt/homebrew/lib/postgresql@18/libpq.5.dylib
Loading the extension then fails:
LOAD EXTENSION '/path/to/libpg_client.lbug_extension';
Workaround
Relink a disposable copy of the extension to the libpq installed by
postgresql@18:
install_name_tool -change \
/opt/homebrew/opt/libpq/lib/libpq.5.dylib \
/opt/homebrew/lib/postgresql@18/libpq.5.dylib \
libpg_client.lbug_extension
The patched copy loads successfully.
Possible fixes
- Use
@rpath or a loader-relative install name and include the common
Homebrew locations in LC_RPATH.
- Bundle or statically link libpq if its licensing and distribution terms
allow that.
- Publish separate binaries for the supported Homebrew layouts, or relink the
extension during installation.
Summary
Seems like a packaging compatibility issue, and could use a UX enhancement to not trip up new users working with homebrew on macOS.
The official macOS arm64 build of
libpg_client.lbug_extension0.19.0references this absolute libpq path:
That file is provided by Homebrew's standalone
libpqformula. It is notpresent on a machine that has PostgreSQL 18 installed only through the
postgresql@18brew formula.The same library is available at a different path on that installation:
Because the extension records the first path in its install name, Ladybug
cannot load it on this setup. Relinking a copy of the extension to the second
path fixes the problem.
Environment
postgresql@18pg_clientextension binary 0.19.0 from the official releaseliblbug0.19.1libpqformula not installedReproduction
Install PostgreSQL with
brew install postgresql@18, without installing theseparate
libpqformula. Then inspect the extension and the two possiblelibrary paths:
Loading the extension then fails:
Workaround
Relink a disposable copy of the extension to the libpq installed by
postgresql@18:The patched copy loads successfully.
Possible fixes
@rpathor a loader-relative install name and include the commonHomebrew locations in
LC_RPATH.allow that.
extension during installation.