Skip to content

GH-49569: [CI][Python][C++] Add check targetting Apple clang on deciding whether to use std::bit_width or std::log2p1#49570

Open
raulcd wants to merge 3 commits intoapache:mainfrom
raulcd:GH-49569
Open

GH-49569: [CI][Python][C++] Add check targetting Apple clang on deciding whether to use std::bit_width or std::log2p1#49570
raulcd wants to merge 3 commits intoapache:mainfrom
raulcd:GH-49569

Conversation

@raulcd
Copy link
Member

@raulcd raulcd commented Mar 20, 2026

Rationale for this change

Clang 15.0.7 (/opt/homebrew/bin/clang++) - Homebrew LLVM fails compiling with:

   FAILED: [code=1] CMakeFiles/arrow_python.dir/pyarrow/src/arrow/python/arrow_to_pandas.cc.o
  /opt/homebrew/bin/ccache /opt/homebrew/bin/clang++ -DARROW_HAVE_NEON -DARROW_PYTHON_EXPORTING -Darrow_python_EXPORTS -I/Users/runner/work/arrow/arrow/build/python/pyarrow/src -I/var/folders/gj/d1t24fg93wbdl854js_qwvb00000gn/T/tmpj20nqu3c/build/pyarrow/src -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -I/tmp/local/include -I/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/_core/include -fno-aligned-new  -Wall -Wno-unknown-warning-option -Wno-pass-failed -march=armv8-a  -Qunused-arguments -fcolor-diagnostics  -fno-omit-frame-pointer -Wno-unused-variable -Wno-maybe-uninitialized -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-missing-declarations -Wno-sometimes-uninitialized -Wno-return-type-c-linkage -g -O0  -std=c++20 -arch arm64 -mmacosx-version-min=12 -fPIC -Wno-parentheses-equality -MD -MT CMakeFiles/arrow_python.dir/pyarrow/src/arrow/python/arrow_to_pandas.cc.o -MF CMakeFiles/arrow_python.dir/pyarrow/src/arrow/python/arrow_to_pandas.cc.o.d -o CMakeFiles/arrow_python.dir/pyarrow/src/arrow/python/arrow_to_pandas.cc.o -c /Users/runner/work/arrow/arrow/build/python/pyarrow/src/arrow/python/arrow_to_pandas.cc
  In file included from /Users/runner/work/arrow/arrow/build/python/pyarrow/src/arrow/python/arrow_to_pandas.cc:34:
  In file included from /tmp/local/include/arrow/array.h:41:
  In file included from /tmp/local/include/arrow/array/array_base.h:26:
  In file included from /tmp/local/include/arrow/array/data.h:32:
  /tmp/local/include/arrow/util/bit_util.h:145:15: error: no member named 'log2p1' in namespace 'std'
    return std::log2p1(x - 1);
           ~~~~~^
  1 error generated.

This seems to be the case of clang not having __cpp_lib_bitops defined but std::log2p1 having been removed.

What changes are included in this PR?

Check for __apple_build_version__ instead of __clang__ so non Apple Clang just uses std::bit_width

Are these changes tested?

Via CI

Are there any user-facing changes?

No

…ciding whether to use std::bit_width or std::log2p1
@raulcd
Copy link
Member Author

raulcd commented Mar 20, 2026

@github-actions crossbow submit test-r-macos-as-cran test-ubuntu-22.04-cpp-emscripten

@github-actions
Copy link

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

@github-actions
Copy link

Revision: 066bf57

Submitted crossbow builds: ursacomputing/crossbow @ actions-576a7cbdce

Task Status
test-r-macos-as-cran GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions

@raulcd
Copy link
Member Author

raulcd commented Mar 20, 2026

@github-actions crossbow submit test-r-macos-as-cran test-ubuntu-22.04-cpp-emscripten

@github-actions
Copy link

Revision: a982f19

Submitted crossbow builds: ursacomputing/crossbow @ actions-d0624cbd1c

Task Status
test-r-macos-as-cran GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions

@raulcd raulcd changed the title GH-49569: [CI][Python][C++] Add check for _LIBCPP_VERSION on deciding whether to use std::bit_width or std::log2p1 GH-49569: [CI][Python][C++] Add check targetting apple clang on deciding whether to use std::bit_width or std::log2p1 Mar 20, 2026
@raulcd raulcd changed the title GH-49569: [CI][Python][C++] Add check targetting apple clang on deciding whether to use std::bit_width or std::log2p1 GH-49569: [CI][Python][C++] Add check targetting Apple clang on deciding whether to use std::bit_width or std::log2p1 Mar 20, 2026
@raulcd
Copy link
Member Author

raulcd commented Mar 20, 2026

@raulcd raulcd marked this pull request as ready for review March 20, 2026 12:43
@raulcd raulcd requested a review from wgtmac as a code owner March 20, 2026 12:47
@raulcd
Copy link
Member Author

raulcd commented Mar 20, 2026

@github-actions crossbow submit test-r-macos-as-cran test-ubuntu-22.04-cpp-emscripten

@github-actions
Copy link

Revision: 4736f08

Submitted crossbow builds: ursacomputing/crossbow @ actions-025f27de49

Task Status
test-r-macos-as-cran GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions

@raulcd
Copy link
Member Author

raulcd commented Mar 20, 2026

@kou @jonkeane what do you think about this. This was failing on the ARM64 macOS 14 Python 3 before but is now successful. The problem was with non-Apple clang on macOS. It failed using the one from homebrew.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

I didn't know __apple_build_version__!

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants