From 09791177a2be5b330ee4b1d098ea9ad98c20cba0 Mon Sep 17 00:00:00 2001 From: Elizabeth Murray Date: Tue, 17 Jun 2025 08:39:47 -0700 Subject: [PATCH] Build changes to make communicator build on macos. --- pgxn/neon/Makefile | 1 + pgxn/neon/communicator/Cargo.toml | 7 +++++++ pgxn/neon/communicator/build.rs | 4 ++++ pgxn/neon/communicator_new.c | 4 ++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pgxn/neon/Makefile b/pgxn/neon/Makefile index 8216b7b355..bad96a2ab8 100644 --- a/pgxn/neon/Makefile +++ b/pgxn/neon/Makefile @@ -28,6 +28,7 @@ OBJS = \ PG_CPPFLAGS = -I$(libpq_srcdir) SHLIB_LINK_INTERNAL = $(libpq) SHLIB_LINK = -lcurl +SHLIB_LINK += -framework Security -framework CoreFoundation -framework CoreServices -framework IOKit -framework SystemConfiguration EXTENSION = neon DATA = \ diff --git a/pgxn/neon/communicator/Cargo.toml b/pgxn/neon/communicator/Cargo.toml index d40c9a66a3..fae04ccc38 100644 --- a/pgxn/neon/communicator/Cargo.toml +++ b/pgxn/neon/communicator/Cargo.toml @@ -37,3 +37,10 @@ utils.workspace = true [build-dependencies] cbindgen.workspace = true + +[target.'cfg(target_os = "macos")'] +rustflags = [ + "-l", "framework=Security", + "-l", "framework=CoreFoundation", + "-l", "framework=CoreServices", +] diff --git a/pgxn/neon/communicator/build.rs b/pgxn/neon/communicator/build.rs index ef570c3d0a..a05e912132 100644 --- a/pgxn/neon/communicator/build.rs +++ b/pgxn/neon/communicator/build.rs @@ -2,6 +2,10 @@ use std::env; fn main() -> Result<(), Box> { let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); + println!("cargo:rustc-link-lib=framework=Security"); + println!("cargo:rustc-link-lib=framework=CoreFoundation"); + println!("cargo:rustc-link-lib=framework=CoreServices"); + println!("cargo:rustc-link-lib=framework=IOKit"); cbindgen::generate(crate_dir).map_or_else( |error| match error { diff --git a/pgxn/neon/communicator_new.c b/pgxn/neon/communicator_new.c index 1b31909bb1..e908762a6d 100644 --- a/pgxn/neon/communicator_new.c +++ b/pgxn/neon/communicator_new.c @@ -342,7 +342,7 @@ callback_set_my_latch_unsafe(void) * FIXME: The logic from neon_get_request_lsns() needs to go here, except for * the last-written LSN cache stuff, which is managed by the rust code now. */ -uint64 +uint64_t callback_get_request_lsn_unsafe(void) { /* @@ -659,7 +659,7 @@ retry: ereport(ERROR, (errcode_for_file_access(), errmsg("could not read block %lu in local cache file: %m", - cached_block))); + (unsigned long)cached_block))); bytes_total += nbytes; } }