This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new d9c1881706 GH-47961: [C++] Fix Meson's Boost process version detection 
(#48017)
d9c1881706 is described below

commit d9c188170638610cc49929e9490d52c9276ab9f9
Author: William Ayd <[email protected]>
AuthorDate: Mon Nov 3 22:09:42 2025 -0500

    GH-47961: [C++] Fix Meson's Boost process version detection (#48017)
    
    ### Rationale for this change
    
    Meson is missing some defines that offer compatibility for different boost 
versions
    
    ### What changes are included in this PR?
    
    The Meson configuration is updated to include required boost defines
    
    ### Are these changes tested?
    
    Yes
    
    ### Are there any user-facing changes?
    
    No
    * GitHub Issue: #47961
    
    Authored-by: Will Ayd <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/src/arrow/meson.build | 45 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/cpp/src/arrow/meson.build b/cpp/src/arrow/meson.build
index 703d5976ae..8887da9174 100644
--- a/cpp/src/arrow/meson.build
+++ b/cpp/src/arrow/meson.build
@@ -623,22 +623,55 @@ if needs_testing
         modules: ['filesystem'],
         required: false,
     )
-    if not filesystem_dep.found()
+    base_process_dep = dependency('boost', modules: ['process'], required: 
false)
+
+    if not (filesystem_dep.found() and base_process_dep.found())
         cmake = import('cmake')
         boost_opt = cmake.subproject_options()
         boost_opt.add_cmake_defines(
-            {'BOOST_INCLUDE_LIBRARIES': 'filesystem;system'},
+            {'BOOST_INCLUDE_LIBRARIES': 'filesystem;process'},
         )
+        if get_option('default_library') != 'static'
+            boost_opt.add_cmake_defines({'BUILD_SHARED_LIBS': 'ON'})
+        endif
         boost_proj = cmake.subproject('boost', options: boost_opt)
         filesystem_dep = boost_proj.dependency('boost_filesystem')
+        base_process_dep = boost_proj.dependency('boost_process')
+    endif
+
+    boost_process_have_v2 = false
+    process_compile_args = []
+    if base_process_dep.version() >= '1.86'
+        process_compile_args += [
+            '-DBOOST_PROCESS_HAVE_V1',
+            '-DBOOST_PROCESS_HAVE_V2',
+        ]
+        boost_process_have_v2 = true
+    elif base_process_dep.version() >= '1.80'
+        process_compile_args += ['-DBOOST_PROCESS_HAVE_V2']
+        boost_process_have_v2 = true
     endif
 
+    if (boost_process_have_v2 and host_machine.system() != 'windows')
+        # We can't use v2 API on Windows because v2 API doesn't support
+        # process group[1] and GCS testbench uses multiple processes[2].
+        #
+        # [1] https://github.com/boostorg/process/issues/259
+        # [2] https://github.com/googleapis/storage-testbench/issues/669
+        process_compile_args += ['-DBOOST_PROCESS_USE_V2']
+    endif
+    process_dep = declare_dependency(
+        dependencies: [base_process_dep],
+        compile_args: process_compile_args,
+    )
+
     gtest_dep = dependency('gtest')
     gtest_main_dep = dependency('gtest_main')
     gtest_dep = dependency('gtest')
     gmock_dep = dependency('gmock')
 else
     filesystem_dep = disabler()
+    process_dep = disabler()
     gtest_dep = disabler()
     gtest_main_dep = disabler()
     gtest_dep = disabler()
@@ -649,7 +682,13 @@ if needs_testing
     arrow_testing_lib = static_library(
         'arrow_testing',
         sources: arrow_testing_srcs,
-        dependencies: [arrow_dep, filesystem_dep, gmock_dep, gtest_dep],
+        dependencies: [
+            arrow_dep,
+            process_dep,
+            filesystem_dep,
+            gmock_dep,
+            gtest_dep,
+        ],
     )
 
     arrow_testing_dep = declare_dependency(link_with: [arrow_testing_lib])

Reply via email to