Hi,

Right now, many features are set to auto in Meson builds in CI. This
means Meson tries to detect these features automatically but does not
report an error if it fails to find them. Jacob stated [1] that this
behavior can lead to issues, such as missing problems in the build
system. Additionally, since CI images are updated automatically, an
update could cause a feature to go missing without any warning.
Therefore, Jacob suggested explicitly enabling these features in the
Meson build configuration. The attached patch implements this change.

I manually checked features from the end of the 'meson setup'
command's output in each task and stored these enabled features in the
MESON_FEATURES variable. I think this should be enough but of course
an automated way would be better if there is any.

One thing I’m unsure about the patch is that all these features are
stored in the MESON_FEATURES environment variable in each task. I
wonder if it might be clearer to rename these variables to
${TASK_NAME}_MESON_FEATURES to avoid confusion.

Also, libcurl is disabled in the OpenBSD CI task until the fix in this
thread [1] is committed.

Any feedback would be appreciated.

[1] 
https://www.postgresql.org/message-id/CAOYmi%2BkdR218ke2zu74oTJvzYJcqV1MN5%3DmGAPqZQuc79HMSVA%40mail.gmail.com

-- 
Regards,
Nazir Bilal Yavuz
Microsoft
From 081b43e34d5247d8d9b10498473bb6d440f0008c Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavu...@gmail.com>
Date: Wed, 25 Jun 2025 11:14:26 +0300
Subject: [PATCH v1] ci: meson: Explicitly enable meson features

By default, Meson silently disables features it cannot detect, which can
lead to incomplete builds. Explicitly enabling these features causes the
build to fail if they are missing, making such issues visible early.

Please note that, libcurl is disabled for OpenBSD until the fix in the
https://www.postgresql.org/message-id/CAOYmi%2BkdR218ke2zu74oTJvzYJcqV1MN5%3DmGAPqZQuc79HMSVA%40mail.gmail.com
is committed.

Suggested-by: Jacob Champion <jacob.champ...@enterprisedb.com>
---
 .cirrus.tasks.yml | 198 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 180 insertions(+), 18 deletions(-)

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 92057006c93..2413ac77e2e 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -164,6 +164,30 @@ task:
       -c debug_parallel_query=regress
     PG_TEST_PG_UPGRADE_MODE: --link
 
+    MESON_FEATURES: >-
+      -Dauto_features=disabled
+      -Ddocs=enabled
+      -Ddtrace=enabled
+      -Dgssapi=enabled
+      -Dicu=enabled
+      -Dldap=enabled
+      -Dlibcurl=enabled
+      -Dlibxml=enabled
+      -Dlibxslt=enabled
+      -Dlz4=enabled
+      -Dnls=enabled
+      -Dssl=openssl
+      -Dtap_tests=enabled
+      -Dpam=enabled
+      -Dplperl=enabled
+      -Dplpython=enabled
+      -Dtcl_version=tcl86
+      -Dpltcl=enabled
+      -Dreadline=enabled
+      -Duuid=bsd
+      -Dzlib=enabled
+      -Dzstd=enabled
+
   <<: *freebsd_task_template
 
   depends_on: SanityCheck
@@ -198,7 +222,7 @@ task:
       meson setup \
         --buildtype=debug \
         -Dcassert=true -Dinjection_points=true \
-        -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto \
+        ${MESON_FEATURES} \
         -Dextra_lib_dirs=/usr/local/lib -Dextra_include_dirs=/usr/local/include/ \
         build
     EOF
@@ -267,8 +291,30 @@ task:
         # See https://postgr.es/m/2490325.1734471752%40sss.pgh.pa.us
         LANG: "C"
         LC_ALL: "C"
+
         # -Duuid is not set for the NetBSD, see the comment below, above
         # configure_script, for more information.
+        MESON_FEATURES: >-
+          -Dauto_features=disabled
+          -Ddocs=enabled
+          -Dgssapi=enabled
+          -Dicu=enabled
+          -Dldap=enabled
+          -Dlibcurl=enabled
+          -Dlibxml=enabled
+          -Dlibxslt=enabled
+          -Dlz4=enabled
+          -Dnls=enabled
+          -Dssl=openssl
+          -Dtap_tests=enabled
+          -Dpam=enabled
+          -Dplperl=enabled
+          -Dplpython=enabled
+          -Dpltcl=enabled
+          -Dreadline=enabled
+          -Dzlib=enabled
+          -Dzstd=enabled
+
       setup_additional_packages_script: |
         #pkgin -y install ...
       <<: *netbsd_task_template
@@ -279,8 +325,31 @@ task:
         OS_NAME: openbsd
         IMAGE_FAMILY: pg-ci-openbsd-postgres
         PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/local/lib/pkgconfig'
-        UUID: -Duuid=e2fs
-        TCL: -Dtcl_version=tcl86
+
+        # libcurl is disabled until the fix in the
+        # https://www.postgresql.org/message-id/CAOYmi%2BkdR218ke2zu74oTJvzYJcqV1MN5%3DmGAPqZQuc79HMSVA%40mail.gmail.com
+        # is committed.
+        MESON_FEATURES: >-
+          -Dauto_features=disabled
+          -Dbsd_auth=enabled
+          -Ddocs=enabled
+          -Dicu=enabled
+          -Dldap=enabled
+          -Dlibcurl=disabled
+          -Dlibxml=enabled
+          -Dlibxslt=enabled
+          -Dlz4=enabled
+          -Dssl=openssl
+          -Dtap_tests=enabled
+          -Dplperl=enabled
+          -Dplpython=enabled
+          -Dtcl_version=tcl86
+          -Dpltcl=enabled
+          -Dreadline=enabled
+          -Duuid=e2fs
+          -Dzlib=enabled
+          -Dzstd=enabled
+
       setup_additional_packages_script: |
         #pkg_add -I ...
       # Always core dump to ${CORE_DUMP_DIR}
@@ -317,7 +386,7 @@ task:
         --buildtype=debugoptimized \
         --pkg-config-path ${PKGCONFIG_PATH} \
         -Dcassert=true -Dinjection_points=true \
-        -Dssl=openssl ${UUID} ${TCL} \
+        ${MESON_FEATURES} \
         -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
         build
     EOF
@@ -365,10 +434,6 @@ LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
   --with-uuid=ossp
   --with-zstd
 
-LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
-  -Dllvm=enabled
-  -Duuid=e2fs
-
 
 # Check SPECIAL in the matrix: below
 task:
@@ -409,7 +474,6 @@ task:
     LLVM_CONFIG: llvm-config-16
 
     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
-    LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
 
   <<: *linux_task_template
 
@@ -503,12 +567,66 @@ task:
         PG_TEST_INITDB_EXTRA_OPTS: >-
           -c io_method=io_uring
 
+        LINUX_64_MESON_FEATURES: >-
+          -Dauto_features=disabled
+          -Ddocs=enabled
+          -Ddocs_pdf=enabled
+          -Dgssapi=enabled
+          -Dicu=enabled
+          -Dldap=enabled
+          -Dlibcurl=enabled
+          -Dlibnuma=enabled
+          -Dliburing=enabled
+          -Dlibxml=enabled
+          -Dlibxslt=enabled
+          -Dllvm=enabled
+          -Dlz4=enabled
+          -Dnls=enabled
+          -Dssl=openssl
+          -Dtap_tests=enabled
+          -Dpam=enabled
+          -Dplperl=enabled
+          -Dplpython=enabled
+          -Dpltcl=enabled
+          -Dreadline=enabled
+          -Dselinux=enabled
+          -Dsystemd=enabled
+          -Duuid=e2fs
+          -Dzlib=enabled
+          -Dzstd=enabled
+
+        LINUX_32_MESON_FEATURES: >-
+          -Dauto_features=disabled
+          -Ddocs=enabled
+          -Ddocs_pdf=enabled
+          -Dgssapi=enabled
+          -Dicu=enabled
+          -Dldap=enabled
+          -Dlibcurl=enabled
+          -Dliburing=enabled
+          -Dlibxml=enabled
+          -Dlibxslt=enabled
+          -Dlz4=enabled
+          -Dnls=enabled
+          -Dssl=openssl
+          -Dtap_tests=enabled
+          -Dpam=enabled
+          -Dplperl=enabled
+          -Dplpython=enabled
+          -Dpltcl=enabled
+          -Dreadline=enabled
+          -Dselinux=enabled
+          -Dsystemd=enabled
+          -Duuid=e2fs
+          -Dzlib=enabled
+          -Dzstd=enabled
+
       configure_script: |
         su postgres <<-EOF
           meson setup \
             --buildtype=debug \
             -Dcassert=true -Dinjection_points=true \
-            ${LINUX_MESON_FEATURES} \
+            ${LINUX_64_MESON_FEATURES} \
             build
         EOF
 
@@ -520,11 +638,9 @@ task:
           meson setup \
             --buildtype=debug \
             -Dcassert=true -Dinjection_points=true \
-            ${LINUX_MESON_FEATURES} \
-            -Dllvm=disabled \
+            ${LINUX_32_MESON_FEATURES} \
             --pkg-config-path /usr/lib/i386-linux-gnu/pkgconfig/ \
             -DPERL=perl5.36-i386-linux-gnu \
-            -Dlibnuma=disabled \
             build-32
         EOF
 
@@ -588,6 +704,29 @@ task:
     CCACHE_DIR: ${HOME}/ccache
     MACPORTS_CACHE: ${HOME}/macports-cache
 
+    MESON_FEATURES: >-
+      -Dauto_features=disabled
+      -Dbonjour=enabled
+      -Ddtrace=enabled
+      -Ddocs=enabled
+      -Dgssapi=enabled
+      -Dicu=enabled
+      -Dldap=enabled
+      -Dlibcurl=enabled
+      -Dlibxml=enabled
+      -Dlibxslt=enabled
+      -Dlz4=enabled
+      -Dnls=enabled
+      -Dssl=openssl
+      -Dtap_tests=enabled
+      -Dplperl=enabled
+      -Dplpython=enabled
+      -Dpltcl=enabled
+      -Dreadline=enabled
+      -Duuid=e2fs
+      -Dzlib=enabled
+      -Dzstd=enabled
+
     MACOS_PACKAGE_LIST: >-
       ccache
       icu
@@ -661,7 +800,7 @@ task:
       -Dextra_include_dirs=/opt/local/include \
       -Dextra_lib_dirs=/opt/local/lib \
       -Dcassert=true -Dinjection_points=true \
-      -Duuid=e2fs -Ddtrace=auto \
+      ${MESON_FEATURES} \
       build
 
   build_script: ninja -C build -j${BUILD_JOBS} ${MBUILD_TARGET}
@@ -707,6 +846,14 @@ task:
   env:
     TEST_JOBS: 8 # wild guess, data based value welcome
 
+    MESON_FEATURES: >-
+      -Dauto_features=disabled
+      -Dldap=enabled
+      -Dssl=openssl
+      -Dtap_tests=enabled
+      -Dplperl=enabled
+      -Dplpython=enabled
+
     # Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That
     # prevents crash reporting from working unless binaries do SetErrorMode()
     # themselves. Furthermore, it appears that either python or, more likely,
@@ -733,7 +880,7 @@ task:
   # Use /DEBUG:FASTLINK to avoid high memory usage during linking
   configure_script: |
     vcvarsall x64
-    meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Dinjection_points=true -Db_pch=true -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% build
+    meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Dinjection_points=true -Db_pch=true -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=%TAR% %MESON_FEATURES% build
 
   build_script: |
     vcvarsall x64
@@ -777,6 +924,23 @@ task:
     CHERE_INVOKING: 1
     BASH: C:\msys64\usr\bin\bash.exe -l
 
+    MESON_FEATURES: >-
+      -Dauto_features=disabled
+      -Ddocs=enabled
+      -Dicu=enabled
+      -Dldap=enabled
+      -Dlibxml=enabled
+      -Dlibxslt=enabled
+      -Dlz4=enabled
+      -Dssl=openssl
+      -Dtap_tests=enabled
+      -Dplperl=enabled
+      -Dplpython=enabled
+      -Dpltcl=enabled
+      -Dreadline=enabled
+      -Dzlib=enabled
+      -Dzstd=enabled
+
   <<: *windows_task_template
 
   ccache_cache:
@@ -793,7 +957,7 @@ task:
 
   # disable -Dnls as the number of files it creates cause a noticable slowdown
   configure_script: |
-    %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Dinjection_points=true -Db_pch=true -Dnls=disabled -DTAR=%TAR% build"
+    %BASH% -c "meson setup -Ddebug=true -Doptimization=g -Dcassert=true -Dinjection_points=true -Db_pch=true %MESON_FEATURES% -DTAR=%TAR% build"
 
   build_script: |
     %BASH% -c "ninja -C build ${MBUILD_TARGET}"
@@ -831,8 +995,6 @@ task:
     CCACHE_DIR: "/tmp/ccache_dir"
 
     LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
-    LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
-
     # GCC emits a warning for llvm-14, so switch to a newer one.
     LLVM_CONFIG: llvm-config-16
 
-- 
2.49.0

Reply via email to