[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)

This commit is contained in:
Yiqun Zhang
2022-08-02 09:11:14 +08:00
committed by GitHub
parent 27a19118dd
commit edf92f10ff

View File

@ -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"/