Skip to content

build: make test harness build and run on macOS - #8

Merged
adsharma merged 2 commits into
mainfrom
fix_mac
Aug 10, 2026
Merged

build: make test harness build and run on macOS#8
adsharma merged 2 commits into
mainfrom
fix_mac

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Three fixes so ./scripts/test.sh works on macOS against a pgembed-bundled PostgreSQL whose pg_config has a stale -isysroot baked in after an Xcode upgrade, and where an older liblbug may already be installed system-wide:

  • Makefile: add PG_LDFLAGS = -L/lib. PGXS prepends PG_LDFLAGS to LDFLAGS, so the vendored liblbug (0.19.1) is searched before any system liblbug (e.g. an older 0.18.0 under /opt/homebrew/lib) that pg_config's LDFLAGS would otherwise link first, causing 'undefined symbol: _lbug_connection_get_pushed_sql'.

  • scripts/test_with_pgembed.py: forward CC and PG_SYSROOT from the environment onto the make command line (command-line make vars override PGXS' plain '=' assignments; plain env vars do not). This lets a builder pick homebrew clang and a valid SDK to repair the stale -isysroot. Also resolve the shared library suffix dynamically (.so on Linux, .dylib on macOS) instead of hardcoding pg_ladybug.so, and prepend the embedded PG's bin/ to PATH so psql is found.

  • .gitignore: add *.dylib (macOS build product).

Three fixes so ./scripts/test.sh works on macOS against a pgembed-bundled
PostgreSQL whose pg_config has a stale -isysroot baked in after an Xcode
upgrade, and where an older liblbug may already be installed system-wide:

- Makefile: add PG_LDFLAGS = -L/lib. PGXS prepends PG_LDFLAGS to
  LDFLAGS, so the vendored liblbug (0.19.1) is searched before any system
  liblbug (e.g. an older 0.18.0 under /opt/homebrew/lib) that pg_config's
  LDFLAGS would otherwise link first, causing 'undefined symbol:
  _lbug_connection_get_pushed_sql'.

- scripts/test_with_pgembed.py: forward CC and PG_SYSROOT from the
  environment onto the make command line (command-line make vars override
  PGXS' plain '=' assignments; plain env vars do not). This lets a builder
  pick homebrew clang and a valid SDK to repair the stale -isysroot. Also
  resolve the shared library suffix dynamically (.so on Linux, .dylib on
  macOS) instead of hardcoding pg_ladybug.so, and prepend the embedded PG's
  bin/ to PATH so psql is found.

- .gitignore: add *.dylib (macOS build product).
@adsharma
adsharma merged commit 00aa952 into main Aug 10, 2026
3 checks passed
@adsharma
adsharma deleted the fix_mac branch August 10, 2026 15:51
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