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

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new bbfb242037 GH-49563: [C++][CMake] Remove clang/infer tools detection 
(#49575)
bbfb242037 is described below

commit bbfb2420377fc9955dc0e4b5f2d3d1e9d6146211
Author: Alina (Xi) Li <[email protected]>
AuthorDate: Wed Mar 25 15:01:07 2026 -0700

    GH-49563: [C++][CMake] Remove clang/infer tools detection (#49575)
    
    ### Rationale for this change
    
    GH-49563
    
    ### What changes are included in this PR?
    
    This issue occurred without any code changes, so I think it is due to an 
macOS update.
    
    After a GitHub macOS update, the `CLANG_TOOLS_PATH` path is resolved as 
`/usr/local/bin/clang-format` in Intel CI. Before the GitHub macOS update, 
`CLANG_TOOLS_PATH` was resolved as `/usr/local/opt/llvm@ 18/bin` and we did not 
have the issue of `libunwind` linking dynamically to ODBC dylib.
    
    We don't know why clang tools change is related to `libunwind` linking but 
we don't need to detect clang/infer tools in our CMake now. (We migrated to 
pre-commit from Archery for linting.) So we can fix this issue by removing 
clang/infer tools detection from our CMake configuration.
    
    ### Are these changes tested?
    
    - Tested in CI
    
    ### Are there any user-facing changes?
    
    N/A
    
    * GitHub Issue: #49563
    
    Lead-authored-by: Alina (Xi) Li <[email protected]>
    Co-authored-by: Alina (Xi) Li <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/CMakeLists.txt                     |  27 --------
 cpp/cmake_modules/FindClangTools.cmake | 122 ---------------------------------
 cpp/cmake_modules/FindInferTools.cmake |  47 -------------
 3 files changed, 196 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index ea15bb7066..a77ed39eac 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -211,17 +211,6 @@ else()
   set(MSVC_TOOLCHAIN FALSE)
 endif()
 
-find_package(ClangTools)
-find_package(InferTools)
-if("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1"
-   OR CLANG_TIDY_FOUND
-   OR INFER_FOUND)
-  # Generate a Clang compile_commands.json "compilation database" file for use
-  # with various development tools, such as Vim's YouCompleteMe plugin.
-  # See http://clang.llvm.org/docs/JSONCompilationDatabase.html
-  set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
-endif()
-
 # Needed for Gandiva.
 # Use the first Python installation on PATH, not the newest one
 set(Python3_FIND_STRATEGY "LOCATION")
@@ -649,22 +638,6 @@ if(UNIX)
                     VERBATIM)
 endif(UNIX)
 
-#
-# "make infer" target
-#
-
-if(${INFER_FOUND})
-  # runs infer capture
-  add_custom_target(infer ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN}
-                          ${CMAKE_BINARY_DIR}/compile_commands.json 1)
-  # runs infer analyze
-  add_custom_target(infer-analyze ${BUILD_SUPPORT_DIR}/run-infer.sh 
${INFER_BIN}
-                                  ${CMAKE_BINARY_DIR}/compile_commands.json 2)
-  # runs infer report
-  add_custom_target(infer-report ${BUILD_SUPPORT_DIR}/run-infer.sh ${INFER_BIN}
-                                 ${CMAKE_BINARY_DIR}/compile_commands.json 3)
-endif()
-
 #
 # Link targets
 #
diff --git a/cpp/cmake_modules/FindClangTools.cmake 
b/cpp/cmake_modules/FindClangTools.cmake
deleted file mode 100644
index 1364ccbed8..0000000000
--- a/cpp/cmake_modules/FindClangTools.cmake
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Tries to find the clang-tidy and clang-format modules
-#
-# Usage of this module as follows:
-#
-#  find_package(ClangTools)
-#
-# Variables used by this module which can change the default behaviour and need
-# to be set before calling find_package:
-#
-#  CLANG_FORMAT_VERSION -
-#   The version of clang-format to find. If this is not specified, clang-format
-#   will not be searched for.
-#
-#  ClangTools_PATH -
-#   When set, this path is inspected in addition to standard library binary 
locations
-#   to find clang-tidy and clang-format
-#
-# This module defines
-#  CLANG_TIDY_BIN, The  path to the clang tidy binary
-#  CLANG_TIDY_FOUND, Whether clang tidy was found
-#  CLANG_FORMAT_BIN, The path to the clang format binary
-#  CLANG_FORMAT_FOUND, Whether clang format was found
-
-set(CLANG_TOOLS_SEARCH_PATHS
-    ${ClangTools_PATH}
-    $ENV{CLANG_TOOLS_PATH}
-    /usr/local/bin
-    /usr/bin
-    "C:/Program Files/LLVM/bin" # Windows, non-conda
-    "$ENV{CONDA_PREFIX}/Library/bin" # Windows, conda
-    "$ENV{CONDA_PREFIX}/bin") # Unix, conda
-if(APPLE)
-  find_program(BREW brew)
-  if(BREW)
-    execute_process(COMMAND ${BREW} --prefix 
"llvm@${ARROW_CLANG_TOOLS_VERSION_MAJOR}"
-                    OUTPUT_VARIABLE CLANG_TOOLS_BREW_PREFIX
-                    OUTPUT_STRIP_TRAILING_WHITESPACE)
-    if(NOT CLANG_TOOLS_BREW_PREFIX)
-      execute_process(COMMAND ${BREW} --prefix llvm
-                      OUTPUT_VARIABLE CLANG_TOOLS_BREW_PREFIX
-                      OUTPUT_STRIP_TRAILING_WHITESPACE)
-    endif()
-    if(CLANG_TOOLS_BREW_PREFIX)
-      list(APPEND CLANG_TOOLS_SEARCH_PATHS "${CLANG_TOOLS_BREW_PREFIX}/bin")
-    endif()
-  endif()
-endif()
-
-function(FIND_CLANG_TOOL NAME OUTPUT VERSION_CHECK_PATTERN)
-  unset(CLANG_TOOL_BIN CACHE)
-  find_program(CLANG_TOOL_BIN
-               NAMES ${NAME}-${ARROW_CLANG_TOOLS_VERSION}
-                     ${NAME}-${ARROW_CLANG_TOOLS_VERSION_MAJOR}
-               PATHS ${CLANG_TOOLS_SEARCH_PATHS}
-               NO_DEFAULT_PATH)
-  if(NOT CLANG_TOOL_BIN)
-    # try searching for non-versioned tool and check the version
-    find_program(CLANG_TOOL_BIN
-                 NAMES ${NAME}
-                 PATHS ${CLANG_TOOLS_SEARCH_PATHS}
-                 NO_DEFAULT_PATH)
-    if(CLANG_TOOL_BIN)
-      unset(CLANG_TOOL_VERSION_MESSAGE)
-      execute_process(COMMAND ${CLANG_TOOL_BIN} "-version"
-                      OUTPUT_VARIABLE CLANG_TOOL_VERSION_MESSAGE
-                      OUTPUT_STRIP_TRAILING_WHITESPACE)
-      if(NOT (${CLANG_TOOL_VERSION_MESSAGE} MATCHES ${VERSION_CHECK_PATTERN}))
-        message(STATUS "${NAME} found, but version did not match 
\"${VERSION_CHECK_PATTERN}\""
-        )
-        set(CLANG_TOOL_BIN "CLANG_TOOL_BIN-NOTFOUND")
-      endif()
-    endif()
-  endif()
-  if(CLANG_TOOL_BIN)
-    set(${OUTPUT}
-        ${CLANG_TOOL_BIN}
-        PARENT_SCOPE)
-  else()
-    set(${OUTPUT}
-        "${OUTPUT}-NOTFOUND"
-        PARENT_SCOPE)
-  endif()
-endfunction()
-
-string(REGEX REPLACE "\\." "\\\\." ARROW_CLANG_TOOLS_VERSION_ESCAPED
-                     "${ARROW_CLANG_TOOLS_VERSION}")
-
-find_clang_tool(clang-tidy CLANG_TIDY_BIN
-                "LLVM version ${ARROW_CLANG_TOOLS_VERSION_ESCAPED}")
-if(CLANG_TIDY_BIN)
-  set(CLANG_TIDY_FOUND 1)
-  message(STATUS "clang-tidy found at ${CLANG_TIDY_BIN}")
-else()
-  set(CLANG_TIDY_FOUND 0)
-  message(STATUS "clang-tidy ${ARROW_CLANG_TOOLS_VERSION} not found")
-endif()
-
-find_clang_tool(clang-format CLANG_FORMAT_BIN
-                "clang-format version ${ARROW_CLANG_TOOLS_VERSION_ESCAPED}")
-if(CLANG_FORMAT_BIN)
-  set(CLANG_FORMAT_FOUND 1)
-  message(STATUS "clang-format found at ${CLANG_FORMAT_BIN}")
-else()
-  set(CLANG_FORMAT_FOUND 0)
-  message(STATUS "clang-format ${ARROW_CLANG_TOOLS_VERSION} not found")
-endif()
-
-find_package_handle_standard_args(ClangTools REQUIRED_VARS CLANG_FORMAT_BIN
-                                                           CLANG_TIDY_BIN)
diff --git a/cpp/cmake_modules/FindInferTools.cmake 
b/cpp/cmake_modules/FindInferTools.cmake
deleted file mode 100644
index c4b65653ae..0000000000
--- a/cpp/cmake_modules/FindInferTools.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Tries to find the infer module
-#
-# Usage of this module as follows:
-#
-#  find_package(InferTools)
-#
-# Variables used by this module, they can change the default behaviour and need
-# to be set before calling find_package:
-#
-#  InferTools_PATH -
-#   When set, this path is inspected instead of standard library binary 
locations
-#   to find infer
-#
-# This module defines
-#  INFER_BIN, The  path to the infer binary
-#  INFER_FOUND, Whether infer was found
-
-find_program(INFER_BIN
-             NAMES infer
-             PATHS ${InferTools_PATH}
-                   $ENV{INFER_TOOLS_PATH}
-                   /usr/local/bin
-                   /usr/bin
-                   /usr/local/homebrew/bin
-                   /opt/local/bin
-             NO_DEFAULT_PATH)
-
-if("${INFER_BIN}" STREQUAL "INFER_BIN-NOTFOUND")
-  set(INFER_FOUND 0)
-  message(STATUS "infer not found")
-else()
-  set(INFER_FOUND 1)
-  message(STATUS "infer found at ${INFER_BIN}")
-endif()

Reply via email to