GH-50987: [C++] Fix builds with the macOS 11.3 SDK - #50997
Conversation
std::identity reached libc++ only in version 12, which ships with the macOS 12 SDK. The R macOS CRAN nightly builds against the 11.3 SDK and fails with "no template named 'identity' in namespace 'std'". Replace it with a local functor so the is_same_v fast path in MapBitmapUnary keeps matching. Signed-off-by: 1fanwang <1fannnw@gmail.com>
|
|
There was a problem hiding this comment.
Pull request overview
Fixes Arrow C++ builds against older macOS SDK/libc++ versions (notably macOS 11.3) by removing the dependency on std::identity in bitmap_ops.cc, while preserving the existing fast memcpy-based bitmap copy path.
Changes:
- Add a local
Identityfunctor (equivalent tostd::identity) and include<utility>forstd::forward. - Replace
std::identityusages with the localIdentityinMapBitmapUnarycall sites and its compile-time fast-path check.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@github-actions crossbow submit test-r-macos-as-cran |
|
Revision: c52b428 Submitted crossbow builds: ursacomputing/crossbow @ actions-1b11590188
|
There was a problem hiding this comment.
🟢 Approval recommended
The change is localized and mechanical (replacing std::identity with an equivalent local functor) and preserves the existing optimized code paths.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
LGTM, thank you @thisisnic and @1fanwang |
Rationale for this change
The R macOS CRAN nightly stopped building Arrow C++ after #50785. It uses the macOS
11.3 SDK to match CRAN's builder, and fails on one file with "no template named
'identity' in namespace 'std'" at lines 230, 307 and 323. That SDK's libc++ predates
the standard identity functor, which arrived in libc++ 12 with the macOS 12 SDK, so
the name is absent whatever standard is selected. The cran-m1 job uses a current SDK
and passes, which is why only this builder is red.
Before this change the R package cannot be built on CRAN's macOS builder. After it,
the file compiles there.
Closes #50987.
What changes are included in this PR?
That file is the only one in the C++ tree naming the missing symbol, at the three
sites above. It now uses a small equivalent functor in the same translation unit, so
the compile-time fast path that skips per-bit work still matches and the bitmap copy
keeps its memcpy shortcut. The bitwise-not functor is older and untouched. No
behavior or API change.
Are these changes tested?
Reproduced on a real macOS 11.3 SDK, whose internal identity helper sits at the same
header line cited in the CI log, confirming the same libc++. From a checkout of this
branch:
Behavior is unchanged. The bit utility test target builds and its bitmap copy,
invert and reverse cases pass, covering both branches of the mapping helper: the
byte-aligned memcpy path and the bit-offset path that calls the functor.
The local run compiles the failing translation unit, not the full R build, which the
CRAN job here covers.
Are there any user-facing changes?
No.