You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by av...@apache.org on 2026/06/03 15:49:45 UTC
(cloudberry) branch main updated (87cefe047ce -> 344bac8fa42)
This is an automated email from the ASF dual-hosted git repository.
avamingli pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
from 87cefe047ce Rebase fixes & RAT check fix
new 1854534a63f macOS: make PAX's liburing dependency optional
new 4f58444f1d7 macOS: provide HZ fallback for UDP interconnect
new 8fa1a423355 Drop -Werror -Wextra -Wpedantic from ORCA C++ build
new d107ea4f017 macOS: defer libpostgres.so's undefined symbols to load time
new a2e512e77f7 macOS: PAX cmake portability
new 273b9a2ffeb macOS: PAX C++ portability
new 3917609c704 macOS: build the standalone libpaxformat reader
new e4bf9dac8df numeric: drop bogus 'const' qualifier on init_var_from_str
new de0e7a5b8d9 macOS: pin DLSUFFIX=.so for PG 16 compatibility
new e86bac6e66b macOS: demote clang-strict warning categories in Makefile.custom
new 344bac8fa42 ic_udpifc: fix initSndBufferPool forward declaration
The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
configure | 32 +++++++++--
configure.ac | 16 +++++-
contrib/interconnect/udp/ic_udpifc.c | 9 ++-
contrib/pax_storage/CMakeLists.txt | 24 ++++++--
contrib/pax_storage/Makefile | 21 ++++++-
contrib/pax_storage/src/cpp/CMakeLists.txt | 2 +-
contrib/pax_storage/src/cpp/cmake/pax.cmake | 65 +++++++++++++++++++---
contrib/pax_storage/src/cpp/cmake/pax_format.cmake | 42 +++++++++++++-
contrib/pax_storage/src/cpp/comm/fast_io.cc | 2 +
contrib/pax_storage/src/cpp/comm/fast_io.h | 11 +++-
.../src/cpp/storage/columns/pax_delta_encoding.cc | 8 +++
.../src/cpp/storage/columns/pax_encoding_utils.cc | 4 +-
.../src/cpp/storage/columns/pax_encoding_utils.h | 8 ++-
contrib/pax_storage/src/cpp/storage/file_system.h | 7 +++
.../src/cpp/storage/local_file_system.cc | 18 +++---
.../src/cpp/storage/proto/proto_wrappers.h | 9 +++
.../src/cpp/storage/proto/protobuf_stream.cc | 8 +--
.../src/cpp/storage/proto/protobuf_stream.h | 4 +-
src/Makefile.custom | 35 +++++++++++-
src/backend/Makefile | 12 +++-
src/backend/gporca/gporca.mk | 10 ++++
src/include/utils/numeric.h | 4 +-
src/template/darwin | 10 +++-
src/test/regress/GNUmakefile | 12 ++--
24 files changed, 314 insertions(+), 59 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 08/11: numeric: drop bogus 'const' qualifier on init_var_from_str
Posted by av...@apache.org.
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 e4bf9dac8dfcaaec7767675572a6ee2d9e1a76ec
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 23:23:05 2026 +0800
numeric: drop bogus 'const' qualifier on init_var_from_str
The prototype in src/include/utils/numeric.h declared the function as
returning 'const bool', which conflicts with the definition in
numeric.c that returns plain 'bool'. gcc tolerates this (const on a
non-pointer return is silently meaningless), but clang flags it as
'conflicting types' and the build fails on macOS.
Introduced by '#392 Export numeric interface to public'.
Match the .c definition: plain 'bool'.
---
src/include/utils/numeric.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/include/utils/numeric.h b/src/include/utils/numeric.h
index d175e858879..5cb94e509b6 100644
--- a/src/include/utils/numeric.h
+++ b/src/include/utils/numeric.h
@@ -317,8 +317,8 @@ extern void free_numeric_var(NumericVar *var);
extern void alloc_numeric_var(NumericVar *var, int ndigits);
extern void zero_numeric_var(NumericVar *var);
-extern const bool init_var_from_str(const char *str, const char *cp, NumericVar *dest, const char **endptr,
- Node *escontext);
+extern bool init_var_from_str(const char *str, const char *cp, NumericVar *dest, const char **endptr,
+ Node *escontext);
extern void init_var_from_var(const NumericVar *value, NumericVar *dest);
extern void init_ro_var_from_var(const NumericVar *value, NumericVar *dest);
extern void set_var_from_num(Numeric value, NumericVar *dest);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 07/11: macOS: build the standalone libpaxformat reader
Posted by av...@apache.org.
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 3917609c704e618ee60dd8f1c4093dc292f342a7
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 18:38:39 2026 +0800
macOS: build the standalone libpaxformat reader
paxformat is the standalone PAX file reader meant to be linked by
external tools. The previous commit 'macOS: PAX cmake portability'
skipped it on APPLE because it references PG backend functions
(write_stderr, xlog_check_consistency_hook, ...) that have no
libpostgres.so to satisfy them on macOS.
Build it after all by deferring those undefined symbols to load time
with -Wl,-undefined,dynamic_lookup, just like Linux's default ld
behaviour for shared libraries. The smoke-test executable
paxformat_test uses the same flag and drops the explicit 'postgres'
link library (there is no libpostgres.so to link against on macOS).
paxformat is a regular dylib (SHARED) here — not a bundle — because
the test executable links against it at link time.
---
contrib/pax_storage/src/cpp/CMakeLists.txt | 10 ++--------
contrib/pax_storage/src/cpp/cmake/pax_format.cmake | 22 ++++++++++++++++++++--
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/contrib/pax_storage/src/cpp/CMakeLists.txt b/contrib/pax_storage/src/cpp/CMakeLists.txt
index c49473e5d12..0a36374a08d 100644
--- a/contrib/pax_storage/src/cpp/CMakeLists.txt
+++ b/contrib/pax_storage/src/cpp/CMakeLists.txt
@@ -48,13 +48,7 @@ add_custom_target(generate_protobuf DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
link_directories($ENV{GPHOME}/lib)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-## build pax_format.so — standalone reader lib used by external tools.
-## On macOS it would need -undefined dynamic_lookup to resolve PG symbols
-## (write_stderr, xlog_check_consistency_hook, ...). Skip for now; pax.so
-## itself (the in-backend extension) still builds and is enough to run
-## the demo cluster with `USING pax` tables.
-if(NOT APPLE)
- include(pax_format)
-endif()
+## build pax_format.so — standalone PAX reader used by external tools.
+include(pax_format)
## build pax.so
include(pax)
diff --git a/contrib/pax_storage/src/cpp/cmake/pax_format.cmake b/contrib/pax_storage/src/cpp/cmake/pax_format.cmake
index 1c06dacf9d4..de9c640f3f0 100644
--- a/contrib/pax_storage/src/cpp/cmake/pax_format.cmake
+++ b/contrib/pax_storage/src/cpp/cmake/pax_format.cmake
@@ -155,9 +155,18 @@ add_library(paxformat SHARED ${PROTO_SRCS} ${pax_storage_src} ${pax_clustering_s
target_include_directories(paxformat PUBLIC ${pax_target_include})
target_link_directories(paxformat PUBLIC ${pax_target_link_directories})
target_link_libraries(paxformat PRIVATE ${pax_target_link_libs})
-
+
set_target_properties(paxformat PROPERTIES
OUTPUT_NAME paxformat)
+if(APPLE)
+ # PAX C++ code calls PG backend functions (write_stderr,
+ # xlog_check_consistency_hook, ...). On Linux ld defers unresolved
+ # references in .so; macOS ld rejects them unless told otherwise.
+ # Defer them to load time so paxformat is usable wherever PG symbols
+ # are provided.
+ set_target_properties(paxformat PROPERTIES
+ LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
+endif()
add_dependencies(paxformat generate_protobuf)
# export headers
@@ -215,4 +224,13 @@ install(TARGETS paxformat
add_executable(paxformat_test paxformat_test.cc)
target_include_directories(paxformat_test PUBLIC ${pax_target_include} ${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(paxformat_test paxformat)
-target_link_libraries(paxformat_test PRIVATE paxformat postgres)
+if(APPLE)
+ # No libpostgres.so to link against on macOS; defer PG symbols to
+ # load time. The test still validates that paxformat itself is a
+ # complete dylib.
+ target_link_libraries(paxformat_test PRIVATE paxformat)
+ set_target_properties(paxformat_test PROPERTIES
+ LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
+else()
+ target_link_libraries(paxformat_test PRIVATE paxformat postgres)
+endif()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 05/11: macOS: PAX cmake portability
Posted by av...@apache.org.
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 a2e512e77f7e47f6826533b43a805d3e4cd3e5fa
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 18:23:05 2026 +0800
macOS: PAX cmake portability
Several gcc / GNU-ld specific bits in the PAX cmake setup break under
Apple clang and Apple ld. Make them conditional on Linux.
* CMakeLists.txt: gate -no-pie / -Wl,--allow-multiple-definition /
-fno-access-control / -Wno-pmf-conversions (gcc-only) behind
if(NOT APPLE). Replace gcc-only warning disables (-Wno-clobbered,
-Wno-sized-deallocation, -Wno-parameter-name) with
-Wno-unknown-warning-option on APPLE, plus a set of
-Wno-error= demotions for clang-stricter diagnostics
(inconsistent-missing-override, overloaded-virtual,
sometimes-uninitialized, unused-private-field, format,
mismatched-tags, pessimizing-move, unused-but-set-variable,
deprecated-copy, unused-result).
* Makefile: pass -DBUILD_GTEST=OFF to the inner cmake (googletest's
own flags clash with clang). Drop SHLIB_LINK += -luuid on darwin
(uuid_* is in libSystem). Move the ifneq to after the include of
Makefile.global so PORTNAME is actually defined. Cope with cmake
naming the artefact libpax.so on every platform now (see below).
* src/cpp/CMakeLists.txt: skip the standalone libpaxformat target on
macOS. It links to backend symbols (write_stderr, ...) directly
and isn't needed to load PAX inside postgres.
* pax.cmake: on APPLE, build pax as a MODULE (Mach-O bundle, what
PG extensions are) instead of SHARED, and link with
-Wl,-undefined,dynamic_lookup -Wl,-bundle_loader,<postgres>. This
is the standard PG extension pattern; it guarantees that backend
globals (e.g. process_shared_preload_libraries_in_progress) have
one shared instance between postgres and pax.so. Also gate -luring
on Linux; pull abseil deps via pkg-config on macOS (Homebrew's
protobuf v22+ split them into separate libs); replace the
Linux-only $ORIGIN INSTALL_RPATH and -Wl,--enable-new-dtags with
@loader_path on macOS.
* pax_format.cmake: same Linux-only treatment for -luuid / -luring
and the abseil pkg-config.
---
contrib/pax_storage/CMakeLists.txt | 24 ++++++--
contrib/pax_storage/Makefile | 21 ++++++-
contrib/pax_storage/src/cpp/CMakeLists.txt | 10 +++-
contrib/pax_storage/src/cpp/cmake/pax.cmake | 65 +++++++++++++++++++---
contrib/pax_storage/src/cpp/cmake/pax_format.cmake | 20 ++++++-
5 files changed, 122 insertions(+), 18 deletions(-)
diff --git a/contrib/pax_storage/CMakeLists.txt b/contrib/pax_storage/CMakeLists.txt
index e45eab560e6..ac25ee6cbad 100644
--- a/contrib/pax_storage/CMakeLists.txt
+++ b/contrib/pax_storage/CMakeLists.txt
@@ -24,8 +24,16 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Base CXX flags
# Note: -Wpessimizing-move is enabled by default in GCC 9+ and will be caught by -Werror
# No need to explicitly add -Werror=pessimizing-move (which breaks GCC 8.x compatibility)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-unused-function -Wno-error=ignored-qualifiers -Wno-error=array-bounds -Wuninitialized -Winit-self -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-parameter -Wno-clobbered -Wno-sized-deallocation -g")
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-parameter -Wno-parameter-name")
+# -Wno-clobbered / -Wno-sized-deallocation / -Wno-parameter-name are GCC-only.
+# Clang on macOS errors out via -Werror,-Wunknown-warning-option, and is
+# stricter on virtual-override / overloaded-virtual / sometimes-uninitialized.
+if(APPLE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-unused-function -Wno-error=ignored-qualifiers -Wno-error=array-bounds -Wuninitialized -Winit-self -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unknown-warning-option -Wno-error=inconsistent-missing-override -Wno-error=overloaded-virtual -Wno-error=sometimes-uninitialized -Wno-error=unused-private-field -Wno-error=format -Wno-error=mismatched-tags -Wno-error=pessimizing-move -Wno-error=unu [...]
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-parameter -Wno-unknown-warning-option")
+else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-unused-function -Wno-error=ignored-qualifiers -Wno-error=array-bounds -Wuninitialized -Winit-self -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-parameter -Wno-clobbered -Wno-sized-deallocation -g")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-parameter -Wno-parameter-name")
+endif()
option(USE_MANIFEST_API "Use manifest API" OFF)
option(USE_PAX_CATALOG "Use manifest API, by pax impl" ON)
@@ -76,8 +84,16 @@ if(BUILD_GBENCH)
endif(BUILD_GBENCH)
if (BUILD_GTEST)
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -no-pie -fno-stack-protector -Wall -Wno-unused-function -Wno-unused-variable")
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-access-control -fno-inline -Wno-pmf-conversions -Wl,--allow-multiple-definition -no-pie -fno-stack-protector")
+ if(APPLE)
+ # macOS clang/ld lacks several gcc/GNU-ld-only flags used below
+ # (-no-pie, -Wl,--allow-multiple-definition, -fno-access-control,
+ # -Wno-pmf-conversions). Use a clang-safe subset.
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-stack-protector -Wall -Wno-unused-function -Wno-unused-variable")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -fno-stack-protector")
+ else()
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -no-pie -fno-stack-protector -Wall -Wno-unused-function -Wno-unused-variable")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-access-control -fno-inline -Wno-pmf-conversions -Wl,--allow-multiple-definition -no-pie -fno-stack-protector")
+ endif()
endif(BUILD_GTEST)
# Vec options
diff --git a/contrib/pax_storage/Makefile b/contrib/pax_storage/Makefile
index 9f4061db9d7..6e09fc14436 100644
--- a/contrib/pax_storage/Makefile
+++ b/contrib/pax_storage/Makefile
@@ -23,7 +23,6 @@ PG_CPPFLAGS = -I/usr/local/include
PG_CXXFLAGS = -std=c++17
PGFILEDESC = "pax - PAX table access method"
-SHLIB_LINK += -luuid
PAX_REGRESS_DIR = src/test/regress
PAX_ISOLATION2_DIR = src/test/isolation2
@@ -42,6 +41,12 @@ include $(top_srcdir)/contrib/contrib-global.mk
PG_REGRESS = $(top_builddir)/src/test/regress/pg_regress
endif
+# Must come AFTER Makefile.global include so PORTNAME is defined.
+# libuuid is shipped by libSystem on macOS (no separate -luuid needed).
+ifneq ($(PORTNAME), darwin)
+SHLIB_LINK += -luuid
+endif
+
.PHONY: all
all: build
@@ -63,6 +68,15 @@ ifeq ($(USE_PAX_CATALOG),)
endif
.PHONY: install-data build
+# googletest's own CMakeLists.txt sprinkles gcc-only warning flags
+# (-Wno-clobbered, -Wno-sized-deallocation, -Wno-parameter-name) that
+# Apple clang rejects with -Werror,-Wunknown-warning-option. Skip the
+# gtest target on darwin so the rest of PAX still builds; Linux keeps
+# gtest enabled so 'make pax-unit-test' works as before.
+ifeq ($(PORTNAME), darwin)
+PAX_GTEST_OPT := -DBUILD_GTEST=OFF
+endif
+
build: $(SRC) $(CSRC)
@echo "build pax, USE_MANIFEST_API=$(USE_MANIFEST_API) USE_PAX_CATALOG=$(USE_PAX_CATALOG)"
@if [ ! -f build/Makefile ]; then \
@@ -70,9 +84,12 @@ build: $(SRC) $(CSRC)
cd build && \
cmake -DCMAKE_INSTALL_PREFIX=$(DESTDIR)$(prefix) \
-DUSE_MANIFEST_API=$(USE_MANIFEST_API) \
- -DUSE_PAX_CATALOG=$(USE_PAX_CATALOG) .. ; \
+ -DUSE_PAX_CATALOG=$(USE_PAX_CATALOG) \
+ $(PAX_GTEST_OPT) \
+ .. ; \
fi
cd build && make -j8
+# CMake emits libpax.so on both platforms (Linux SHARED, macOS MODULE).
@cp -f build/src/cpp/libpax.so pax.so
pax-unit-test:
diff --git a/contrib/pax_storage/src/cpp/CMakeLists.txt b/contrib/pax_storage/src/cpp/CMakeLists.txt
index 87ff074e877..c49473e5d12 100644
--- a/contrib/pax_storage/src/cpp/CMakeLists.txt
+++ b/contrib/pax_storage/src/cpp/CMakeLists.txt
@@ -48,7 +48,13 @@ add_custom_target(generate_protobuf DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
link_directories($ENV{GPHOME}/lib)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-## build pax_format.so
-include(pax_format)
+## build pax_format.so — standalone reader lib used by external tools.
+## On macOS it would need -undefined dynamic_lookup to resolve PG symbols
+## (write_stderr, xlog_check_consistency_hook, ...). Skip for now; pax.so
+## itself (the in-backend extension) still builds and is enough to run
+## the demo cluster with `USING pax` tables.
+if(NOT APPLE)
+ include(pax_format)
+endif()
## build pax.so
include(pax)
diff --git a/contrib/pax_storage/src/cpp/cmake/pax.cmake b/contrib/pax_storage/src/cpp/cmake/pax.cmake
index 83f79f3f002..0d8be852ddb 100644
--- a/contrib/pax_storage/src/cpp/cmake/pax.cmake
+++ b/contrib/pax_storage/src/cpp/cmake/pax.cmake
@@ -174,15 +174,49 @@ add_subdirectory(contrib/tabulate)
set(pax_target_src ${PROTO_SRCS} ${pax_storage_src} ${pax_clustering_src} ${pax_exceptions_src}
${pax_access_src} ${pax_comm_src} ${pax_catalog_src} ${pax_vec_src})
set(pax_target_include ${pax_target_include} ${ZTSD_HEADER} ${CMAKE_CURRENT_SOURCE_DIR} ${CBDB_INCLUDE_DIR} contrib/tabulate/include)
-set(pax_target_link_libs ${pax_target_link_libs} protobuf zstd z postgres uring)
+set(pax_target_link_libs ${pax_target_link_libs} zstd z)
+# On Linux, link against the libpostgres.so produced by the backend
+# (shared-postgres-backend). On macOS we must NOT do this: pax.so is
+# loaded by postgres via dlopen, and a separate libpostgres.so would
+# give pax.so its own copy of backend globals (e.g.
+# process_shared_preload_libraries_in_progress). Instead, use the
+# standard PG extension pattern: resolve symbols at load time against
+# the postgres binary itself via -bundle_loader.
+if(NOT APPLE)
+ list(APPEND pax_target_link_libs postgres)
+endif()
+# protobuf v22+ split its abseil deps into separate libs. On macOS the
+# Homebrew protobuf is built this way and the link fails for abseil
+# log_internal symbols unless we pull them via pkg-config.
+if(APPLE)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(PB_PC REQUIRED protobuf)
+ set(pax_target_include ${pax_target_include} ${PB_PC_INCLUDE_DIRS})
+ list(APPEND pax_target_link_directories ${PB_PC_LIBRARY_DIRS})
+ list(APPEND pax_target_link_libs ${PB_PC_LIBRARIES})
+else()
+ list(APPEND pax_target_link_libs protobuf)
+endif()
+# liburing is Linux-only; PAX falls back to pread-based SyncFastIO elsewhere.
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ list(APPEND pax_target_link_libs uring)
+endif()
if (PAX_USE_LZ4)
list(APPEND pax_target_link_libs lz4)
endif()
set(pax_target_link_directories ${PROJECT_SOURCE_DIR}/../../src/backend/)
set(pax_target_dependencies generate_protobuf create_sql_script)
-add_library(pax SHARED ${pax_target_src})
-set_target_properties(pax PROPERTIES OUTPUT_NAME pax)
+# On macOS, build pax as a MODULE (bundle) so that -bundle_loader is
+# accepted and undefined PG symbols resolve at load time against the
+# postgres binary (one shared copy of backend globals).
+if(APPLE)
+ add_library(pax MODULE ${pax_target_src})
+ set_target_properties(pax PROPERTIES OUTPUT_NAME pax SUFFIX ".so")
+else()
+ add_library(pax SHARED ${pax_target_src})
+ set_target_properties(pax PROPERTIES OUTPUT_NAME pax)
+endif()
if(USE_MANIFEST_API AND NOT USE_PAX_CATALOG)
set(pax_target_link_libs ${pax_target_link_libs} yyjson)
@@ -209,12 +243,25 @@ endif(VEC_BUILD)
target_include_directories(pax PUBLIC ${pax_target_include})
target_link_directories(pax PUBLIC ${pax_target_link_directories})
target_link_libraries(pax PRIVATE ${pax_target_link_libs})
-set_target_properties(pax PROPERTIES
- BUILD_RPATH_USE_ORIGIN ON
- BUILD_WITH_INSTALL_RPATH ON
- INSTALL_RPATH "$ORIGIN:$ORIGIN/.."
- LINK_FLAGS "-Wl,--enable-new-dtags"
-)
+if(APPLE)
+ # macOS uses @loader_path / LC_RPATH; GNU-ld --enable-new-dtags and
+ # $ORIGIN aren't supported. We must NOT link against libpostgres.so —
+ # instead let undefined PG symbols resolve at load time against the
+ # postgres binary. That keeps a single instance of each backend global
+ # shared between postgres and pax.so.
+ set_target_properties(pax PROPERTIES
+ BUILD_WITH_INSTALL_RPATH ON
+ INSTALL_RPATH "@loader_path;@loader_path/.."
+ LINK_FLAGS "-Wl,-undefined,dynamic_lookup -Wl,-bundle_loader,${PROJECT_SOURCE_DIR}/../../src/backend/postgres"
+ )
+else()
+ set_target_properties(pax PROPERTIES
+ BUILD_RPATH_USE_ORIGIN ON
+ BUILD_WITH_INSTALL_RPATH ON
+ INSTALL_RPATH "$ORIGIN:$ORIGIN/.."
+ LINK_FLAGS "-Wl,--enable-new-dtags"
+ )
+endif()
add_dependencies(pax ${pax_target_dependencies})
add_custom_command(TARGET pax POST_BUILD
diff --git a/contrib/pax_storage/src/cpp/cmake/pax_format.cmake b/contrib/pax_storage/src/cpp/cmake/pax_format.cmake
index 8d28e793d27..1c06dacf9d4 100644
--- a/contrib/pax_storage/src/cpp/cmake/pax_format.cmake
+++ b/contrib/pax_storage/src/cpp/cmake/pax_format.cmake
@@ -109,11 +109,29 @@ set(pax_vec_src ${pax_vec_src}
endif()
set(pax_target_include ${ZTSD_HEADER} ${CMAKE_CURRENT_SOURCE_DIR} ${CBDB_INCLUDE_DIR} contrib/tabulate/include)
-set(pax_target_link_libs uuid protobuf zstd z uring)
+set(pax_target_link_libs zstd z)
+# protobuf v22+ on macOS splits its abseil deps into separate libs;
+# pull them in via pkg-config.
+if(APPLE)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(PB_PC REQUIRED protobuf)
+ set(pax_target_include ${pax_target_include} ${PB_PC_INCLUDE_DIRS})
+ list(APPEND pax_target_link_libs ${PB_PC_LIBRARIES})
+else()
+ list(APPEND pax_target_link_libs protobuf)
+endif()
+# liburing is Linux-only (kernel io_uring iface). macOS provides uuid_*
+# functions in libSystem, so -luuid is also Linux-only.
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ list(APPEND pax_target_link_libs uuid uring)
+endif()
if (PAX_USE_LZ4)
list(APPEND pax_target_link_libs lz4)
endif()
set(pax_target_link_directories ${PROJECT_SOURCE_DIR}/../../src/backend/)
+if(APPLE)
+ list(APPEND pax_target_link_directories ${PB_PC_LIBRARY_DIRS})
+endif()
# vec build
if (VEC_BUILD)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 09/11: macOS: pin DLSUFFIX=.so for PG 16 compatibility
Posted by av...@apache.org.
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 <av...@gmail.com>
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: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 06/11: macOS: PAX C++ portability
Posted by av...@apache.org.
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 273b9a2ffebe775a6da5fd39e31dcf131fedb04e
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 18:23:05 2026 +0800
macOS: PAX C++ portability
Compile-time fixes to let PAX build with Apple clang against
Homebrew's modern protobuf (v22+).
* file_system.h: typedef off64_t = off_t on macOS. glibc exposes
off64_t for 32-bit programs opting into 64-bit file offsets;
macOS's off_t is already 64-bit so there is no separate symbol.
* pax_encoding_utils.{h,cc}: change BuildHistogram/ZigZagBuffers
signatures from int64_t* to PG's int64* (long). On macOS x86_64
int64_t is 'long long', distinct from 'long' for overload
resolution even though both are 64-bit. Using PG's int64
(consistently 'long' on every supported port) keeps callers from
PG-typed buffers (e.g. DataBuffer<int64>::StartT) working on both
platforms.
* pax_delta_encoding.cc: replace 'uint8_t bit_widths[var] = {0};'
(a gcc VLA-with-initializer extension that clang rejects) with
std::vector<uint8_t>.
* proto_wrappers.h: PG's c.h defines Min/Max macros and
xlog_internal.h defines IsPowerOf2; abseil (pulled in by modern
protobuf headers) declares identifiers with the same names.
#undef them around the protobuf include, then restore PG's
definitions afterwards.
* protobuf_stream.{h,cc}: protobuf v22 removed the
google::protobuf::int64 typedef. Use int64_t directly (which is
the type of the base ZeroCopy{Output,Input}Stream::ByteCount()
override anyway).
---
.../pax_storage/src/cpp/storage/columns/pax_delta_encoding.cc | 8 ++++++++
.../pax_storage/src/cpp/storage/columns/pax_encoding_utils.cc | 4 ++--
contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.h | 8 ++++++--
contrib/pax_storage/src/cpp/storage/file_system.h | 7 +++++++
contrib/pax_storage/src/cpp/storage/proto/proto_wrappers.h | 9 +++++++++
contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.cc | 8 ++++----
contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.h | 4 ++--
7 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/contrib/pax_storage/src/cpp/storage/columns/pax_delta_encoding.cc b/contrib/pax_storage/src/cpp/storage/columns/pax_delta_encoding.cc
index 3f4b5341c4a..2c1ae3045f4 100644
--- a/contrib/pax_storage/src/cpp/storage/columns/pax_delta_encoding.cc
+++ b/contrib/pax_storage/src/cpp/storage/columns/pax_delta_encoding.cc
@@ -454,7 +454,15 @@ size_t PaxDeltaDecoder<T>::Decoding() {
if (remaining < mini_blocks_per_block_) break;
+ // VLA-with-initializer is a GCC extension; clang rejects it. Keep
+ // the (zero-overhead) stack VLA on gcc and only fall back to a
+ // heap std::vector under clang so Linux gcc performance is
+ // unchanged.
+#if defined(__clang__)
+ std::vector<uint8_t> bit_widths(mini_blocks_per_block_, 0);
+#else
uint8_t bit_widths[mini_blocks_per_block_] = {0};
+#endif
for (uint32_t i = 0; i < mini_blocks_per_block_; ++i) {
bit_widths[i] = *p++;
--remaining;
diff --git a/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.cc b/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.cc
index 0b07d08ad19..f32e533c880 100644
--- a/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.cc
+++ b/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.cc
@@ -112,7 +112,7 @@ uint32 FindClosestBits(int64 value) {
return GetClosestBits(count);
}
-void BuildHistogram(int32 *histogram, int64_t *data, size_t number) {
+void BuildHistogram(int32 *histogram, int64 *data, size_t number) {
// histogram that store the encoded bit requirement for each values.
// maximum number of bits that can encoded is 32 (refer FixedBitSizes)
memset(histogram, 0, FixedBitSizes::kSIZE * sizeof(int32_t));
@@ -141,7 +141,7 @@ uint32_t GetPercentileBits(const int32 *const histogram, size_t histogram_len,
return 0;
}
-void ZigZagBuffers(int64_t *input, int64_t *output, size_t number) {
+void ZigZagBuffers(int64 *input, int64 *output, size_t number) {
Assert(input && output);
for (size_t i = 0; i < number; i++) {
output[i] = ZigZag(input[i]);
diff --git a/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.h b/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.h
index 596351a757a..0334939c528 100644
--- a/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.h
+++ b/contrib/pax_storage/src/cpp/storage/columns/pax_encoding_utils.h
@@ -114,7 +114,11 @@ uint32 GetClosestAlignedBits(uint32 n);
uint32 FindClosestBits(int64 value);
// histogram functions
-void BuildHistogram(int32 *histogram, int64_t *data, size_t number);
+// NB: use PG's int64 (typedef'd to `long int` on every supported port)
+// rather than C99 int64_t — on macOS x86_64 int64_t is `long long`, which
+// is a distinct type from `long` for overload resolution even though both
+// are 64-bit.
+void BuildHistogram(int32 *histogram, int64 *data, size_t number);
uint32_t GetPercentileBits(const int32 *histogram, size_t histogram_len,
double p);
@@ -154,6 +158,6 @@ inline int64 UnZigZagWithUnsigned(T value) {
CBDB_RAISE(cbdb::CException::ExType::kExTypeLogicError);
}
-void ZigZagBuffers(int64_t *input, int64_t *output, size_t number);
+void ZigZagBuffers(int64 *input, int64 *output, size_t number);
} // namespace pax
diff --git a/contrib/pax_storage/src/cpp/storage/file_system.h b/contrib/pax_storage/src/cpp/storage/file_system.h
index 6569ee3b858..09e13ed1245 100644
--- a/contrib/pax_storage/src/cpp/storage/file_system.h
+++ b/contrib/pax_storage/src/cpp/storage/file_system.h
@@ -28,11 +28,18 @@
#pragma once
#include <fcntl.h>
+#include <sys/types.h>
#include <functional>
#include <string>
#include <vector>
+// glibc exposes off64_t for 32-bit programs opting into 64-bit file
+// offsets. macOS's off_t is already 64-bit and there is no off64_t.
+#ifdef __APPLE__
+typedef off_t off64_t;
+#endif
+
#include "comm/common_io.h"
#include "comm/pax_memory.h"
diff --git a/contrib/pax_storage/src/cpp/storage/proto/proto_wrappers.h b/contrib/pax_storage/src/cpp/storage/proto/proto_wrappers.h
index d577353c40b..3e57167f334 100644
--- a/contrib/pax_storage/src/cpp/storage/proto/proto_wrappers.h
+++ b/contrib/pax_storage/src/cpp/storage/proto/proto_wrappers.h
@@ -29,7 +29,16 @@
// The libproto defined `FATAL` inside as a marco linker
#undef FATAL
+// PG defines several macros (Min/Max in c.h, IsPowerOf2 in xlog_internal.h)
+// whose names collide with abseil identifiers reached through protobuf
+// headers. Suppress while including, restore the PG definitions after.
+#undef Min
+#undef Max
+#undef IsPowerOf2
#include "storage/proto/micro_partition_stats.pb.h"
#include "storage/proto/orc_proto.pb.h"
#include "storage/proto/pax.pb.h"
#define FATAL 22
+#define Min(x, y) ((x) < (y) ? (x) : (y))
+#define Max(x, y) ((x) > (y) ? (x) : (y))
+#define IsPowerOf2(x) (x > 0 && ((x) & ((x)-1)) == 0)
diff --git a/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.cc b/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.cc
index d2aac0388f2..238ef5a9fc6 100644
--- a/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.cc
+++ b/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.cc
@@ -75,9 +75,9 @@ void BufferedOutputStream::BackUp(int count) {
}
}
-google::protobuf::int64 BufferedOutputStream::ByteCount() const {
+int64_t BufferedOutputStream::ByteCount() const {
Assert(data_buffer_);
- return static_cast<google::protobuf::int64>(data_buffer_->Used());
+ return static_cast<int64_t>(data_buffer_->Used());
}
bool BufferedOutputStream::WriteAliasedRaw(const void * /*data*/,
@@ -151,8 +151,8 @@ bool SeekableInputStream::Skip(int count) {
return false;
}
-google::protobuf::int64 SeekableInputStream::ByteCount() const {
- return static_cast<google::protobuf::int64>(data_buffer_.Used());
+int64_t SeekableInputStream::ByteCount() const {
+ return static_cast<int64_t>(data_buffer_.Used());
}
} // namespace pax
diff --git a/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.h b/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.h
index 81463ce6eb9..5769b3eeae3 100644
--- a/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.h
+++ b/contrib/pax_storage/src/cpp/storage/proto/protobuf_stream.h
@@ -44,7 +44,7 @@ class BufferedOutputStream : public google::protobuf::io::ZeroCopyOutputStream {
void BackUp(int count) override;
- google::protobuf::int64 ByteCount() const override;
+ int64_t ByteCount() const override;
bool WriteAliasedRaw(const void *data, int size) override;
@@ -76,7 +76,7 @@ class SeekableInputStream : public google::protobuf::io::ZeroCopyInputStream {
bool Skip(int count) override;
- google::protobuf::int64 ByteCount() const override;
+ int64_t ByteCount() const override;
private:
DataBuffer<char> data_buffer_;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 04/11: macOS: defer libpostgres.so's undefined symbols to load time
Posted by av...@apache.org.
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 d107ea4f017570d2fe71395f42d6cad52a840e8f
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 18:22:28 2026 +0800
macOS: defer libpostgres.so's undefined symbols to load time
With --enable-shared-postgres-backend (default) the libpostgres.so
recipe filters out main/main.o, but other backend objects still
reference symbols defined in main.o (progname, etc.). On Linux the
default linker behaviour permits undefined references in a shared
library; on macOS, ld -dynamiclib rejects them with 'Undefined
symbols ... _progname'.
Pass -Wl,-undefined,dynamic_lookup only when PORTNAME=darwin so those
symbols resolve at load time against the postgres executable that
loads libpostgres.so. The Linux behaviour is unchanged.
---
src/backend/Makefile | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 79dcdbb5ba3..675d97a6617 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -109,8 +109,18 @@ SYMBOL_MAPPING_FLAGS = -Wl,--version-script=$(SYMBOL_MAP_FILE)
endif
ifeq ($(enable_shared_postgres_backend),yes)
all: libpostgres.so
+
+# On macOS, main/main.o (providing `progname` and other globals) is filtered
+# out of libpostgres.so but is linked into the postgres executable. Tell ld
+# to defer those undefined symbols to load time (resolved when the postgres
+# binary loads libpostgres.so). Linux's ld allows undefined refs in shared
+# libs by default, so no flag needed there.
+ifeq ($(PORTNAME), darwin)
+LIBPOSTGRES_SO_LDFLAGS = -Wl,-undefined,dynamic_lookup
+endif
+
libpostgres.so: $(OBJS) $(SYMBOL_MAP_FILE)
- $(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_SL) $(export_dynamic) \
+ $(CXX) -shared $(CXXFLAGS) $(LDFLAGS) $(LDFLAGS_SL) $(LIBPOSTGRES_SO_LDFLAGS) $(export_dynamic) \
$(filter-out main/main.o, $(call expand_subsys,$(OBJS))) $(LIBS) $(SYMBOL_MAPPING_FLAGS) -o $@
# if enable-build-postgres-with-shared is yes, link postgres with shared library libpostgres.so
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 10/11: macOS: demote clang-strict warning categories in Makefile.custom
Posted by av...@apache.org.
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 e86bac6e66bb2dacc1cd8bf5479c9fb95939832d
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Fri May 29 19:01:37 2026 +0800
macOS: demote clang-strict warning categories in Makefile.custom
After this commit, plain 'make' (without any CUSTOM_COPT= on the
command line) builds cleanly on macOS with Apple clang. Previously
users had to remember a long override.
The warning categories that needed demoting (darwin only):
-Wuninitialized — clang flags spots upstream gcc accepts.
-Wgnu-variable-sized-type-not-at-end
— clang-only; fires on PG catalog headers
like pg_task.h with inline struct-plus-
trailing-text declarations.
-Wunused-function — clang flags static functions never
referenced in the TU (a few exist in
currently-disabled code paths, e.g.
ic_udpifc.c).
-Wdeprecated-non-prototype
— clang-only; flags K&R-style 'foo()'
forward declarations. Where the
mismatch is a real bug we fix it
inline; this demotion covers the rest.
The block is gated to PORTNAME=darwin so the Linux gcc build path
is unchanged: -Werror remains in effect for all categories there.
---
src/Makefile.custom | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/Makefile.custom b/src/Makefile.custom
index 5461d68afcf..e2d8f0f30e8 100644
--- a/src/Makefile.custom
+++ b/src/Makefile.custom
@@ -1 +1,34 @@
-CUSTOM_COPT += -Werror
\ No newline at end of file
+CUSTOM_COPT += -Werror
+
+# Apple clang is stricter than gcc on several warning categories that
+# upstream Cloudberry currently trips:
+#
+# -Wuninitialized
+# Fires on a few spots upstream that gcc happily accepts
+# (e.g. functions.c on PG 16).
+#
+# -Wgnu-variable-sized-type-not-at-end
+# Clang-only. Fires on PG catalog headers that put a
+# struct-with-trailing-text inline.
+#
+# -Wunused-function
+# Clang flags static functions never referenced anywhere in the
+# TU; gcc's analysis is sometimes laxer. Touches isolated dead
+# branches in a few subsystems (e.g. ic_udpifc.c).
+#
+# -Wdeprecated-non-prototype
+# Clang-only. Catches K&R-style `foo()` forward declarations
+# (genuine portability concerns that gcc silently accepts).
+# Where these turn out to be real bugs we fix them inline; the
+# demotion is here for the residual stylistic occurrences.
+#
+# Demote them to warnings on darwin so plain `make` works. The block
+# is gated to PORTNAME=darwin so the Linux gcc build path is unchanged
+# (-Werror still in effect for all categories there). -Wno-error= for
+# a category the active compiler doesn't emit is silently ignored.
+ifeq ($(PORTNAME),darwin)
+CUSTOM_COPT += -Wno-error=uninitialized
+CUSTOM_COPT += -Wno-error=gnu-variable-sized-type-not-at-end
+CUSTOM_COPT += -Wno-error=unused-function
+CUSTOM_COPT += -Wno-error=deprecated-non-prototype
+endif
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 02/11: macOS: provide HZ fallback for UDP interconnect
Posted by av...@apache.org.
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 4f58444f1d7772a70082b79dd29cb78af78fa0f1
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 18:22:28 2026 +0800
macOS: provide HZ fallback for UDP interconnect
ic_udpifc.c uses the HZ macro (kernel timer frequency) for RTO
calculations. On Linux glibc, HZ is exposed via <sys/param.h>
(typically 100). macOS's <sys/param.h> does not define HZ.
Define HZ=100 as a fallback when the platform headers don't provide
it. The exact value only affects retransmit pacing constants
(UDP_RTO_MIN, TIME_TICK); 100 matches the Linux default.
---
contrib/interconnect/udp/ic_udpifc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/contrib/interconnect/udp/ic_udpifc.c b/contrib/interconnect/udp/ic_udpifc.c
index d11e4577cd6..8e54be4c30d 100644
--- a/contrib/interconnect/udp/ic_udpifc.c
+++ b/contrib/interconnect/udp/ic_udpifc.c
@@ -131,6 +131,13 @@ WSAPoll(
#define SEC_TO_MSEC(t) ((t) * 1000)
#define MSEC_TO_USEC(t) ((t) * 1000)
#define USEC_TO_SEC(t) ((t) / 1000000)
+
+/* HZ is the kernel timer frequency. Linux defines it in <asm/param.h>
+ * (typically 100). macOS's sys/param.h does not, so provide a fallback. */
+#ifndef HZ
+#define HZ 100
+#endif
+
#define TIME_TICK (1000000/HZ)/* in us */
#define UDP_INITIAL_RTO (MSEC_TO_USEC(200))
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 01/11: macOS: make PAX's liburing dependency optional
Posted by av...@apache.org.
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 1854534a63fb5771e357a9c36d654e9d169cd749
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 18:21:59 2026 +0800
macOS: make PAX's liburing dependency optional
liburing is the Linux-only userspace API for the io_uring kernel
interface (Linux 5.1+). It is not available on macOS or *BSD.
PAX already has a sync fallback path (SyncFastIO using pread(2)) and
LocalFile::ReadBatch picks between the two via IOUringFastIO::available().
This commit lets the build proceed without liburing:
* configure: AC_CHECK_LIB(uring) no longer aborts when missing; PAX
falls back to SyncFastIO at runtime.
* fast_io.h / fast_io.cc: wrap the IOUringFastIO class declaration
and methods with #ifdef __linux__ so they only exist where the
header is available.
* local_file_system.cc: gate the IOUringFastIO::available() branch
with #ifdef __linux__; non-Linux unconditionally uses SyncFastIO.
---
configure | 11 ++++++++++-
configure.ac | 16 +++++++++++++---
contrib/pax_storage/src/cpp/comm/fast_io.cc | 2 ++
contrib/pax_storage/src/cpp/comm/fast_io.h | 11 +++++++++--
.../pax_storage/src/cpp/storage/local_file_system.cc | 18 +++++++++++-------
5 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/configure b/configure
index f873fb97d63..440b66d0f4c 100755
--- a/configure
+++ b/configure
@@ -9891,7 +9891,16 @@ _ACEOF
LIBS="-luring $LIBS"
else
- as_fn_error $? "library 'uring' is required for PAX support" "$LINENO" 5
+ # liburing is required on Linux (io_uring is a Linux 5.1+ kernel iface);
+ # on non-Linux hosts PAX falls back to pread-based SyncFastIO.
+ case $host_os in
+ linux*)
+ as_fn_error $? "library 'uring' is required for PAX support on Linux" "$LINENO" 5
+ ;;
+ *)
+ :
+ ;;
+ esac
fi
diff --git a/configure.ac b/configure.ac
index 175053baeab..dd259c4f07f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1035,9 +1035,19 @@ if test "$enable_pax" = yes; then
[AC_MSG_ERROR([libzstd >= 1.4.0 is required for PAX support])]
)
- # Check liburing
- AC_CHECK_LIB(uring, io_uring_queue_init, [],
- [AC_MSG_ERROR([library 'uring' is required for PAX support])])
+ # Check liburing. liburing is Linux-only (io_uring kernel iface, 5.1+).
+ # On Linux it is required as before; on non-Linux hosts (macOS / *BSD)
+ # PAX falls back to pread-based SyncFastIO and the IOUringFastIO path
+ # is conditionally compiled — see contrib/pax_storage/src/cpp/comm/fast_io.*
+ case $host_os in
+ linux*)
+ AC_CHECK_LIB(uring, io_uring_queue_init, [],
+ [AC_MSG_ERROR([library 'uring' is required for PAX support on Linux])])
+ ;;
+ *)
+ AC_CHECK_LIB(uring, io_uring_queue_init, [], [])
+ ;;
+ esac
# Check cmake >= 3.11.0 using AX_COMPARE_VERSION
AC_PATH_PROG([CMAKE], [cmake], [no])
diff --git a/contrib/pax_storage/src/cpp/comm/fast_io.cc b/contrib/pax_storage/src/cpp/comm/fast_io.cc
index c2dcd235541..808bfb26d73 100644
--- a/contrib/pax_storage/src/cpp/comm/fast_io.cc
+++ b/contrib/pax_storage/src/cpp/comm/fast_io.cc
@@ -41,6 +41,7 @@
namespace pax
{
+#ifdef __linux__
bool IOUringFastIO::available() {
static int8_t support_io_uring = 0;
@@ -110,6 +111,7 @@ std::pair<int, int> IOUringFastIO::read(int fd, std::vector<IORequest> &request,
}
return {retcode, success_read}; // Placeholder
}
+#endif // __linux__
std::pair<int, int> SyncFastIO::read(int fd, std::vector<IORequest> &request, std::vector<bool> &result) {
size_t total_requests = request.size();
diff --git a/contrib/pax_storage/src/cpp/comm/fast_io.h b/contrib/pax_storage/src/cpp/comm/fast_io.h
index da63b4d89ea..a7823d3bc9a 100644
--- a/contrib/pax_storage/src/cpp/comm/fast_io.h
+++ b/contrib/pax_storage/src/cpp/comm/fast_io.h
@@ -29,12 +29,17 @@
#include "comm/common_io.h"
-#include <liburing.h>
#include <cstddef>
#include <cstdio>
#include <algorithm>
#include <vector>
+/* liburing is Linux-only (io_uring kernel iface). On macOS / *BSD we
+ * compile only the SyncFastIO (pread-based) path. */
+#ifdef __linux__
+#include <liburing.h>
+#endif
+
namespace pax
{
@@ -56,7 +61,8 @@ public:
std::pair<int, int> read(int fd, std::vector<IORequest> &request, std::vector<bool> &result);
};
-// io_uring-based FastIO
+#ifdef __linux__
+// io_uring-based FastIO (Linux only).
class IOUringFastIO {
public:
IOUringFastIO(size_t queue_size = 128) {
@@ -84,5 +90,6 @@ private:
// 'u' for uninitialized, 'i' for initialized, 'x' for unsupported
char status_ = 'u';
};
+#endif // __linux__
} // namespace pax
\ No newline at end of file
diff --git a/contrib/pax_storage/src/cpp/storage/local_file_system.cc b/contrib/pax_storage/src/cpp/storage/local_file_system.cc
index 82afafbfcfd..712beb80643 100644
--- a/contrib/pax_storage/src/cpp/storage/local_file_system.cc
+++ b/contrib/pax_storage/src/cpp/storage/local_file_system.cc
@@ -137,6 +137,7 @@ ssize_t LocalFile::PWrite(const void *ptr, size_t n, off_t offset) {
void LocalFile::ReadBatch(const std::vector<IORequest> &requests) const {
if (unlikely(requests.empty())) return;
+#ifdef __linux__
if (IOUringFastIO::available()) {
IOUringFastIO fast_io(requests.size());
std::vector<bool> result(requests.size(), false);
@@ -144,14 +145,17 @@ void LocalFile::ReadBatch(const std::vector<IORequest> &requests) const {
CBDB_CHECK(res.first == 0, cbdb::CException::ExType::kExTypeIOError,
fmt("Fail to ReadBatch with io_uring [successful=%d, total=%lu], %s",
res.second, requests.size(), DebugString().c_str()));
- } else {
- SyncFastIO fast_io;
- std::vector<bool> result(requests.size(), false);
- auto res = fast_io.read(fd_, const_cast<std::vector<IORequest>&>(requests), result);
- CBDB_CHECK(res.first == 0, cbdb::CException::ExType::kExTypeIOError,
- fmt("Fail to ReadBatch with sync read [successful=%d, total=%lu], %s",
- res.second, requests.size(), DebugString().c_str()));
+ return;
}
+#endif
+
+ // Fallback: pread-based sync IO (non-Linux, or older kernel without io_uring).
+ SyncFastIO fast_io;
+ std::vector<bool> result(requests.size(), false);
+ auto res = fast_io.read(fd_, const_cast<std::vector<IORequest>&>(requests), result);
+ CBDB_CHECK(res.first == 0, cbdb::CException::ExType::kExTypeIOError,
+ fmt("Fail to ReadBatch with sync read [successful=%d, total=%lu], %s",
+ res.second, requests.size(), DebugString().c_str()));
}
size_t LocalFile::FileLength() const {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 03/11: Drop -Werror -Wextra -Wpedantic from ORCA C++ build
Posted by av...@apache.org.
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 8fa1a42335552d890914fd9f4f826d6155d29778
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Thu May 28 18:22:28 2026 +0800
Drop -Werror -Wextra -Wpedantic from ORCA C++ build
src/backend/gporca/gporca.mk forced -Werror -Wextra -Wpedantic on top
of the project CXXFLAGS via 'override CXXFLAGS := ...'. clang reports
many more warnings than gcc under -Wextra/-Wpedantic, which then
become errors and break the macOS build (unused-but-set-variable,
inconsistent-missing-override, ...).
Keep -fno-omit-frame-pointer (used by ORCA's backtracing); drop the
strict warning flags. The base project CXXFLAGS still includes -Wall
and per-feature -Werror= flags.
---
src/backend/gporca/gporca.mk | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/backend/gporca/gporca.mk b/src/backend/gporca/gporca.mk
index 5aa2c88887c..930e6f46e0b 100644
--- a/src/backend/gporca/gporca.mk
+++ b/src/backend/gporca/gporca.mk
@@ -4,7 +4,17 @@ override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libnaucrates/include $(C
override CPPFLAGS := -I$(top_srcdir)/src/backend/gporca/libgpdbcost/include $(CPPFLAGS)
# Do not omit frame pointer. Even with RELEASE builds, it is used for
# backtracing.
+# Linux gcc tolerates -Werror -Wextra -Wpedantic on ORCA; Apple clang
+# emits many more diagnostics under the same flags (unused-but-set,
+# inconsistent-missing-override, mismatched-tags, ...) and breaks the
+# build with no real safety benefit (per-feature -Werror= flags in the
+# base CXXFLAGS still catch real bugs). Keep the strict triple on
+# Linux, drop it on darwin.
+ifeq ($(PORTNAME), darwin)
+override CXXFLAGS := -fno-omit-frame-pointer $(CXXFLAGS)
+else
override CXXFLAGS := -Werror -Wextra -Wpedantic -fno-omit-frame-pointer $(CXXFLAGS)
+endif
# orca is not accessed in JIT (executor stage), avoid the generation of .bc here
# NOTE: accordingly we MUST avoid them in install step (install-postgres-bitcode
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org
(cloudberry) 11/11: ic_udpifc: fix initSndBufferPool forward declaration
Posted by av...@apache.org.
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 344bac8fa420f31ad9e5749f7b00fd0431ae7b73
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Fri May 29 19:06:48 2026 +0800
ic_udpifc: fix initSndBufferPool forward declaration
The forward declaration at line 838 was
static void initSndBufferPool();
which under C's old K&R rules means 'function with unspecified
arguments' — but the actual definition takes a SendBufferPool *:
static void
initSndBufferPool(SendBufferPool *p)
and the single caller at line 3677 passes &snd_buffer_pool. gcc
silently accepts the mismatch; Apple clang correctly rejects it
under -Wdeprecated-non-prototype. C2x will reject it on every
compiler. Match the forward declaration to the definition.
---
contrib/interconnect/udp/ic_udpifc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/interconnect/udp/ic_udpifc.c b/contrib/interconnect/udp/ic_udpifc.c
index 8e54be4c30d..be14218f168 100644
--- a/contrib/interconnect/udp/ic_udpifc.c
+++ b/contrib/interconnect/udp/ic_udpifc.c
@@ -835,7 +835,7 @@ static void sendOnce(ChunkTransportState *transportStates, ChunkTransportStateEn
static inline uint64 computeExpirationPeriod(MotionConn *conn, uint32 retry);
static ICBuffer *getSndBuffer(MotionConn *conn);
-static void initSndBufferPool();
+static void initSndBufferPool(SendBufferPool *p);
static void putIntoUnackQueueRing(UnackQueueRing *uqr, ICBuffer *buf, uint64 expTime, uint64 now);
static void initUnackQueueRing(UnackQueueRing *uqr);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org