From d395e05d9771d0aac21759a90b01a0cbcab1a354 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Thu, 5 Dec 2019 14:09:45 +0000 Subject: [PATCH] builder: Limit ninja jobs on Windows. On Windows (msys2) ninja may fail to work with -j 64 because it runs out of open handles. Limit jobs for ninja to 32 on Windows. Signed-off-by: Rafael Kitover --- tools/builder/core.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index dd7e2f01..52681ff8 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -1396,7 +1396,7 @@ build_dist() { fi dist_post_configure "$current_dist" eval "set -- $(dist_ninja_args "$current_dist")" - echo_run ninja -j $NUM_CPUS "$@" + echo_run ninja "$@" if [ -z "$install_override" ]; then rm -rf destdir @@ -1506,7 +1506,7 @@ build_dist() { fi dist_post_configure "$current_dist" eval "set -- $(dist_ninja_args "$current_dist")" - echo_run ninja -j$NUM_CPUS "$@" + echo_run ninja "$@" if [ -z "$install_override" ]; then rm -rf destdir @@ -2227,7 +2227,12 @@ dist_ninja_args() { current_dist=$1 [ -n "$current_dist" ] || die 'dist_ninja_args: dist name required' - puts "-v $(table_line DIST_MAKE_ARGS $current_dist)" || : + _num_cpus=$NUM_CPUS + + # ninja hits the open file limit on windows + [ "$os" = windows ] && [ $_num_cpus -gt 32 ] && _num_cpus=32 + + puts "-v $(table_line DIST_MAKE_ARGS $current_dist) -j $_num_cpus" || : } dist_make_install_args() {