From edf92f10ffac37c624ee68bb4a05bd9e39d2ee4a Mon Sep 17 00:00:00 2001 From: Yiqun Zhang Date: Tue, 2 Aug 2022 09:11:14 +0800 Subject: [PATCH] [fix](build) The `nproc` command does not exist in macos by default, use `sysctl -n hw.logicalcpu` instead to get the number of logical cores available (#11379) --- thirdparty/build-thirdparty.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index 569427e329..3953142f52 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -59,7 +59,14 @@ fi eval set -- "$OPTS" -PARALLEL=$(($(nproc) / 4 + 1)) +KERNEL="$(uname -s)" + +if [[ "${KERNEL}" == 'Darwin' ]]; then + PARALLEL=$(($(sysctl -n hw.logicalcpu) / 4 + 1)) +else + PARALLEL=$(($(nproc) / 4 + 1)) +fi + if [[ $# -ne 1 ]]; then while true; do case "$1" in @@ -142,8 +149,6 @@ elif [[ "$CC" == *clang ]]; then libhdfs_cxx17=-std=c++1z fi -KERNEL="$(uname -s)" - # prepare installed prefix mkdir -p "${TP_DIR}/installed/lib64" pushd "${TP_DIR}/installed"/