Skip to content

GH-49563: [C++][CMake] Remove clang/infer tools detection#49575

Merged
kou merged 2 commits into
apache:mainfrom
Bit-Quill:gh-49563-fix-libunwind
Mar 25, 2026
Merged

GH-49563: [C++][CMake] Remove clang/infer tools detection#49575
kou merged 2 commits into
apache:mainfrom
Bit-Quill:gh-49563-fix-libunwind

Conversation

@alinaliBQ

@alinaliBQ alinaliBQ commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator

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

Currently CLANG_TOOLS_PATH path is resolved as /usr/local/bin/clang-format. This is likely due to a new macOS update mentioned in xpack-dev-tools/clang-xpack#13. 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.

The solution is to explicitly set CLANG_TOOLS_PATH to llvm@18/bin.
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #49563 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions Bot added CI: Extra: C++ Run extra C++ CI awaiting review Awaiting review labels Mar 20, 2026
@alinaliBQ
alinaliBQ marked this pull request as ready for review March 23, 2026 16:59
@alinaliBQ

Copy link
Copy Markdown
Collaborator Author

@kou @lidavidm This PR is ready for review, please have a look

@kou

kou commented Mar 24, 2026

Copy link
Copy Markdown
Member

Hmm. I don't know why this fixes the problem... The build doesn't use LLVM because Gandiva is off. Why do clang based tools relate to linked libraries...?

Anyway, we don't need them. Can we solve the problem by removing clang-tools and infer-tools related codes something like the following?

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
 #
git rm cpp/cmake_modules/FindClangTools.cmake
git rm cpp/cmake_modules/FindInferTools.cmake

Try kou's suggestion to resolve clang issue
@github-actions github-actions Bot added Component: C++ and removed CI: Extra: C++ Run extra C++ CI labels Mar 24, 2026
@alinaliBQ

Copy link
Copy Markdown
Collaborator Author

Sure, let's try that. I have pushed the changes

@alinaliBQ alinaliBQ added the CI: Extra: C++ Run extra C++ CI label Mar 25, 2026
@alinaliBQ

Copy link
Copy Markdown
Collaborator Author

@kou The new approach worked, I have updated the PR description, thanks!

@kou kou changed the title GH-49563: [C++][FlightRPC][ODBC] Remove libunwind dynamic linked library in macOS Intel CI GH-49563: [C++][CMake] Remove clang/infer tools detection Mar 25, 2026

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kou
kou merged commit bbfb242 into apache:main Mar 25, 2026
76 of 79 checks passed
@kou kou removed the awaiting review Awaiting review label Mar 25, 2026
@github-actions github-actions Bot added the awaiting merge Awaiting merge label Mar 25, 2026
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit bbfb242.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 10 possible false positives for unstable benchmarks that are known to sometimes produce them.

thisisnic pushed a commit to thisisnic/arrow that referenced this pull request Apr 6, 2026
…he#49575)

### Rationale for this change

apacheGH-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: apache#49563

Lead-authored-by: Alina (Xi) Li <alina.li@improving.com>
Co-authored-by: Alina (Xi) Li <96995091+alinaliBQ@users.noreply.github.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…he#49575)

### Rationale for this change

apacheGH-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: apache#49563

Lead-authored-by: Alina (Xi) Li <alina.li@improving.com>
Co-authored-by: Alina (Xi) Li <96995091+alinaliBQ@users.noreply.github.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants