Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9158e4b

Browse files
committed
meson: macos: Avoid warnings on Sonoma
Starting with the Sonoma toolchain macos' linker emits warnings when the same library is linked to twice. That's ill considered, as the same library can be used by multiple subsidiary libraries. Luckily there's a flag to suppress that warning. On Ventura meson's default of -Wl,-undefined,dynamic_lookup caused warnings, which we suppressed with -Wl,-undefined,error. Unfortunately that causes a warning on Sonoma, which is absurd, as it's documented linker default. To avoid that warning, only add -Wl,-undefined,error if it does not trigger warnings. Luckily dynamic_lookup doesn't trigger a warning on Sonoma anymore. Discussion: https://postgr.es/m/20231201040515.p5bshhhtfru7d3da@awork3.anarazel.de Backpatch: 16-, where the meson build was added
1 parent 40d1bde commit 9158e4b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

meson.build

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,20 @@ elif host_system == 'darwin'
237237
cflags += ['-isysroot', pg_sysroot]
238238
ldflags += ['-isysroot', pg_sysroot]
239239
endif
240+
240241
# meson defaults to -Wl,-undefined,dynamic_lookup for modules, which we
241242
# don't want because a) it's different from what we do for autoconf, b) it
242-
# causes warnings starting in macOS Ventura
243-
ldflags_mod += ['-Wl,-undefined,error']
243+
# causes warnings in macOS Ventura. But using -Wl,-undefined,error causes a
244+
# warning starting in Sonoma. So only add -Wl,-undefined,error if it does
245+
# not cause a warning.
246+
if cc.has_multi_link_arguments('-Wl,-undefined,error', '-Werror')
247+
ldflags_mod += '-Wl,-undefined,error'
248+
endif
249+
250+
# Starting in Sonoma, the linker warns about the same library being
251+
# linked twice. Which can easily happen when multiple dependencies
252+
# depend on the same library. Quiesce the ill considered warning.
253+
ldflags += cc.get_supported_link_arguments('-Wl,-no_warn_duplicate_libraries')
244254

245255
elif host_system == 'freebsd'
246256
sema_kind = 'unnamed_posix'

0 commit comments

Comments
 (0)