Files
Antoine Pitrou 30809c6f48 GH-45885: [C++] Require C++20 (#48414)
### Rationale for this change

We decided to migrate Arrow C++ to C++20 in this discussion: https://lists.apache.org/thread/48zlj0dn2y0f53y2k37qsr90y781wfnj

### What changes are included in this PR?

1. Build configuration updates (CMake files etc.) to build with C++20 instead of C++17

2. C++-level fixes to ensure compilation succeeds:

    * Workarounds for deprecation of atomic access on `std::shared_ptr<T>` (the replacement `std::atomic<std::shared_ptr<T>>` is unfortunately not supported in all standard library implementations)
    * Workaround for [Abseil ABI issues](https://github.com/abseil/abseil-cpp/issues/1624)
    * Trivial update to `arrow/util/string.h` to call a C++20 API (to validate that C++20 is actually enabled)

3. CI configuration updates to get enough C++20 support on the various platforms:

    * Bump default clang and LLVM versions to 18
    * Use AlmaLinux 10 for release verification (AlmaLinux 8 is still tested on other CI builds)

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes, Arrow C++ will now require a C++20-compliant compiler.

* GitHub Issue: #45885

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2025-12-18 17:17:13 +01:00

44 lines
1.7 KiB
CMake

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
cmake_minimum_required(VERSION 3.25)
project(ArrowTutorialExamples)
find_package(ArrowDataset)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra")
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Arrow version: ${ARROW_VERSION}")
message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}")
add_executable(arrow_example arrow_example.cc)
target_link_libraries(arrow_example PRIVATE Arrow::arrow_shared)
add_executable(file_access_example file_access_example.cc)
target_link_libraries(file_access_example PRIVATE Arrow::arrow_shared
Parquet::parquet_shared)
add_executable(compute_example compute_example.cc)
target_link_libraries(compute_example PRIVATE ArrowCompute::arrow_compute_shared)
add_executable(dataset_example dataset_example.cc)
target_link_libraries(dataset_example PRIVATE ArrowDataset::arrow_dataset_shared)