Hi I had recently updated the M1 mini that I use to test macOS stuff on. Just tried to test a change on it and was greeted with a lot of warnings. Apparently the update brought in a newer SDK (MacOSX13.0.sdk), even though the OS is still Monterey.
One class of warnings is specific to meson (see further down), but the other is common between autoconf and meson: [24/2258] Compiling C object src/port/libpgport_srv.a.p/snprintf.c.o ../../../src/postgres/src/port/snprintf.c:1002:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] vallen = sprintf(convert, "%p", value); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) ^ the same warning is repeated for a bunch of different lines in the same file, and then over the three versions of libpgport that we build. This is pretty noisy. The meson specific warning is [972/1027] Linking target src/backend/replication/libpqwalreceiver/libpqwalreceiver.dylib ld: warning: -undefined dynamic_lookup may not work with chained fixups Which is caused by meson defaulting to -Wl,-undefined,dynamic_lookup for modules. But we don't need that because we use -bund-loader. Adding -Wl,-undefined,error as in the attached fixes it. Greetings, Andres Freund
>From 11411bd2dce8d13bb74371d850b1f707b1dd8a01 Mon Sep 17 00:00:00 2001 From: Andres Freund <and...@anarazel.de> Date: Sat, 15 Oct 2022 14:02:35 -0700 Subject: [PATCH v1] meson: macos: Use -Wl,-undefined,error for modules meson defaults to -Wl,-undefined,dynamic_lookup for modules, which we don't want because a) it's different from what we do for autoconf, b) it causes warnings starting in macOS Ventura when combined with -bundle_loader. ci-os-only: macos Author: Reviewed-by: Discussion: https://postgr.es/m/ Backpatch: --- meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meson.build b/meson.build index fdf8ec8ad9c..f288f0a5fc7 100644 --- a/meson.build +++ b/meson.build @@ -228,6 +228,11 @@ elif host_system == 'darwin' message('darwin sysroot: @0@'.format(pg_sysroot)) cflags += ['-isysroot', pg_sysroot] ldflags += ['-isysroot', pg_sysroot] + # meson defaults to -Wl,-undefined,dynamic_lookup for modules, which we + # don't want because a) it's different from what we do for autoconf, b) it + # causes warnings starting in macOS Ventura when combined with + # -bundle_loader + ldflags_mod += ['-Wl,-undefined,error'] elif host_system == 'freebsd' sema_kind = 'unnamed_posix' -- 2.38.0