This is an automated email from the ASF dual-hosted git repository.

zml1206 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 93399127cf [VL] Fix arrow build with Clang 21 (#12421)
93399127cf is described below

commit 93399127cfd671c30acd9291424612c8cc07fcbd
Author: kevinwilfong <[email protected]>
AuthorDate: Thu Jul 2 18:54:56 2026 -0700

    [VL] Fix arrow build with Clang 21 (#12421)
---
 dev/build-arrow.sh            | 14 ++++++++++++--
 dev/build-helper-functions.sh |  4 +++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/dev/build-arrow.sh b/dev/build-arrow.sh
index 6a4a784b82..9e553389ef 100755
--- a/dev/build-arrow.sh
+++ b/dev/build-arrow.sh
@@ -39,14 +39,24 @@ function prepare_arrow_build() {
 function build_arrow_cpp() {
   pushd $ARROW_PREFIX/cpp
   ARROW_WITH_ZLIB=ON
+  # Major version of the compiler CMake will use, when it is clang. Non-clang
+  # compilers (e.g. gcc) do not define __clang_major__, leaving this empty.
+  clang_major_version=$(echo | ${CXX:-c++} -dM -E -x c++ - 2>/dev/null | awk 
'/__clang_major__/ {print $3}')
   # The zlib version bundled with arrow is not compatible with clang 17.
   # It can be removed after upgrading the arrow version.
   if [[ "$(uname)" == "Darwin" ]]; then
-    clang_major_version=$(echo | clang -dM -E - | grep __clang_major__ | awk 
'{print $3}')
-    if [ "${clang_major_version}" -ge 17 ]; then
+    if [ -n "${clang_major_version}" ] && [ "${clang_major_version}" -ge 17 ]; 
then
       ARROW_WITH_ZLIB=OFF
     fi
   fi
+  # Clang 21 added -Wcharacter-conversion (enabled by default), which Arrow's
+  # bundled googletest trips under its own -Werror. Downgrade it to a warning 
on
+  # clang 21+. Not OS-specific: any clang 21+ (macOS or Linux) is affected. 
Can be
+  # removed once an Arrow upgrade ships a newer googletest.
+  EXTRA_CMAKE_CXX_FLAGS=""
+  if [ -n "${clang_major_version}" ] && [ "${clang_major_version}" -ge 21 ]; 
then
+    EXTRA_CMAKE_CXX_FLAGS="-Wno-error=character-conversion"
+  fi
   cmake_install \
        -DARROW_PARQUET=OFF \
        -DARROW_FILESYSTEM=ON \
diff --git a/dev/build-helper-functions.sh b/dev/build-helper-functions.sh
index c967016ef6..a8a257c286 100644
--- a/dev/build-helper-functions.sh
+++ b/dev/build-helper-functions.sh
@@ -174,7 +174,9 @@ function cmake_install {
   fi
   mkdir -p "${BINARY_DIR}"
   CPU_TARGET="${CPU_TARGET:-unknown}"
-  COMPILER_FLAGS=$(get_cxx_flags $CPU_TARGET)
+  # EXTRA_CMAKE_CXX_FLAGS lets a caller append dependency-specific compiler 
flags
+  # for a single cmake_install invocation without affecting other dependencies.
+  COMPILER_FLAGS="$(get_cxx_flags $CPU_TARGET) ${EXTRA_CMAKE_CXX_FLAGS:-}"
 
   local MACOS_ISOLATION_FLAGS=""
   if [[ "$(uname)" == "Darwin" ]]; then


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to