From 64cc70f05bb5874802192800e5c8af04b1a1df79 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 28 Sep 2023 08:21:18 -0700 Subject: [PATCH v3] meson: Improve Sonoma compability Still triggers a bunch of "ld: warning: -undefined error is deprecated", but fewer than before. There should not be any "ld: warning: ignoring duplicate libraries:" warnings anymore. ci-os-only: macos --- meson.build | 14 ++++++++++++-- .cirrus.tasks.yml | 13 ++++++++++--- src/tools/ci/ci_macports_packages.sh | 8 +++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 0f2c76ec25e..eab7b6e722d 100644 --- a/meson.build +++ b/meson.build @@ -237,10 +237,20 @@ elif host_system == 'darwin' cflags += ['-isysroot', pg_sysroot] ldflags += ['-isysroot', pg_sysroot] endif + # 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 - ldflags_mod += ['-Wl,-undefined,error'] + # causes warnings in macOS Ventura. But using -Wl,-undefined,error causes a + # warning starting in Sonoma. So only add -Wl,-undefined,error if it does + # not cause a warning. + if cc.has_multi_link_arguments('-Wl,-undefined,error', '-Werror') + ldflags_mod += '-Wl,-undefined,error' + endif + + # Starting in Sonoma, the linker warns about the same library being + # linked twice. Which can easily happen when multiple dependencies + # depend on the same library. Quiesce the ill considered warning. + ldflags += cc.get_supported_link_arguments('-Wl,-no_warn_duplicate_libraries') elif host_system == 'freebsd' sema_kind = 'unnamed_posix' diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index e137769850d..21ee53b9c2f 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -410,8 +410,6 @@ task: task: - name: macOS - Ventura - Meson - env: CPUS: 4 # always get that much for cirrusci macOS instances BUILD_JOBS: $CPUS @@ -419,7 +417,6 @@ task: # work OK. See # https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de TEST_JOBS: 8 - IMAGE: ghcr.io/cirruslabs/macos-ventura-base:latest CIRRUS_WORKING_DIR: ${HOME}/pgsql/ CCACHE_DIR: ${HOME}/ccache @@ -430,6 +427,16 @@ task: CFLAGS: -Og -ggdb CXXFLAGS: -Og -ggdb + + matrix: + - name: macOS - Sonoma - Meson + env: + IMAGE: ghcr.io/cirruslabs/macos-sonoma-base:latest + + - name: macOS - Ventura - Meson + env: + IMAGE: ghcr.io/cirruslabs/macos-ventura-base:latest + <<: *macos_task_template depends_on: SanityCheck diff --git a/src/tools/ci/ci_macports_packages.sh b/src/tools/ci/ci_macports_packages.sh index 4bc594a31d1..3161ea08ad3 100755 --- a/src/tools/ci/ci_macports_packages.sh +++ b/src/tools/ci/ci_macports_packages.sh @@ -13,7 +13,13 @@ set -e packages="$@" -macports_url="https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-13-Ventura.pkg" +macos_ver=$(sw_vers -productVersion | sed 's/\.//g') +if [ $macos_ver -ge 1400 ]; then + macports_url="https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-14-Sonoma.pkg" +else + macports_url="https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-13-Ventura.pkg" +fi + cache_dmg="macports.hfs.dmg" if [ "$CIRRUS_CI" != "true" ]; then -- 2.38.0