Skip to content

Fix Makefile to link against OpenSSL on PGXS#1

Open
sumanmichael wants to merge 1 commit into
mainfrom
fix/makefile-link-openssl
Open

Fix Makefile to link against OpenSSL on PGXS#1
sumanmichael wants to merge 1 commit into
mainfrom
fix/makefile-link-openssl

Conversation

@sumanmichael
Copy link
Copy Markdown

@sumanmichael sumanmichael commented May 15, 2026

Summary

  • PGXS only applies SHLIB_LINK to MODULE_big builds. with MODULES, the variable is silently ignored, so -lssl -lcrypto never reached the link line and the build failed with undefined OpenSSL symbols (EVP_EncryptInit_ex, EVP_aes_256_gcm, RAND_bytes, etc.).
  • Switch from MODULES = plpgsql_wrap to MODULE_big = plpgsql_wrap + OBJS = plpgsql_wrap.o so SHLIB_LINK += $(OSSL_LIBS) actually takes effect.

Before this fix, pkg-config --cflags openssl worked (compile succeeded) but pkg-config --libs openssl was discarded at link time.

Test plan

  • make clean && make WRAP_KEY_HEX=$(openssl rand -hex 32) succeeds and produces plpgsql_wrap.dylib.
  • Inspect the resulting link line and confirm -L<openssl-prefix>/lib -lssl -lcrypto is present.
  • sudo make install && make installcheck passes the regression suite.
  • Verified locally on macOS arm64 (Postgres.app 18, OpenSSL 3.6.2 from Homebrew).

PGXS only applies SHLIB_LINK to MODULE_big builds; with MODULES the
flag is silently ignored, so -lssl -lcrypto never reached the link
line and the build failed with undefined OpenSSL symbols.

Switch from MODULES to MODULE_big (+ OBJS) so SHLIB_LINK is honored.
@sumanmichael sumanmichael requested a review from darold May 15, 2026 17:54
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