This is an automated email from the ASF dual-hosted git repository.
jackylee-ch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new b6cab2f484 [VL] Isolate /usr/local from native builds on macOS (#12105)
b6cab2f484 is described below
commit b6cab2f4842054845461de96e8702658b47e099c
Author: jackylee <[email protected]>
AuthorDate: Wed Jun 3 19:09:38 2026 +0800
[VL] Isolate /usr/local from native builds on macOS (#12105)
---
dev/build-helper-functions.sh | 13 +++++++++++++
dev/builddeps-veloxbe.sh | 10 ++++++++++
ep/build-velox/src/build-velox.sh | 35 ++++++++++++++++++++++++++++-------
3 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/dev/build-helper-functions.sh b/dev/build-helper-functions.sh
index 4be8ad170b..8a53c8600a 100644
--- a/dev/build-helper-functions.sh
+++ b/dev/build-helper-functions.sh
@@ -176,6 +176,18 @@ function cmake_install {
CPU_TARGET="${CPU_TARGET:-unknown}"
COMPILER_FLAGS=$(get_cxx_flags $CPU_TARGET)
+ local MACOS_ISOLATION_FLAGS=""
+ if [[ "$(uname)" == "Darwin" ]]; then
+ if [[ "${INSTALL_PREFIX:-}" == "/usr/local" || "${INSTALL_PREFIX:-}" ==
/usr/local/* ]]; then
+ echo "INFO: INSTALL_PREFIX=${INSTALL_PREFIX} is under /usr/local;
keeping /usr/local visible to CMake." >&2
+ else
+ MACOS_ISOLATION_FLAGS="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON \
+ -DCMAKE_IGNORE_PREFIX_PATH=/usr/local \
+
-DCMAKE_IGNORE_PATH=/usr/local;/usr/local/include;/usr/local/lib;/usr/local/lib/cmake
\
+
-DCMAKE_SYSTEM_IGNORE_PATH=/usr/local;/usr/local/include;/usr/local/lib;/usr/local/lib/cmake"
+ fi
+ fi
+
# CMAKE_POSITION_INDEPENDENT_CODE is required so that Velox can be built
into dynamic libraries \
cmake -Wno-dev -B"${BINARY_DIR}" \
-GNinja \
@@ -185,6 +197,7 @@ function cmake_install {
"${INSTALL_PREFIX+-DCMAKE_INSTALL_PREFIX=}${INSTALL_PREFIX-}" \
-DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" \
-DBUILD_TESTING=OFF \
+ $MACOS_ISOLATION_FLAGS \
"$@"
cmake --build "${BINARY_DIR}"
diff --git a/dev/builddeps-veloxbe.sh b/dev/builddeps-veloxbe.sh
index 6ce2c6d083..3fcd42660f 100755
--- a/dev/builddeps-veloxbe.sh
+++ b/dev/builddeps-veloxbe.sh
@@ -160,6 +160,9 @@ done
if [[ "$(uname)" == "Darwin" ]]; then
export INSTALL_PREFIX=${INSTALL_PREFIX:-${VELOX_HOME}/deps-install}
+ if [[ "$INSTALL_PREFIX" == "/usr/local" || "$INSTALL_PREFIX" ==
/usr/local/* ]]; then
+ echo "INFO: INSTALL_PREFIX=$INSTALL_PREFIX is under /usr/local;
keeping /usr/local visible to CMake." >&2
+ fi
fi
function concat_velox_param {
@@ -259,6 +262,13 @@ function build_gluten_cpp {
if [ $OS == 'Darwin' ]; then
GLUTEN_CMAKE_OPTIONS+=" -DCMAKE_PREFIX_PATH=$INSTALL_PREFIX"
+ if [[ "$INSTALL_PREFIX" != "/usr/local" && "$INSTALL_PREFIX" !=
/usr/local/* ]]; then
+ GLUTEN_CMAKE_OPTIONS+=" -DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON"
+ GLUTEN_CMAKE_OPTIONS+=" -DCMAKE_IGNORE_PREFIX_PATH=/usr/local"
+ GLUTEN_CMAKE_OPTIONS+="
-DCMAKE_IGNORE_PATH=/usr/local;/usr/local/include;/usr/local/lib;/usr/local/lib/cmake"
+ GLUTEN_CMAKE_OPTIONS+="
-DCMAKE_SYSTEM_IGNORE_PATH=/usr/local;/usr/local/include;/usr/local/lib;/usr/local/lib/cmake"
+ fi
+ GLUTEN_CMAKE_OPTIONS+="
-DCMAKE_CXX_FLAGS=-Wno-inconsistent-missing-override -Wno-macro-redefined"
fi
cmake -G Ninja $GLUTEN_CMAKE_OPTIONS ..
diff --git a/ep/build-velox/src/build-velox.sh
b/ep/build-velox/src/build-velox.sh
index 99b066415b..cf7c97c455 100755
--- a/ep/build-velox/src/build-velox.sh
+++ b/ep/build-velox/src/build-velox.sh
@@ -97,16 +97,34 @@ for arg in "$@"; do
esac
done
+function install_cmake_dependency {
+ local build_dir="$1"
+ if [ "$OS" == 'Darwin' ]; then
+ cmake --install "$build_dir" --prefix "${INSTALL_PREFIX}"
+ else
+ sudo cmake --install "$build_dir"
+ fi
+}
+
function compile {
# -Wno-unknown-warning-option is a Clang-originated flag. GCC ignores
unrecognized -Wno- flags to
# maintain compatibility, but it prints a diagnostic note about the unknown
flag if a true warning
# or error occurs.
CXX_FLAGS='-Wno-error=stringop-overflow -Wno-error=cpp
-Wno-missing-field-initializers \
-Wno-error=uninitialized -Wno-unknown-warning-option
-Wno-deprecated-declarations'
+ if [[ "$(uname)" == "Darwin" ]]; then
+ CXX_FLAGS="$CXX_FLAGS -Wno-inconsistent-missing-override
-Wno-macro-redefined"
+ fi
COMPILE_OPTION="-DCMAKE_CXX_FLAGS=\"$CXX_FLAGS\" -DVELOX_ENABLE_PARQUET=ON
-DVELOX_BUILD_TESTING=OFF \
-DVELOX_MONO_LIBRARY=ON -DVELOX_BUILD_RUNNER=OFF
-DVELOX_SIMDJSON_SKIPUTF8VALIDATION=ON \
-DVELOX_ENABLE_GEO=OFF"
+ if [[ "$(uname)" == "Darwin" && "$INSTALL_PREFIX" != "/usr/local" &&
"$INSTALL_PREFIX" != /usr/local/* ]]; then
+ COMPILE_OPTION="$COMPILE_OPTION -DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON"
+ COMPILE_OPTION="$COMPILE_OPTION -DCMAKE_IGNORE_PREFIX_PATH=/usr/local"
+ COMPILE_OPTION="$COMPILE_OPTION
-DCMAKE_IGNORE_PATH=/usr/local\;/usr/local/include\;/usr/local/lib\;/usr/local/lib/cmake"
+ COMPILE_OPTION="$COMPILE_OPTION
-DCMAKE_SYSTEM_IGNORE_PATH=/usr/local\;/usr/local/include\;/usr/local/lib\;/usr/local/lib/cmake"
+ fi
if [ $BUILD_TEST_UTILS == "ON" ]; then
COMPILE_OPTION="$COMPILE_OPTION -DVELOX_BUILD_TEST_UTILS=ON"
fi
@@ -162,16 +180,12 @@ function compile {
exit 1
fi
- # Install deps to system as needed
+ # Install deps as needed
if [ -d "_build/$COMPILE_TYPE/_deps" ]; then
cd _build/$COMPILE_TYPE/_deps
if [ -d xsimd-build ]; then
echo "INSTALL xsimd."
- if [ $OS == 'Linux' ]; then
- sudo cmake --install xsimd-build/
- elif [ $OS == 'Darwin' ]; then
- sudo cmake --install xsimd-build/
- fi
+ install_cmake_dependency xsimd-build/
fi
if [ -d googletest-build ]; then
echo "INSTALL gtest."
@@ -179,7 +193,7 @@ function compile {
cd googletest-src; cmake . ; sudo make install -j
#sudo cmake --install googletest-build/
elif [ $OS == 'Darwin' ]; then
- sudo cmake --install googletest-build/
+ install_cmake_dependency googletest-build/
fi
fi
fi
@@ -194,6 +208,13 @@ if [ "$VELOX_HOME" == "" ]; then
VELOX_HOME="$CURRENT_DIR/../build/velox_ep"
fi
+if [ "$OS" == 'Darwin' ]; then
+ export INSTALL_PREFIX="${INSTALL_PREFIX:-${VELOX_HOME}/deps-install}"
+ if [[ "$INSTALL_PREFIX" == "/usr/local" || "$INSTALL_PREFIX" == /usr/local/*
]]; then
+ echo "INFO: INSTALL_PREFIX=$INSTALL_PREFIX is under /usr/local; keeping
/usr/local visible to CMake." >&2
+ fi
+fi
+
echo "Start building Velox..."
echo "CMAKE Arguments:"
echo "VELOX_HOME=${VELOX_HOME}"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]