You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by as...@apache.org on 2024/01/17 02:20:03 UTC

(arrow) 02/02: GH-39628: [C++] Use -j1 for cmake >= 3.28 (#39629)

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

assignuser pushed a commit to branch maint-14.0.2-cran
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit 4a239b6d18bc061e01d0e18a9583d686c6112675
Author: Jacob Wujciak-Jens <ja...@wujciak.de>
AuthorDate: Tue Jan 16 17:04:15 2024 +0100

    GH-39628: [C++] Use -j1 for cmake >= 3.28 (#39629)
    
    ### Rationale for this change
    
    Prevent 'bad file descriptor' issue.
    
    ### What changes are included in this PR?
    
    Use -j1 for make on CMake >= 3.28
    
    ### Are these changes tested?
    Crossbow
    * Closes: #39628
    
    Authored-by: Jacob Wujciak-Jens <ja...@wujciak.de>
    Signed-off-by: Jacob Wujciak-Jens <ja...@wujciak.de>
---
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index dd2742833b..5a8397c782 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -994,8 +994,13 @@ if("${MAKE}" STREQUAL "")
   endif()
 endif()
 
-# Args for external projects using make.
-set(MAKE_BUILD_ARGS "-j${NPROC}")
+# Args for external projects using make
+if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.28")
+  # Prevent 'bad file descriptor' error see #39517 #39628
+  set(MAKE_BUILD_ARGS "-j1")
+else()
+  set(MAKE_BUILD_ARGS "-j${NPROC}")
+endif()
 
 include(FetchContent)
 
@@ -2616,7 +2621,7 @@ macro(build_bzip2)
                       BUILD_IN_SOURCE 1
                       BUILD_COMMAND ${MAKE} libbz2.a ${MAKE_BUILD_ARGS}
                                     ${BZIP2_EXTRA_ARGS}
-                      INSTALL_COMMAND ${MAKE} install PREFIX=${BZIP2_PREFIX}
+                      INSTALL_COMMAND ${MAKE} install -j1 PREFIX=${BZIP2_PREFIX}
                                       ${BZIP2_EXTRA_ARGS}
                       INSTALL_DIR ${BZIP2_PREFIX}
                       URL ${ARROW_BZIP2_SOURCE_URL}