Skip to content

[C++]: Work around bit_width not being available on MacOS's partially compatible C++20 build #49371

Closed

Description

@jonkeane

Describe the bug, including details regarding any error messages, version, and platform.

#49298 introduced the failure on our CRAN-like Crossbow job: https://github.com/ursacomputing/crossbow/actions/runs/22267571643/job/64416504261#step:9:982

[  4%] Building C object _deps/lz4-build/CMakeFiles/lz4_static.dir/__/lz4-src/lib/lz4frame.c.o
In file included from /Users/runner/work/crossbow/crossbow/arrow/cpp/src/arrow/array/array_base.cc:18:
In file included from /Users/runner/work/crossbow/crossbow/arrow/cpp/src/arrow/array/array_base.h:26:
In file included from /Users/runner/work/crossbow/crossbow/arrow/cpp/src/arrow/array/data.h:32:
/Users/runner/work/crossbow/crossbow/arrow/cpp/src/arrow/util/bit_util.h:141:15: error: no member named 'bit_width' in namespace 'std'
  141 |   return std::bit_width(x - 1);
      |          ~~~~~^
[  4%] Building C object _deps/lz4-build/CMakeFiles/lz4_static.dir/__/lz4-src/lib/lz4hc.c.o
1 error generated.
make[2]: *** [src/arrow/CMakeFiles/arrow_array.dir/array/array_base.cc.o] Error 1
make[1]: *** [src/arrow/CMakeFiles/arrow_array.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  4%] Building C object _deps/lz4-build/CMakeFiles/lz4_static.dir/__/lz4-src/lib/xxhash.c.o
[  4%] Linking C static library liblz4.a
[  4%] Built target lz4_static
make: *** [all] Error 2
**** Complete build log may still be present at 

We'll need to walk this back or work around it until CRAN fully supports C++20. cc @Anakin100100 @pitrou

Component(s)

C++

Activity

  1. pitrou commented on Feb 22, 2026

    @pitrou
    Member

    We can use the dedicated clang builtin on that playtform.

  2. Anakin100100 commented on Feb 22, 2026

    @Anakin100100
    Contributor

    I feel like if the project is on C++ 20 let's make an effort to support this. There was a similar error for the Ruby build and it was fixed by updating one dependency. Are there other platforms which may have been missed when merging the initial pull request?

  3. jonkeane commented on Feb 22, 2026

    @jonkeane
    MemberAuthor

    @github-actions crossbow submit *cran* will trigger a job that has the target we need to satisfy. That was run and returned clean (#49298 (comment)) but I suspect there were subsequent changes that are bonking us on that build.

    I feel like if the project is on C++ 20 let's make an effort to support this

    I understand, and I too wish we had a cleaner story around C++20 support, but for now, we have to compile on what's available on CRAN to stay on CRAN (which we as a project are committed to still). It won't be forever, they will upgrade their buildchain soon enough, but we have to be able to compile with what's there today.

    edit: oops, I pressed the wrong button, sorry for the noise of close -> reopen.

  4. added this to the 24.0.0 milestone on Feb 28, 2026
  5. jonkeane commented on Feb 28, 2026

    @jonkeane
    MemberAuthor

    Issue resolved by pull request 49405
    #49405

  6. added a commit that references this issue on Feb 28, 2026
  7. added a commit that references this issue on Apr 6, 2026
  8. added a commit that references this issue on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions