Skip to content

chore: compile postgres statically to reduce the PLT function call #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
Expand Down Expand Up @@ -759,8 +760,8 @@ HAVE_CXX14
enable_gpcloud
enable_shared_postgres_backend
enable_mapreduce
enable_catalog_ext
enable_serverless
enable_catalog_ext
enable_orca
autodepend
PKG_CONFIG_LIBDIR
Expand Down Expand Up @@ -1608,7 +1609,7 @@ Optional Features:
--enable-cassert enable assertion checks (for debugging)
--disable-orca disable ORCA optimizer
--enable-catalog-ext enable Cloudberry catalog extension
--enable-serverless enable Cloudberry serverless mode
--enable-serverless use serverless mode of Cloudberry
--enable-mapreduce enable Cloudberry Mapreduce support
--disable-shared-postgres-backend
enable Cloudberry shared postgres backend support
Expand All @@ -1618,7 +1619,7 @@ Optional Features:
library)
--disable-preload-ic-module
disable preload interconnect module
--enable-pax enable pax support
--disable-pax disable pax support
--disable-thread-safety disable thread-safety in client libraries
--enable-openssl-redirect
enable redirect openssl interface to internal
Expand Down Expand Up @@ -8380,7 +8381,7 @@ $as_echo "checking whether to build with catalog extension... $enable_catalog_ex


#
# Enable serverless mode
# --enable-serverless uses serverless mode of Cloudberry
#


Expand All @@ -8407,8 +8408,8 @@ else
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to use serverless architecture of Cloudberry ... $enable_serverless" >&5
$as_echo "checking whether to use serverless architecture of Cloudberry ... $enable_serverless" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to use serverless mode of Cloudberry... $enable_serverless" >&5
$as_echo "checking whether to use serverless mode of Cloudberry... $enable_serverless" >&6; }


#
Expand Down Expand Up @@ -9101,6 +9102,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to build with preload ic module ... $enable_preload_ic_module" >&5
$as_echo "checking whether to build with preload ic module ... $enable_preload_ic_module" >&6; }


#
# pax support
#
Expand All @@ -9125,13 +9127,16 @@ $as_echo "#define USE_PAX_STORAGE 1" >>confdefs.h

else
enable_pax=yes

$as_echo "#define USE_PAX_STORAGE 1" >>confdefs.h

$as_echo "#define USE_PAX_STORAGE 1" >>confdefs.h

fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking whether to build with pax support ... $enable_pax" >&5
$as_echo "checking whether to build with pax support ... $enable_pax" >&6; }


#
# Include directories
#
Expand Down Expand Up @@ -15699,6 +15704,13 @@ fi



# for contrib/pax_storage
if test "$enable_pax" = yes; then
if test "$enable_shared_postgres_backend" = no; then
as_fn_error $? "pax support requires --enable-shared-postgres-backend" "$LINENO" 5
fi
fi

# for contrib/sepgsql
if test "$with_selinux" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_compute_create_name in -lselinux" >&5
Expand Down
13 changes: 10 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -929,10 +929,10 @@ AC_SUBST(enable_preload_ic_module)
# pax support
#
PGAC_ARG_BOOL(enable, pax, yes,
[disable PAX support],
[disable pax support],
[AC_DEFINE(USE_PAX_STORAGE, 1,
[Define to 1 to support PAX])])
AC_MSG_RESULT([checking whether to build with PAX support ... $enable_pax])
[Define to 1 to support pax])])
AC_MSG_RESULT([checking whether to build with pax support ... $enable_pax])
AC_SUBST(enable_pax)

#
Expand Down Expand Up @@ -1749,6 +1749,13 @@ fi
AC_SUBST(LDAP_LIBS_FE)
AC_SUBST(LDAP_LIBS_BE)

# for contrib/pax_storage
if test "$enable_pax" = yes; then
if test "$enable_shared_postgres_backend" = no; then
AC_MSG_ERROR([pax support requires --enable-shared-postgres-backend])
fi
fi

# for contrib/sepgsql
if test "$with_selinux" = yes; then
AC_CHECK_LIB(selinux, security_compute_create_name, [],
Expand Down
7 changes: 3 additions & 4 deletions src/backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ ifneq ($(PORTNAME), win32)
ifneq ($(PORTNAME), aix)

ifeq ($(enable_shared_postgres_backend),yes)
all: libpostgres.so
libpostgres.so: $(OBJS)
$(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_SL) $(export_dynamic) \
$(filter-out main/main.o, $(call expand_subsys,$^)) $(LIBS) -o $@

postgres: main/main.o libpostgres.so $(top_builddir)/src/port/libpgport_srv.a $(top_builddir)/src/common/libpgcommon_srv.a
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) \
main/main.o libpostgres.so $(top_builddir)/src/port/libpgport_srv.a \
$(top_builddir)/src/common/libpgcommon_srv.a $(LIBS) -o $@
postgres: $(OBJS)
$(CXX) $(CXXFLAGS) $(call expand_subsys,$^) $(LDFLAGS) $(LDFLAGS_EX) $(export_dynamic) $(LIBS) -o $@

else
postgres: $(OBJS)
Expand Down