Skip to content

Commit 25fe161

Browse files
committed
fix(ci): resolve PostgreSQL extension build failures on macOS and Windows
macOS: install gettext for libintl.h and pass include path via PG_EXTRA_CFLAGS. Windows: skip POSIX defines (_POSIX_C_SOURCE, _GNU_SOURCE) so PG headers use Winsock instead of netinet/in.h.
1 parent e2e9f8e commit 25fe161

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ jobs:
305305
306306
- name: macos install postgresql
307307
if: matrix.name == 'macos'
308-
run: brew install postgresql@17
308+
run: brew install postgresql@17 gettext
309309

310310
- uses: msys2/setup-msys2@v2.27.0
311311
if: matrix.name == 'windows'
@@ -319,7 +319,7 @@ jobs:
319319

320320
- name: build and package postgresql extension (macos)
321321
if: matrix.name == 'macos'
322-
run: make postgres-package PG_CONFIG=$(brew --prefix postgresql@17)/bin/pg_config
322+
run: make postgres-package PG_CONFIG=$(brew --prefix postgresql@17)/bin/pg_config PG_EXTRA_CFLAGS="-I$(brew --prefix gettext)/include"
323323

324324
- name: build and package postgresql extension (windows)
325325
if: matrix.name == 'windows'

docker/Makefile.postgresql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ PG_OBJS = $(PG_ALL_SRC:.c=.o)
4848

4949
# Compiler flags
5050
# Define POSIX macros as compiler flags to ensure they're defined before any includes
51-
PG_CPPFLAGS = -I$(PG_INCLUDEDIR) -Isrc -Isrc/postgresql -Imodules/fractional-indexing -DCLOUDSYNC_POSTGRESQL_BUILD -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE
51+
# On Windows, skip POSIX defines — PG headers use Winsock instead of netinet/in.h
52+
PG_EXTRA_CFLAGS ?=
53+
PG_CPPFLAGS = -I$(PG_INCLUDEDIR) -Isrc -Isrc/postgresql -Imodules/fractional-indexing -DCLOUDSYNC_POSTGRESQL_BUILD $(PG_EXTRA_CFLAGS)
54+
ifneq ($(OS),Windows_NT)
55+
PG_CPPFLAGS += -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE
56+
endif
5257
PG_DEBUG ?= 0
5358
ifeq ($(PG_DEBUG),1)
5459
ifeq ($(OS),Windows_NT)

0 commit comments

Comments
 (0)