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/16 16:04:21 UTC

(arrow) branch main updated: 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 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 980e7d7ca2 GH-39628: [C++] Use -j1 for cmake >= 3.28 (#39629)
980e7d7ca2 is described below

commit 980e7d7ca2b4ea98b029d40cfe44588a07c85b4f
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 6bb9c0f6af..1f5cd3a2b4 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1005,8 +1005,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)
 set(FC_DECLARE_COMMON_OPTIONS)
@@ -2634,7 +2639,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}