Skip to content

Commit

Permalink
apacheGH-39628: [C++] Use -j1 for cmake >= 3.28 (apache#39629)
Browse files Browse the repository at this point in the history
### 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: apache#39628

Authored-by: Jacob Wujciak-Jens <[email protected]>
Signed-off-by: Jacob Wujciak-Jens <[email protected]>
  • Loading branch information
assignUser authored Jan 16, 2024
1 parent 4b3de81 commit 980e7d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 980e7d7

Please sign in to comment.