ryandesign opened a new issue, #49841:
URL: https://github.com/apache/arrow/issues/49841
### Describe the bug, including details regarding any error messages,
version, and platform.
Apache Arrow 24.0.0 fails to build for me on macOS 12:
```
/usr/bin/clang++ -DARROW_EXTRA_ERROR_CONTEXT -DARROW_HAVE_RUNTIME_AVX2
-DARROW_HAVE_RUNTIME_AVX512 -DARROW_HAVE_RUNTIME_BMI2
-DARROW_HAVE_RUNTIME_SSE4_2 -DARROW_HAVE_SSE4_2 -DARROW_WITH_TIMING_TESTS
-I/opt/local/var/macports/build/apache-arrow-3893d460/work/build/src
-I/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src
-I/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/generated
-fno-aligned-new -pipe -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG
-I/opt/local/libexec/boost/1.81/include -I/opt/local/include -stdlib=libc++
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
-Qunused-arguments -fcolor-diagnostics -Wall -Wno-unknown-warning-option
-Wno-pass-failed -msse4.2 -O3 -DNDEBUG -O2 -std=c++20 -arch x86_64 -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -mmacosx-version-min=12.0
-fPIC -MD -MT src/arrow/CMakeFiles/arrow_array.dir/array/array_decimal.cc.o -MF
src/arrow/CMakeFiles/arrow_ar
ray.dir/array/array_decimal.cc.o.d -o
src/arrow/CMakeFiles/arrow_array.dir/array/array_decimal.cc.o -c
/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/arrow/array/array_decimal.cc
In file included from
/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/arrow/array/array_decimal.cc:18:
In file included from
/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/arrow/array/array_decimal.h:24:
In file included from
/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/arrow/array/array_binary.h:30:
In file included from
/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/arrow/array/array_base.h:26:
In file included from
/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/arrow/array/data.h:33:
/opt/local/var/macports/build/apache-arrow-3893d460/work/arrow-24.0.0/cpp/src/arrow/util/bit_util.h:146:15:
error: no member named 'log2p1' in namespace 'std'
return std::log2p1(x - 1);
~~~~~^
1 error generated.
```
System details:
```
% sw_vers
ProductName: macOS
ProductVersion: 12.7.6
BuildVersion: 21H1320
```
```
% clang++ --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
```
```
% xcodebuild -version
Xcode 13.4.1
Build version 13F100
```
`bit_width` exists in the headers and `log2p1` does not:
```
% grep -E '(bit_width|log2p1)' -r
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/bit:
constexpr T bit_width(T x) noexcept; // C++20
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/bit:bit_width(_Tp
__t) noexcept
```
On the same system, Apache Arrow 23.0.1 had built successfully.
Apache Arrow 24.0.0 contains #49570 to fix #49569. I guess in fixing it for
macOS 14 it broke for macOS 12.
Instead of having multiple places in the source code where you try to decide
between `bit_width` and `log2p1` based on assumed knowledge of compiler
capabilities, could you determine it with a cmake test and then use that result
throughout?
### Component(s)
C++
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]