This is an automated email from the ASF dual-hosted git repository. avamingli pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit de0e7a5b8d9bf7ddb46e32b76f647c4711a537df Author: Zhang Mingli <[email protected]> AuthorDate: Fri May 29 00:10:29 2026 +0800 macOS: pin DLSUFFIX=.so for PG 16 compatibility PG 16 upstream commit b55f62abb2c ('Unify DLSUFFIX on Darwin') changed DLSUFFIX on macOS from .so to .dylib so the suffix would match both linkable shared libraries and dlopen'd modules. Cloudberry, however, has many places that still hard-code '$libdir/foo.so' — the catalog SQL bootstrap scripts, cdb_init.d, and a number of expected/*.out files. When PG sees an explicit '.so' suffix in a library reference it does NOT re-append DLSUFFIX, so a .so / .dylib divergence breaks the catalog bootstrap (FATAL: could not access file 'foo'). Restore the pre-PG16 behaviour of DLSUFFIX=.so on darwin (via src/template/darwin) so all those hard-coded references resolve. Two follow-on adjustments are needed: * configure: the Python-shared-library probe builds a candidate path as '$python_libdir/lib$ldlibrary$DLSUFFIX'. macOS Python ships its shared lib as .dylib regardless of what DLSUFFIX is set to for modules; without a .dylib fallback the probe fails with 'could not find shared library for Python'. Try .dylib alongside DLSUFFIX on darwin. * src/test/regress/GNUmakefile: a handful of install/uninstall lines hard-coded '.so' for the test-helper modules (regress, test_hook, query_info_hook_test). Replace with $(DLSUFFIX) so they keep working regardless of the value. --- configure | 21 ++++++++++++++++----- src/template/darwin | 10 +++++++++- src/test/regress/GNUmakefile | 12 ++++++------ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 440b66d0f4c..d2ffd6b00bd 100755 --- a/configure +++ b/configure @@ -12977,13 +12977,24 @@ else fi # Search for a likely-looking file. found_shlib=0 + # On Darwin, Python ships its shared lib as .dylib regardless of + # what DLSUFFIX is set to for modules. Try .dylib in addition to + # the configured DLSUFFIX so this check still finds libpython. + if test "$PORTNAME" = darwin; then + python_shlib_suffixes="$DLSUFFIX .dylib" + else + python_shlib_suffixes="$DLSUFFIX" + fi for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib do - if test -e "$d/lib${ldlibrary}${DLSUFFIX}"; then - python_libdir="$d" - found_shlib=1 - break 2 - fi + for s in $python_shlib_suffixes + do + if test -e "$d/lib${ldlibrary}${s}"; then + python_libdir="$d" + found_shlib=1 + break 3 + fi + done done # Some platforms (OpenBSD) require us to accept a bare versioned shlib # (".so.n.n") as well. However, check this only after failing to find diff --git a/src/template/darwin b/src/template/darwin index e8eb9390687..020b4bde84b 100644 --- a/src/template/darwin +++ b/src/template/darwin @@ -27,4 +27,12 @@ case $host_os in ;; esac -DLSUFFIX=".dylib" +# PG 16 upstream (b55f62abb2c) unified DLSUFFIX to .dylib on macOS. +# Cloudberry's catalog SQL and cdb_init.d scripts (and many test +# expected files) hard-code "$libdir/foo.so" — when PG sees an +# explicit suffix it does NOT re-append DLSUFFIX, so .so / .dylib +# divergence breaks the catalog bootstrap. Keep the pre-PG16 +# behaviour of DLSUFFIX=.so so all those references continue to +# resolve. The Python-shared-library check below is patched in +# configure to try .dylib as a fallback for macOS's libpython. +DLSUFFIX=".so" diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 86c5abc5ffa..239302227e0 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -61,7 +61,7 @@ $(top_builddir)/src/port/pg_config_paths.h: | submake-libpgport install: all installdirs $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)' - $(INSTALL_PROGRAM) regress.so '$(DESTDIR)$(pkglibdir)/regress.so' + $(INSTALL_PROGRAM) regress$(DLSUFFIX) '$(DESTDIR)$(pkglibdir)/regress$(DLSUFFIX)' $(INSTALL_PROGRAM) gpdiff.pl '$(DESTDIR)$(pgxsdir)/$(subdir)/gpdiff.pl' $(INSTALL_PROGRAM) gpstringsubs.pl '$(DESTDIR)$(pgxsdir)/$(subdir)/gpstringsubs.pl' $(INSTALL_PROGRAM) atmsort.pl '$(DESTDIR)$(pgxsdir)/$(subdir)/atmsort.pl' @@ -71,13 +71,13 @@ install: all installdirs $(INSTALL_PROGRAM) GPTest.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/GPTest.pm' $(INSTALL_PROGRAM) scan_flaky_fault_injectors.sh '$(DESTDIR)$(pgxsdir)/$(subdir)/scan_flaky_fault_injectors.sh' $(INSTALL_PROGRAM) twophase_pqexecparams '$(DESTDIR)$(pgxsdir)/$(subdir)/twophase_pqexecparams' - $(INSTALL_PROGRAM) hooktest/test_hook.so '$(DESTDIR)$(pkglibdir)/test_hook.so' - $(INSTALL_PROGRAM) query_info_hook_test/query_info_hook_test.so '$(DESTDIR)$(pkglibdir)/query_info_hook_test.so' + $(INSTALL_PROGRAM) hooktest/test_hook$(DLSUFFIX) '$(DESTDIR)$(pkglibdir)/test_hook$(DLSUFFIX)' + $(INSTALL_PROGRAM) query_info_hook_test/query_info_hook_test$(DLSUFFIX) '$(DESTDIR)$(pkglibdir)/query_info_hook_test$(DLSUFFIX)' installdirs: $(MKDIR_P) '$(DESTDIR)$(pgxsdir)/$(subdir)' uninstall: - rm -f '$(DESTDIR)$(pkglibdir)/regress.so' + rm -f '$(DESTDIR)$(pkglibdir)/regress$(DLSUFFIX)' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/gpdiff.pl' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/gpstringsubs.pl' @@ -87,8 +87,8 @@ uninstall: rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/explain.pm' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/GPTest.pm' rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/twophase_pqexecparams' - rm -f '$(DESTDIR)$(pkglibdir)/test_hook.so' - rm -f '$(DESTDIR)$(pkglibdir)/query_info_hook_test.so' + rm -f '$(DESTDIR)$(pkglibdir)/test_hook$(DLSUFFIX)' + rm -f '$(DESTDIR)$(pkglibdir)/query_info_hook_test$(DLSUFFIX)' # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
