This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new fdd3e154aa GH-44950: [C++] Bump minimum CMake version to 3.25 (#44989)
fdd3e154aa is described below

commit fdd3e154aac97ebb08b3a4be1d199d9ca8f14852
Author: Raúl Cumplido <[email protected]>
AuthorDate: Thu Feb 13 03:49:10 2025 +0100

    GH-44950: [C++] Bump minimum CMake version to 3.25 (#44989)
    
    ### Rationale for this change
    
    We want to upgrade our CMake version to 3.25 as discussed on the ML:
    https://lists.apache.org/thread/h8jp16ktrj11fmjmjhlg6xvkvv9wzvjk
    
    ### What changes are included in this PR?
    
    - Bump minimal CMake version to 3.25
    - Manually install CMake on distributions where CMake < 3.25 was installed 
via package repositories
    - Minor fixes to CI in order to have passing builds everywhere
    
    ### Are these changes tested?
    
    Yes, via CI.
    
    ### Are there any user-facing changes?
    
    Yes, the minimum CMake version to be used to build Arrow is bumped to 3.25.
    **This PR includes breaking changes to build systems.**
    * GitHub Issue: #44950
    
    Lead-authored-by: Raúl Cumplido <[email protected]>
    Co-authored-by: Bryce Mecum <[email protected]>
    Co-authored-by: Sutou Kouhei <[email protected]>
    Co-authored-by: Sutou Kouhei <[email protected]>
    Co-authored-by: Neal Richardson <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 .env                                               |   1 +
 .github/workflows/cpp.yml                          |   2 +-
 .github/workflows/dev.yml                          |   2 +-
 ci/docker/centos-7-cpp.dockerfile                  |   7 +-
 ci/docker/linux-r.dockerfile                       |   4 +
 ci/docker/python-wheel-manylinux.dockerfile        |   2 +-
 ci/docker/ubuntu-20.04-cpp-minimal.dockerfile      |   5 +-
 ci/docker/ubuntu-20.04-cpp.dockerfile              |   5 +-
 ci/docker/ubuntu-22.04-cpp-minimal.dockerfile      |   4 +
 ci/docker/ubuntu-22.04-cpp.dockerfile              |   5 +-
 ci/docker/ubuntu-22.04-verify-rc.dockerfile        |   4 +
 ci/rtools/README.md                                |  35 ++++
 .../rtools/aws_c_common_ep.patch                   |  28 +++-
 ci/rtools/aws_c_io_ep.patch                        |  56 +++++++
 ci/rtools/awssdk_ep.patch                          | 181 +++++++++++++++++++++
 ci/scripts/PKGBUILD                                |  17 +-
 ci/scripts/install_cmake.sh                        |  49 ++++--
 ci/scripts/r_windows_build.sh                      |  13 +-
 cpp/CMakeLists.txt                                 |   2 +-
 cpp/cmake_modules/ThirdpartyToolchain.cmake        |  40 +++++
 cpp/examples/minimal_build/minimal.dockerfile      |   2 +-
 .../minimal_build/system_dependency.dockerfile     |   2 +-
 cpp/examples/parquet/parquet_arrow/CMakeLists.txt  |   2 +-
 cpp/examples/tutorial_examples/CMakeLists.txt      |   2 +-
 cpp/examples/tutorial_examples/tutorial.dockerfile |   2 +-
 .../apache-arrow/apt/ubuntu-jammy/Dockerfile       |  10 ++
 .../apache-arrow/yum/amazon-linux-2023/Dockerfile  |   6 +
 .../apache-arrow/yum/centos-7/Dockerfile           |   6 +
 dev/tasks/python-wheels/github.osx.yml             |   2 +-
 dev/tasks/tasks.yml                                |   4 +-
 dev/tasks/vcpkg-tests/github.windows.yml           |   2 +-
 docker-compose.yml                                 |  15 +-
 docs/source/cpp/build_system.rst                   |   2 +-
 matlab/CMakeLists.txt                              |   2 +-
 python/CMakeLists.txt                              |   2 +-
 python/examples/minimal_build/Dockerfile.ubuntu    |   5 +-
 python/examples/minimal_build/README.md            |   2 +-
 r/configure.win                                    |   7 +-
 r/tools/nixlibs.R                                  |  10 +-
 39 files changed, 474 insertions(+), 73 deletions(-)

diff --git a/.env b/.env
index a94803cc32..ce10b3e199 100644
--- a/.env
+++ b/.env
@@ -54,6 +54,7 @@ UBUNTU=22.04
 
 # Default versions for various dependencies
 CLANG_TOOLS=14
+CMAKE=3.25.0
 CUDA=11.2.2
 DASK=latest
 DOTNET=8.0
diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index e56bcc09d4..b0072791b3 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -156,7 +156,7 @@ jobs:
 
   build-example:
     name: C++ Minimal Build Example
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
     timeout-minutes: 45
     steps:
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 6a8cc05ca6..a62e06a7e2 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -41,7 +41,7 @@ jobs:
 
   lint:
     name: Lint C++, Python, R, Docker, RAT
-    runs-on: ubuntu-latest
+    runs-on: ubuntu-24.04
     if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
     timeout-minutes: 15
     steps:
diff --git a/ci/docker/centos-7-cpp.dockerfile 
b/ci/docker/centos-7-cpp.dockerfile
index 1f30eed694..b012a5abed 100644
--- a/ci/docker/centos-7-cpp.dockerfile
+++ b/ci/docker/centos-7-cpp.dockerfile
@@ -37,7 +37,6 @@ RUN \
     -e 's/mirror\.centos\.org/vault.centos.org/' \
     /etc/yum.repos.d/CentOS-SCLo-scl*.repo && \
   yum install -y \
-    cmake3 \
     curl \
     devtoolset-8 \
     diffutils \
@@ -49,9 +48,13 @@ RUN \
     wget \
     which
 
+ARG cmake
+COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local/
+
 COPY ci/scripts/install_sccache.sh /arrow/ci/scripts/
 RUN bash /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin
 
 ENV \
   ARROW_R_DEV=TRUE \
-  CMAKE=/usr/bin/cmake3
+  CMAKE=/usr/local/bin/cmake
diff --git a/ci/docker/linux-r.dockerfile b/ci/docker/linux-r.dockerfile
index 7b7e989adc..da378eac43 100644
--- a/ci/docker/linux-r.dockerfile
+++ b/ci/docker/linux-r.dockerfile
@@ -51,6 +51,10 @@ RUN /arrow/ci/scripts/r_docker_configure.sh
 COPY ci/scripts/install_sccache.sh /arrow/ci/scripts/
 RUN /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin
 
+ARG cmake
+COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local/
+
 COPY ci/scripts/r_deps.sh /arrow/ci/scripts/
 COPY r/DESCRIPTION /arrow/r/
 RUN /arrow/ci/scripts/r_deps.sh /arrow
diff --git a/ci/docker/python-wheel-manylinux.dockerfile 
b/ci/docker/python-wheel-manylinux.dockerfile
index 0b5645285b..ffcaa8c0a0 100644
--- a/ci/docker/python-wheel-manylinux.dockerfile
+++ b/ci/docker/python-wheel-manylinux.dockerfile
@@ -53,7 +53,7 @@ ENV 
PATH=/opt/python/${CPYTHON_VERSION}-${CPYTHON_VERSION}/bin:${PATH}
 # Install CMake
 ARG cmake=3.29.2
 COPY ci/scripts/install_cmake.sh arrow/ci/scripts/
-RUN /arrow/ci/scripts/install_cmake.sh ${arch} linux ${cmake} /usr/local
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local
 
 # Install Ninja
 ARG ninja=1.10.2
diff --git a/ci/docker/ubuntu-20.04-cpp-minimal.dockerfile 
b/ci/docker/ubuntu-20.04-cpp-minimal.dockerfile
index 1b342df596..79a0c786aa 100644
--- a/ci/docker/ubuntu-20.04-cpp-minimal.dockerfile
+++ b/ci/docker/ubuntu-20.04-cpp-minimal.dockerfile
@@ -27,7 +27,6 @@ RUN apt-get update -y -q && \
     apt-get install -y -q \
         build-essential \
         ccache \
-        cmake \
         curl \
         gdb \
         git \
@@ -68,6 +67,10 @@ RUN latest_system_llvm=10 && \
     apt-get clean && \
     rm -rf /var/lib/apt/lists*
 
+ARG cmake
+COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local/
+
 COPY ci/scripts/install_minio.sh /arrow/ci/scripts/
 RUN /arrow/ci/scripts/install_minio.sh latest /usr/local
 
diff --git a/ci/docker/ubuntu-20.04-cpp.dockerfile 
b/ci/docker/ubuntu-20.04-cpp.dockerfile
index 259c5fb77f..db7e03b8bf 100644
--- a/ci/docker/ubuntu-20.04-cpp.dockerfile
+++ b/ci/docker/ubuntu-20.04-cpp.dockerfile
@@ -67,7 +67,6 @@ RUN apt-get update -y -q && \
         autoconf \
         ca-certificates \
         ccache \
-        cmake \
         curl \
         g++ \
         gcc \
@@ -121,6 +120,10 @@ RUN apt-get update -y -q && \
     apt-get clean && \
     rm -rf /var/lib/apt/lists*
 
+ARG cmake
+COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local/
+
 COPY ci/scripts/install_minio.sh /arrow/ci/scripts/
 RUN /arrow/ci/scripts/install_minio.sh latest /usr/local
 
diff --git a/ci/docker/ubuntu-22.04-cpp-minimal.dockerfile 
b/ci/docker/ubuntu-22.04-cpp-minimal.dockerfile
index ce31c457e9..2a90a5637d 100644
--- a/ci/docker/ubuntu-22.04-cpp-minimal.dockerfile
+++ b/ci/docker/ubuntu-22.04-cpp-minimal.dockerfile
@@ -68,6 +68,10 @@ RUN latest_system_llvm=14 && \
     apt-get clean && \
     rm -rf /var/lib/apt/lists*
 
+ARG cmake
+COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local/
+
 COPY ci/scripts/install_minio.sh /arrow/ci/scripts/
 RUN /arrow/ci/scripts/install_minio.sh latest /usr/local
 
diff --git a/ci/docker/ubuntu-22.04-cpp.dockerfile 
b/ci/docker/ubuntu-22.04-cpp.dockerfile
index 721b37dcae..4a3d311acb 100644
--- a/ci/docker/ubuntu-22.04-cpp.dockerfile
+++ b/ci/docker/ubuntu-22.04-cpp.dockerfile
@@ -71,7 +71,6 @@ RUN apt-get update -y -q && \
         ceph \
         ceph-fuse \
         ceph-mds \
-        cmake \
         curl \
         gdb \
         git \
@@ -168,6 +167,10 @@ RUN if [ "${gcc}" = "" ]; then \
 # make sure zlib is cached in the EMSDK folder
 RUN source ~/emsdk/emsdk_env.sh && embuilder --pic build zlib
 
+ARG cmake
+COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local/
+
 COPY ci/scripts/install_minio.sh /arrow/ci/scripts/
 RUN /arrow/ci/scripts/install_minio.sh latest /usr/local
 
diff --git a/ci/docker/ubuntu-22.04-verify-rc.dockerfile 
b/ci/docker/ubuntu-22.04-verify-rc.dockerfile
index 8bc6f39b67..b9f130d24e 100644
--- a/ci/docker/ubuntu-22.04-verify-rc.dockerfile
+++ b/ci/docker/ubuntu-22.04-verify-rc.dockerfile
@@ -24,3 +24,7 @@ RUN /setup-ubuntu.sh && \
     rm /setup-ubuntu.sh && \
     apt-get clean && \
     rm -rf /var/lib/apt/lists*
+
+ARG cmake
+COPY ci/scripts/install_cmake.sh /arrow/ci/scripts/
+RUN /arrow/ci/scripts/install_cmake.sh ${cmake} /usr/local/
diff --git a/ci/rtools/README.md b/ci/rtools/README.md
new file mode 100644
index 0000000000..08b5ea7f51
--- /dev/null
+++ b/ci/rtools/README.md
@@ -0,0 +1,35 @@
+<!---
+  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.
+-->
+
+# rtools40 patches for AWS SDK and related libs
+
+The patches in this directory are solely for the purpose of building Arrow C++
+under [Rtools40](https://cran.r-project.org/bin/windows/Rtools/rtools40.html)
+and not used elsewhere. Once we've dropped support for Rtools40, we can 
consider
+removing these patches.
+
+The larger reason these patches are needed is that Rtools provides their own
+packages and their versions of the AWS libraries weren't compatible with CMake
+3.25. Our solution was to bundle the AWS libs instead and these patches were
+required to get them building under the Rtools40 environment.
+
+The patches were added while upgrading the minimum required CMake version to
+3.25 in [GH-44950](https://github.com/apache/arrow/issues/44950). Please see 
the
+associated PR, [GH-44989](https://github.com/apache/arrow/pull/44989), for more
+context.
diff --git a/cpp/examples/minimal_build/minimal.dockerfile 
b/ci/rtools/aws_c_common_ep.patch
similarity index 56%
copy from cpp/examples/minimal_build/minimal.dockerfile
copy to ci/rtools/aws_c_common_ep.patch
index 9361fc5e81..94c84d0fe1 100644
--- a/cpp/examples/minimal_build/minimal.dockerfile
+++ b/ci/rtools/aws_c_common_ep.patch
@@ -15,13 +15,25 @@
 # specific language governing permissions and limitations
 # under the License.
 
-FROM ubuntu:focal
+diff --git a/include/aws/common/byte_order.inl 
b/include/aws/common/byte_order.inl
+index 1204be0..0abd9cb 100644
+--- a/include/aws/common/byte_order.inl
++++ b/include/aws/common/byte_order.inl
+@@ -13,7 +13,7 @@
+ #    include <stdlib.h>
+ #else
+ #    include <netinet/in.h>
+-#endif /* _MSC_VER */
++#endif /* _WIN32 */
 
-ENV DEBIAN_FRONTEND=noninteractive
+ AWS_EXTERN_C_BEGIN
 
-RUN apt-get update -y -q && \
-    apt-get install -y -q --no-install-recommends \
-      build-essential \
-      cmake \
-      pkg-config && \
-    apt-get clean && rm -rf /var/lib/apt/lists*
+@@ -39,7 +39,7 @@ AWS_STATIC_IMPL uint64_t aws_hton64(uint64_t x) {
+     uint64_t v;
+     __asm__("bswap %q0" : "=r"(v) : "0"(x));
+     return v;
+-#elif defined(_MSC_VER)
++#elif defined(_WIN32)
+     return _byteswap_uint64(x);
+ #else
+     uint32_t low = x & UINT32_MAX;
diff --git a/ci/rtools/aws_c_io_ep.patch b/ci/rtools/aws_c_io_ep.patch
new file mode 100644
index 0000000000..a15d706ba1
--- /dev/null
+++ b/ci/rtools/aws_c_io_ep.patch
@@ -0,0 +1,56 @@
+# 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.
+
+diff --git a/source/windows/secure_channel_tls_handler.c 
b/source/windows/secure_channel_tls_handler.c
+index 50caf02..29fe850 100644
+--- a/source/windows/secure_channel_tls_handler.c
++++ b/source/windows/secure_channel_tls_handler.c
+@@ -35,6 +36,25 @@
+ #    pragma warning(disable : 4306) /* Identifier is type cast to a larger 
pointer. */
+ #endif
+
++#ifndef SP_PROT_TLS1_0_SERVER
++#define SP_PROT_TLS1_0_SERVER SP_PROT_TLS1_SERVER
++#endif
++#ifndef SP_PROT_TLS1_0_CLIENT
++#define SP_PROT_TLS1_0_CLIENT SP_PROT_TLS1_CLIENT
++#endif
++#ifndef SP_PROT_TLS1_1_SERVER
++#define SP_PROT_TLS1_1_SERVER 0x00000100
++#endif
++#ifndef SP_PROT_TLS1_1_CLIENT
++#define SP_PROT_TLS1_1_CLIENT 0x00000200
++#endif
++#ifndef SCH_USE_STRONG_CRYPTO
++#define SCH_USE_STRONG_CRYPTO 0x00400000
++#endif
++#ifndef SECBUFFER_ALERT
++#define SECBUFFER_ALERT 0x11
++#endif
++
+ #define KB_1 1024
+ #define READ_OUT_SIZE (16 * KB_1)
+ #define READ_IN_SIZE READ_OUT_SIZE
+@@ -456,7 +476,7 @@ static int s_fillin_alpn_data(
+ 
+     *extension_length += sizeof(uint32_t) + sizeof(uint16_t);
+ 
+-    *extension_name = SecApplicationProtocolNegotiationExt_ALPN;
++    *extension_name = 2;
+     /*now add the protocols*/
+     for (size_t i = 0; i < protocols_count; ++i) {
+         struct aws_byte_cursor *protocol_ptr = NULL;
diff --git a/ci/rtools/awssdk_ep.patch b/ci/rtools/awssdk_ep.patch
new file mode 100644
index 0000000000..bd26f85329
--- /dev/null
+++ b/ci/rtools/awssdk_ep.patch
@@ -0,0 +1,181 @@
+# 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.
+
+diff --git a/aws-cpp-sdk-core/include/aws/core/utils/Array.h 
b/aws-cpp-sdk-core/include/aws/core/utils/Array.h
+index 2b5bbc566..7cb93bdf0 100644
+--- a/aws-cpp-sdk-core/include/aws/core/utils/Array.h
++++ b/aws-cpp-sdk-core/include/aws/core/utils/Array.h
+@@ -54,7 +54,7 @@ namespace Aws
+                 {
+                     m_data.reset(Aws::NewArray<T>(m_size, 
ARRAY_ALLOCATION_TAG));
+
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                     std::copy(arrayToCopy, arrayToCopy + arraySize, 
stdext::checked_array_iterator< T * >(m_data.get(), m_size));
+ #else
+                     std::copy(arrayToCopy, arrayToCopy + arraySize, 
m_data.get());
+@@ -82,7 +82,7 @@ namespace Aws
+                     if(arr->m_size > 0 && arr->m_data)
+                     {
+                         size_t arraySize = arr->m_size;
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                         std::copy(arr->m_data.get(), arr->m_data.get() + 
arraySize, stdext::checked_array_iterator< T * >(m_data.get() + location, 
m_size));
+ #else
+                         std::copy(arr->m_data.get(), arr->m_data.get() + 
arraySize, m_data.get() + location);
+@@ -101,7 +101,7 @@ namespace Aws
+                 {
+                     m_data.reset(Aws::NewArray<T>(m_size, 
ARRAY_ALLOCATION_TAG));
+
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                     std::copy(other.m_data.get(), other.m_data.get() + 
other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
+ #else
+                     std::copy(other.m_data.get(), other.m_data.get() + 
other.m_size, m_data.get());
+@@ -134,7 +134,7 @@ namespace Aws
+                 {
+                     m_data.reset(Aws::NewArray<T>(m_size, 
ARRAY_ALLOCATION_TAG));
+
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                     std::copy(other.m_data.get(), other.m_data.get() + 
other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
+ #else
+                     std::copy(other.m_data.get(), other.m_data.get() + 
other.m_size, m_data.get());
+diff --git a/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp 
b/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
+index 4dade6489..a0456cf8e 100644
+--- a/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
++++ b/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
+@@ -22,6 +22,16 @@
+ #include <sstream>
+ #include <iostream>
+
++#ifndef WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL
++#define WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL 116
++#endif
++#ifndef WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1
++#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
++#endif
++#ifndef WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2
++#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
++#endif
++
+ using namespace Aws::Client;
+ using namespace Aws::Http;
+ using namespace Aws::Http::Standard;
+@@ -272,7 +282,7 @@ bool WinHttpSyncHttpClient::DoQueryHeaders(void* 
hHttpRequest, std::shared_ptr<H
+     wmemset(contentTypeStr, 0, static_cast<size_t>(dwSize / sizeof(wchar_t)));
+
+     WinHttpQueryHeaders(hHttpRequest, WINHTTP_QUERY_CONTENT_TYPE, nullptr, 
&contentTypeStr, &dwSize, 0);
+-    if (contentTypeStr[0] != NULL)
++    if (contentTypeStr[0])
+     {
+         Aws::String contentStr = StringUtils::FromWString(contentTypeStr);
+         response->SetContentType(contentStr);
+@@ -303,7 +313,7 @@ bool WinHttpSyncHttpClient::DoQueryHeaders(void* 
hHttpRequest, std::shared_ptr<H
+
+ bool WinHttpSyncHttpClient::DoSendRequest(void* hHttpRequest) const
+ {
+-    return (WinHttpSendRequest(hHttpRequest, NULL, NULL, 0, 0, 0, NULL) != 0);
++    return (WinHttpSendRequest(hHttpRequest, NULL, 0, NULL, 0, 0, 0) != 0);
+ }
+
+ bool WinHttpSyncHttpClient::DoReadData(void* hHttpRequest, char* body, 
uint64_t size, uint64_t& read) const
+diff --git a/aws-cpp-sdk-core/source/http/windows/WinINetSyncHttpClient.cpp 
b/aws-cpp-sdk-core/source/http/windows/WinINetSyncHttpClient.cpp
+index 5854cc334..70184a358 100644
+--- a/aws-cpp-sdk-core/source/http/windows/WinINetSyncHttpClient.cpp
++++ b/aws-cpp-sdk-core/source/http/windows/WinINetSyncHttpClient.cpp
+@@ -225,7 +225,7 @@ bool WinINetSyncHttpClient::DoQueryHeaders(void* 
hHttpRequest, std::shared_ptr<H
+     char contentTypeStr[1024];
+     dwSize = sizeof(contentTypeStr);
+     HttpQueryInfoA(hHttpRequest, HTTP_QUERY_CONTENT_TYPE, &contentTypeStr, 
&dwSize, 0);
+-    if (contentTypeStr[0] != NULL)
++    if (contentTypeStr[0])
+     {
+         response->SetContentType(contentTypeStr);
+         AWS_LOGSTREAM_DEBUG(GetLogTag(), "Received content type " << 
contentTypeStr);
+diff --git a/aws-cpp-sdk-core/source/http/windows/WinSyncHttpClient.cpp 
b/aws-cpp-sdk-core/source/http/windows/WinSyncHttpClient.cpp
+index d7513cc3c..e390a8d4e 100644
+--- a/aws-cpp-sdk-core/source/http/windows/WinSyncHttpClient.cpp
++++ b/aws-cpp-sdk-core/source/http/windows/WinSyncHttpClient.cpp
+@@ -349,7 +349,7 @@ std::shared_ptr<HttpResponse> 
WinSyncHttpClient::MakeRequest(const std::shared_p
+         }
+     }
+
+-    if (!success && !IsRequestProcessingEnabled() || 
!ContinueRequest(*request))
++    if ((!success && !IsRequestProcessingEnabled()) || 
!ContinueRequest(*request))
+     {
+         response->SetClientErrorType(CoreErrors::USER_CANCELLED);
+         response->SetClientErrorMessage("Request processing disabled or 
continuation cancelled by user's continuation handler.");
+diff --git a/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp 
b/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
+index 2ea82de6f..bc423441e 100644
+--- a/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
++++ b/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
+@@ -11,7 +11,9 @@
+ #include <iostream>
+ #include <Userenv.h>
+
++#ifdef _MSC_VER
+ #pragma warning( disable : 4996)
++#endif
+
+ using namespace Aws::Utils;
+ namespace Aws
+@@ -304,6 +306,9 @@ Aws::String CreateTempFilePath()
+ {
+ #ifdef _MSC_VER
+ #pragma warning(disable: 4996) // _CRT_SECURE_NO_WARNINGS
++#elif !defined(L_tmpnam_s)
++    // Definition from the MSVC stdio.h
++    #define L_tmpnam_s (sizeof("\\") + 16)
+ #endif
+     char s_tempName[L_tmpnam_s+1];
+
+diff --git a/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp 
b/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp
+index 0180f7fbf..3adbab313 100644
+--- a/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp
++++ b/aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp
+@@ -9,7 +9,9 @@
+
+ #include <iomanip>
+
++#ifdef _MSC_VER
+ #pragma warning(disable: 4996)
++#endif
+ #include <windows.h>
+ #include <stdio.h>
+ namespace Aws
+diff --git a/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp 
b/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
+index 2ee517b48..3b0dce665 100644
+--- a/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
++++ b/aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
+@@ -939,7 +939,7 @@ std::shared_ptr<Aws::Utils::Crypto::HMAC> 
Aws::Utils::Crypto::CreateSha256HMACIm
+     return GetSha256HMACFactory()->CreateImplementation();
+ }
+
+-#ifdef _WIN32
++#ifdef _MSC_VER
+ #pragma warning( push )
+ #pragma warning( disable : 4702 )
+ #endif
+@@ -1032,7 +1032,7 @@ std::shared_ptr<SymmetricCipher> 
Aws::Utils::Crypto::CreateAES_KeyWrapImplementa
+     return GetAES_KeyWrapFactory()->CreateImplementation(key);
+ }
+
+-#ifdef _WIN32
++#ifdef _MSC_VER
+ #pragma warning(pop)
+ #endif
diff --git a/ci/scripts/PKGBUILD b/ci/scripts/PKGBUILD
index efeed95400..a4b4162d13 100644
--- a/ci/scripts/PKGBUILD
+++ b/ci/scripts/PKGBUILD
@@ -24,8 +24,7 @@ pkgdesc="Apache Arrow is a cross-language development 
platform for in-memory dat
 arch=("any")
 url="https://arrow.apache.org/";
 license=("Apache-2.0")
-depends=("${MINGW_PACKAGE_PREFIX}-aws-sdk-cpp"
-         "${MINGW_PACKAGE_PREFIX}-bzip2"
+depends=("${MINGW_PACKAGE_PREFIX}-bzip2"
          "${MINGW_PACKAGE_PREFIX}-curl" # for google-cloud-cpp bundled build
          "${MINGW_PACKAGE_PREFIX}-libutf8proc"
          "${MINGW_PACKAGE_PREFIX}-re2"
@@ -36,7 +35,6 @@ depends=("${MINGW_PACKAGE_PREFIX}-aws-sdk-cpp"
          "${MINGW_PACKAGE_PREFIX}-zstd"
          "${MINGW_PACKAGE_PREFIX}-brotli")
 makedepends=("${MINGW_PACKAGE_PREFIX}-ccache"
-             "${MINGW_PACKAGE_PREFIX}-cmake"
              "${MINGW_PACKAGE_PREFIX}-gcc")
 options=("staticlibs" "strip" "!buildflags")
 
@@ -82,8 +80,18 @@ build() {
   # CMAKE_UNITY_BUILD is set to OFF as otherwise some compute functionality
   # segfaults in tests
 
+  # We use the bundled AWS SDK instead of the MINGW one because the upstream
+  # one on rtools packages is unmaintained, uses an old version (1.7.365)
+  # and does not work with newer versions of CMake. See comments:
+  # https://github.com/apache/arrow/pull/44989/files#r1901428998
+
+  # MSYS2_ARG_CONV_EXCL is needed to prevent autoconverting 
CMAKE_INSTALL_PREFIX
+  # to Windows paths. See 
https://www.msys2.org/docs/filesystem-paths/#process-arguments
+
+  # We require the full path to the CMake executable in order to build Arrow
+  # which is in the Program Files directory: "/c/Program Files/CMake/bin/cmake"
   MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
-    ${MINGW_PREFIX}/bin/cmake.exe \
+    "${PROGRAMFILES}\CMake\bin\cmake.exe" \
     ${ARROW_CPP_DIR} \
     -G "MSYS Makefiles" \
     -DARROW_ACERO=ON \
@@ -116,6 +124,7 @@ build() {
     -DARROW_WITH_BZ2=ON \
     -DARROW_ZSTD_USE_SHARED=OFF \
     -DARROW_CXXFLAGS="${CPPFLAGS}" \
+    -DAWSSDK_SOURCE=BUNDLED \
     -DCMAKE_BUILD_TYPE="release" \
     -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
     -DCMAKE_UNITY_BUILD=OFF \
diff --git a/ci/scripts/install_cmake.sh b/ci/scripts/install_cmake.sh
index 7fdb06d90f..d01a7a744d 100755
--- a/ci/scripts/install_cmake.sh
+++ b/ci/scripts/install_cmake.sh
@@ -17,29 +17,44 @@
 # specific language governing permissions and limitations
 # under the License.
 
-set -e
+set -ex
+
+if [ "$#" -ne 2 ]; then
+  echo "Usage: $0 <version> <prefix>"
+  exit 1
+fi
 
 declare -A archs
-archs=([amd64]=x86_64
-       [arch64]=aarch64
+archs=([x86_64]=x86_64
        [arm64]=aarch64
-       [arm64v8]=aarch64
-       [x86_64]=x86_64)
-
-declare -A platforms
-platforms=([linux]=linux
-           [macos]=macos
-           [windows]=windows)
+       [aarch64]=aarch64)
 
-if [ "$#" -ne 4 ]; then
-  echo "Usage: $0 <architecture> <platform> <version> <prefix>"
-  exit 1
+arch=$(uname -m)
+if [ -z ${archs[$arch]} ]; then
+  echo "Unsupported architecture: ${arch}"
+  exit 0
 fi
+arch=${archs[$arch]}
+
+version=$1
+prefix=$2
 
-arch=${archs[$1]}
-platform=${platforms[$2]}
-version=$3
-prefix=$4
+platform=$(uname)
+case ${platform} in
+  Linux)
+    platform=linux
+    ;;
+  Darwin)
+    platform=macos
+    ;;
+  MSYS_NT*|MINGW64_NT*)
+    platform=windows
+    ;;
+  *)
+    echo "Unsupported platform: ${platform}"
+    exit 0
+    ;;
+esac
 
 mkdir -p ${prefix}
 
url="https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-";
diff --git a/ci/scripts/r_windows_build.sh b/ci/scripts/r_windows_build.sh
index c9395eb243..af29858bfe 100755
--- a/ci/scripts/r_windows_build.sh
+++ b/ci/scripts/r_windows_build.sh
@@ -23,13 +23,8 @@ set -ex
 # Make sure it is absolute and exported
 export ARROW_HOME="$(cd "${ARROW_HOME}" && pwd)"
 
-# Uncomment L38-41 if you're testing a new rtools dependency that hasn't yet 
sync'd to CRAN
-# curl 
https://raw.githubusercontent.com/r-windows/rtools-packages/master/pacman.conf 
> /etc/pacman.conf
-# curl -OSsl 
"http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz";
-# pacman -U --noconfirm msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz && rm 
msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
-# pacman --noconfirm -Scc
-
 pacman --noconfirm -Syy
+
 RWINLIB_LIB_DIR="lib"
 : ${MINGW_ARCH:="mingw32 mingw64 ucrt64"}
 
@@ -71,7 +66,7 @@ if [ -d mingw64/lib/ ]; then
   # Move the 64-bit versions of libarrow into the expected location
   mv mingw64/lib/*.a $DST_DIR/lib/x64
   # These are from https://dl.bintray.com/rtools/mingw{32,64}/
-  cp 
$MSYS_LIB_DIR/mingw64/lib/lib{thrift,snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,aws*,nghttp2}.a
 $DST_DIR/lib/x64
+  cp 
$MSYS_LIB_DIR/mingw64/lib/lib{thrift,snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a
 $DST_DIR/lib/x64
 fi
 
 # Same for the 32-bit versions
@@ -79,7 +74,7 @@ if [ -d mingw32/lib/ ]; then
   ls $MSYS_LIB_DIR/mingw32/lib/
   mkdir -p $DST_DIR/lib/i386
   mv mingw32/lib/*.a $DST_DIR/lib/i386
-  cp 
$MSYS_LIB_DIR/mingw32/lib/lib{thrift,snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,aws*,nghttp2}.a
 $DST_DIR/lib/i386
+  cp 
$MSYS_LIB_DIR/mingw32/lib/lib{thrift,snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a
 $DST_DIR/lib/i386
 fi
 
 # Do the same also for ucrt64
@@ -87,7 +82,7 @@ if [ -d ucrt64/lib/ ]; then
   ls $MSYS_LIB_DIR/ucrt64/lib/
   mkdir -p $DST_DIR/lib/x64-ucrt
   mv ucrt64/lib/*.a $DST_DIR/lib/x64-ucrt
-  cp 
$MSYS_LIB_DIR/ucrt64/lib/lib{thrift,snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,aws*,nghttp2}.a
 $DST_DIR/lib/x64-ucrt
+  cp 
$MSYS_LIB_DIR/ucrt64/lib/lib{thrift,snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a
 $DST_DIR/lib/x64-ucrt
 fi
 
 # Create build artifact
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index a7d80c2e96..f2500b3a72 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.25)
 message(STATUS "Building using CMake version: ${CMAKE_VERSION}")
 
 # https://www.cmake.org/cmake/help/latest/policy/CMP0025.html
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 3f169900b1..279d2c0fdf 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -4646,6 +4646,10 @@ function(build_orc)
     set(ZLIB_HOME
         ${ZLIB_ROOT}
         CACHE STRING "" FORCE)
+    # From CMake 3.21 onwards the set(CACHE) command does not remove any normal
+    # variable of the same name from the current scope. We have to manually 
remove
+    # the variable via unset to avoid ORC not finding the ZLIB_LIBRARY.
+    unset(ZLIB_LIBRARY)
     set(ZLIB_LIBRARY
         ZLIB::ZLIB
         CACHE STRING "" FORCE)
@@ -5050,6 +5054,18 @@ macro(build_awssdk)
     string(APPEND AWS_C_FLAGS " -Wno-deprecated")
     string(APPEND AWS_CXX_FLAGS " -Wno-deprecated")
   endif()
+  # GH-44950: This is required to build under Rtools40 and we may be able to
+  # remove it if/when we no longer need to build under Rtools40
+  if(WIN32 AND NOT MSVC)
+    string(APPEND
+           AWS_C_FLAGS
+           " -D_WIN32_WINNT=0x0601 -D__USE_MINGW_ANSI_STDIO=1 -Wno-error 
-Wno-error=format= -Wno-error=format-extra-args -Wno-unused-local-typedefs 
-Wno-unused-variable"
+    )
+    string(APPEND
+           AWS_CXX_FLAGS
+           " -D_WIN32_WINNT=0x0601 -D__USE_MINGW_ANSI_STDIO=1 -Wno-error 
-Wno-error=format= -Wno-error=format-extra-args -Wno-unused-local-typedefs 
-Wno-unused-variable"
+    )
+  endif()
 
   set(AWSSDK_COMMON_CMAKE_ARGS
       ${EP_COMMON_CMAKE_ARGS}
@@ -5087,6 +5103,28 @@ macro(build_awssdk)
   endif()
   list(APPEND AWSSDK_PATCH_COMMAND ${AWSSDK_UNUSED_DIRECTORIES})
 
+  # Patch parts of the AWSSDK EP so it builds cleanly under Rtools40
+  if(WIN32 AND NOT MSVC)
+    find_program(PATCH patch REQUIRED)
+    # Patch aws_c_common to build under Rtools40
+    set(AWS_C_COMMON_PATCH_COMMAND ${PATCH} -p1 -i
+                                   
${CMAKE_SOURCE_DIR}/../ci/rtools/aws_c_common_ep.patch)
+    message(STATUS "Hello ${AWS_C_COMMON_PATCH_COMMAND}")
+    # aws_c_io_ep to build under Rtools40
+    set(AWS_C_IO_PATCH_COMMAND ${PATCH} -p1 -i
+                               
${CMAKE_SOURCE_DIR}/../ci/rtools/aws_c_io_ep.patch)
+    message(STATUS "Hello ${AWS_C_IO_PATCH_COMMAND}")
+    # awssdk_ep to build under Rtools40
+    list(APPEND
+         AWSSDK_PATCH_COMMAND
+         &&
+         ${PATCH}
+         -p1
+         -i
+         ${CMAKE_SOURCE_DIR}/../ci/rtools/awssdk_ep.patch)
+    message(STATUS "Hello ${AWSSDK_PATCH_COMMAND}")
+  endif()
+
   if(UNIX)
     # on Linux and macOS curl seems to be required
     find_curl()
@@ -5181,6 +5219,7 @@ macro(build_awssdk)
                       ${EP_COMMON_OPTIONS}
                       URL ${AWS_C_COMMON_SOURCE_URL}
                       URL_HASH 
"SHA256=${ARROW_AWS_C_COMMON_BUILD_SHA256_CHECKSUM}"
+                      PATCH_COMMAND ${AWS_C_COMMON_PATCH_COMMAND}
                       CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS}
                       BUILD_BYPRODUCTS ${AWS_C_COMMON_STATIC_LIBRARY})
   add_dependencies(AWS::aws-c-common aws_c_common_ep)
@@ -5276,6 +5315,7 @@ macro(build_awssdk)
                       ${EP_COMMON_OPTIONS}
                       URL ${AWS_C_IO_SOURCE_URL}
                       URL_HASH "SHA256=${ARROW_AWS_C_IO_BUILD_SHA256_CHECKSUM}"
+                      PATCH_COMMAND ${AWS_C_IO_PATCH_COMMAND}
                       CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS}
                       BUILD_BYPRODUCTS ${AWS_C_IO_STATIC_LIBRARY}
                       DEPENDS ${AWS_C_IO_DEPENDS})
diff --git a/cpp/examples/minimal_build/minimal.dockerfile 
b/cpp/examples/minimal_build/minimal.dockerfile
index 9361fc5e81..8062e9b698 100644
--- a/cpp/examples/minimal_build/minimal.dockerfile
+++ b/cpp/examples/minimal_build/minimal.dockerfile
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-FROM ubuntu:focal
+FROM ubuntu:24.04
 
 ENV DEBIAN_FRONTEND=noninteractive
 
diff --git a/cpp/examples/minimal_build/system_dependency.dockerfile 
b/cpp/examples/minimal_build/system_dependency.dockerfile
index 926fcaf6f4..84a16c4902 100644
--- a/cpp/examples/minimal_build/system_dependency.dockerfile
+++ b/cpp/examples/minimal_build/system_dependency.dockerfile
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-FROM ubuntu:focal
+FROM ubuntu:24.04
 
 ENV DEBIAN_FRONTEND=noninteractive
 
diff --git a/cpp/examples/parquet/parquet_arrow/CMakeLists.txt 
b/cpp/examples/parquet/parquet_arrow/CMakeLists.txt
index 0480391e38..189d17914d 100644
--- a/cpp/examples/parquet/parquet_arrow/CMakeLists.txt
+++ b/cpp/examples/parquet/parquet_arrow/CMakeLists.txt
@@ -16,7 +16,7 @@
 # under the License.
 
 # Require cmake that supports BYPRODUCTS in add_custom_command, 
ExternalProject_Add [1].
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.25)
 
 project(parquet_arrow_example)
 
diff --git a/cpp/examples/tutorial_examples/CMakeLists.txt 
b/cpp/examples/tutorial_examples/CMakeLists.txt
index 8788501484..a6f8350c41 100644
--- a/cpp/examples/tutorial_examples/CMakeLists.txt
+++ b/cpp/examples/tutorial_examples/CMakeLists.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.25)
 
 project(ArrowTutorialExamples)
 
diff --git a/cpp/examples/tutorial_examples/tutorial.dockerfile 
b/cpp/examples/tutorial_examples/tutorial.dockerfile
index 9361fc5e81..8062e9b698 100644
--- a/cpp/examples/tutorial_examples/tutorial.dockerfile
+++ b/cpp/examples/tutorial_examples/tutorial.dockerfile
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-FROM ubuntu:focal
+FROM ubuntu:24.04
 
 ENV DEBIAN_FRONTEND=noninteractive
 
diff --git a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile 
b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile
index 1d9065d6b2..64db49c358 100644
--- a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile
+++ b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile
@@ -34,6 +34,7 @@ RUN \
     build-essential \
     clang \
     cmake \
+    curl \
     debhelper \
     devscripts \
     gi-docgen \
@@ -82,3 +83,12 @@ RUN \
   fi && \
   apt clean && \
   rm -rf /var/lib/apt/lists/*
+
+# We install CMake via apt and create a symbolic link to avoid having to:
+# Temporarily remove the build-depends check on control.in
+# Create the link on debian rules as --buildsystem=cmake expects cmake on 
/usr/bin
+ARG cmake=3.25.0
+RUN curl -L \
+    
"https://github.com/Kitware/CMake/releases/download/v${cmake}/cmake-${cmake}-linux-$(uname
 -m).tar.gz" | \
+    tar -xzf - --directory /usr/local --strip-components=1 && \
+    ln -fs /usr/local/bin/cmake /usr/bin/cmake
diff --git 
a/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile 
b/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile
index a19641f8f9..a5664dbbbe 100644
--- a/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile
+++ b/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile
@@ -60,3 +60,9 @@ RUN \
     which \
     zlib-devel && \
   dnf clean ${quiet} all
+
+ARG cmake=3.25.0
+RUN curl -L \
+    
"https://github.com/Kitware/CMake/releases/download/v${cmake}/cmake-${cmake}-linux-$(uname
 -m).tar.gz" | \
+    tar -xzf - --directory /usr/local --strip-components=1 && \
+    ln -fs /usr/local/bin/cmake /usr/bin/cmake
diff --git a/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile 
b/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile
index b10c40937d..56e2f52ff3 100644
--- a/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile
+++ b/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile
@@ -75,6 +75,12 @@ RUN \
     zlib-devel && \
   yum clean ${quiet} all
 
+ARG cmake=3.25.0
+RUN curl -L \
+    
"https://github.com/Kitware/CMake/releases/download/v${cmake}/cmake-${cmake}-linux-$(uname
 -m).tar.gz" | \
+    tar -xzf - --directory /usr/local --strip-components=1 && \
+    ln -fs /usr/local/bin/cmake /usr/bin/cmake3
+
 ENV \
   BOOST_INCLUDEDIR=/usr/include/boost169 \
   BOOST_LIBRARYDIR=/usr/lib64/boost169
diff --git a/dev/tasks/python-wheels/github.osx.yml 
b/dev/tasks/python-wheels/github.osx.yml
index 031bad9422..b353d7f06f 100644
--- a/dev/tasks/python-wheels/github.osx.yml
+++ b/dev/tasks/python-wheels/github.osx.yml
@@ -63,7 +63,7 @@ jobs:
       - name: Install CMake 3.29.0
         shell: bash
         run: |
-          arrow/ci/scripts/install_cmake.sh $(arch) macos 3.29.0 ${PWD}/local
+          arrow/ci/scripts/install_cmake.sh 3.29.0 ${PWD}/local
           echo "${PWD}/local/bin" >> $GITHUB_PATH
 
       - name: Retrieve VCPKG version from arrow/.env
diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml
index 6c57d918eb..ba0cdbabff 100644
--- a/dev/tasks/tasks.yml
+++ b/dev/tasks/tasks.yml
@@ -1344,8 +1344,8 @@ tasks:
     template: docker-tests/github.cuda.yml
     params:
       env:
-        UBUNTU: 22.04
         CUDA: 11.7.1
+        UBUNTU: 22.04
       image: ubuntu-cuda-cpp
 
   test-cuda-python-ubuntu-22.04-cuda-11.7.1:
@@ -1353,8 +1353,8 @@ tasks:
     template: docker-tests/github.cuda.yml
     params:
       env:
-        UBUNTU: 22.04
         CUDA: 11.7.1
+        UBUNTU: 22.04
       image: ubuntu-cuda-python
 
   ############################## Fuzz tests #################################
diff --git a/dev/tasks/vcpkg-tests/github.windows.yml 
b/dev/tasks/vcpkg-tests/github.windows.yml
index af12db5952..0fd4892c0a 100644
--- a/dev/tasks/vcpkg-tests/github.windows.yml
+++ b/dev/tasks/vcpkg-tests/github.windows.yml
@@ -32,7 +32,7 @@ jobs:
       - name: Install CMake 3.29.0
         shell: bash
         run: |
-          arrow/ci/scripts/install_cmake.sh amd64 windows 3.29.0 /c/cmake
+          arrow/ci/scripts/install_cmake.sh 3.29.0 /c/cmake
           echo "c:\\cmake\\bin" >> $GITHUB_PATH
       - name: Download Timezone Database
         shell: bash
diff --git a/docker-compose.yml b/docker-compose.yml
index 468872dc96..52e8558e05 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -390,6 +390,7 @@ services:
         arch: ${ARCH}
         base: "${ARCH}/ubuntu:${UBUNTU}"
         clang_tools: ${CLANG_TOOLS}
+        cmake: ${CMAKE}
         gcc: ${GCC}
         llvm: ${LLVM}
     shm_size: *shm-size
@@ -426,6 +427,7 @@ services:
         arch: ${ARCH}
         base: "${ARCH}/ubuntu:${UBUNTU}"
         clang_tools: ${CLANG_TOOLS}
+        cmake: ${CMAKE}
         gcc: ${GCC}
         llvm: ${LLVM}
     shm_size: *shm-size
@@ -455,6 +457,8 @@ services:
       dockerfile: ci/docker/centos-7-cpp.dockerfile
       cache_from:
         - ${REPO}:centos-7-cpp-static
+      args:
+        cmake: ${CMAKE}
     shm_size: *shm-size
     volumes:
       - .:/arrow:delegated
@@ -477,6 +481,7 @@ services:
       args:
         arch: ${ARCH}
         base: "${ARCH}/ubuntu:${UBUNTU}"
+        cmake: ${CMAKE}
         llvm: ${LLVM}
     shm_size: *shm-size
     ulimits: *ulimits
@@ -571,6 +576,7 @@ services:
         arch: ${ARCH}
         base: nvidia/cuda:${CUDA}-devel-ubuntu${UBUNTU}
         clang_tools: ${CLANG_TOOLS}
+        cmake: ${CMAKE}
         llvm: ${LLVM}
     shm_size: *shm-size
     ulimits: *ulimits
@@ -621,6 +627,7 @@ services:
       args:
         arch: ${ARCH}
         clang_tools: ${CLANG_TOOLS}
+        cmake: ${CMAKE}
         llvm: ${LLVM}
     shm_size: *shm-size
     volumes: *ubuntu-volumes
@@ -700,6 +707,7 @@ services:
       args:
         arch: ${ARCH}
         clang_tools: ${CLANG_TOOLS}
+        cmake: ${CMAKE}
         llvm: ${LLVM}
     shm_size: *shm-size
     volumes: *ubuntu-volumes
@@ -1583,6 +1591,7 @@ services:
         - ${REPO}:r-${R_ORG}-${R_IMAGE}-${R_TAG}
       args:
         base: ${R_ORG}/${R_IMAGE}:${R_TAG}
+        cmake: ${CMAKE}
         r_dev: ${ARROW_R_DEV}
         tz: ${TZ}
         r_prune_deps: ${R_PRUNE_DEPS}
@@ -1616,6 +1625,7 @@ services:
         - ${REPO}:amd64-ubuntu-20.04-r-sanitizer
       args:
         base: wch1/r-debug:latest
+        cmake: ${CMAKE}
         r_bin: RDsan
         tz: ${TZ}
         r_prune_deps: ${R_PRUNE_DEPS}
@@ -1636,6 +1646,7 @@ services:
         - ${REPO}:r-rhub-clang-devel-latest
       args:
         base: rhub/clang-asan
+        cmake: ${CMAKE}
         r_dev: ${ARROW_R_DEV}
         r_bin: R
         tz: ${TZ}
@@ -1667,6 +1678,7 @@ services:
         - ${REPO}:amd64-ubuntu-20.04-r-valgrind
       args:
         base: wch1/r-debug:latest
+        cmake: ${CMAKE}
         r_bin: RDvalgrind
         tz: ${TZ}
     environment:
@@ -2033,8 +2045,9 @@ services:
       cache_from:
         - ${REPO}:${ARCH}-ubuntu-${UBUNTU}-verify-rc
       args:
-        repo: ${REPO}
         arch: ${ARCH}
+        cmake: ${CMAKE}
+        repo: ${REPO}
     volumes:
       - .:/arrow:delegated
       - ${DOCKER_VOLUME_PREFIX}ubuntu-ccache:/ccache:delegated
diff --git a/docs/source/cpp/build_system.rst b/docs/source/cpp/build_system.rst
index e80bca4c94..5f89866a16 100644
--- a/docs/source/cpp/build_system.rst
+++ b/docs/source/cpp/build_system.rst
@@ -46,7 +46,7 @@ file into an executable linked with the Arrow C++ shared 
library:
 
 .. code-block:: cmake
 
-   cmake_minimum_required(VERSION 3.16)
+   cmake_minimum_required(VERSION 3.25)
 
    project(MyExample)
 
diff --git a/matlab/CMakeLists.txt b/matlab/CMakeLists.txt
index cd6d8768d0..07de5a612b 100644
--- a/matlab/CMakeLists.txt
+++ b/matlab/CMakeLists.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-cmake_minimum_required(VERSION 3.20)
+cmake_minimum_required(VERSION 3.25)
 
 # Build the Arrow C++ libraries using ExternalProject_Add.
 function(build_arrow)
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 0b0275f200..ac497e844e 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -18,7 +18,7 @@
 # Includes code assembled from BSD/MIT/Apache-licensed code from some 3rd-party
 # projects, including Kudu, Impala, and libdynd. See python/LICENSE.txt
 
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.25)
 project(pyarrow)
 
 # This is needed for 3.13 free-threading. CMake used to add Python
diff --git a/python/examples/minimal_build/Dockerfile.ubuntu 
b/python/examples/minimal_build/Dockerfile.ubuntu
index 07cd69c082..5c6b113168 100644
--- a/python/examples/minimal_build/Dockerfile.ubuntu
+++ b/python/examples/minimal_build/Dockerfile.ubuntu
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-FROM ubuntu:jammy
+FROM ubuntu:24.04
 
 ENV DEBIAN_FRONTEND=noninteractive
 
@@ -33,7 +33,6 @@ RUN apt-get update -y -q && \
       python3-pip \
       python3-venv \
       tzdata \
+      tzdata-legacy \
       && \
       apt-get clean && rm -rf /var/lib/apt/lists*
-
-RUN pip3 install --no-cache-dir -U pip setuptools
diff --git a/python/examples/minimal_build/README.md 
b/python/examples/minimal_build/README.md
index e9d595b603..2ed7a653e7 100644
--- a/python/examples/minimal_build/README.md
+++ b/python/examples/minimal_build/README.md
@@ -51,7 +51,7 @@ docker compose run --rm minimal-fedora-conda
 docker compose run --rm minimal-fedora-venv
 ```
 
-## Ubuntu 20.04
+## Ubuntu 24.04
 
 First, build the Docker image using:
 ```
diff --git a/r/configure.win b/r/configure.win
index b6ac19faea..a8f8422478 100755
--- a/r/configure.win
+++ b/r/configure.win
@@ -61,10 +61,9 @@ function configure_binaries() {
   OPENSSL_LIBS="-lcrypto -lcrypt32"
   MIMALLOC_LIBS="-lbcrypt -lpsapi"
   BROTLI_LIBS="-lbrotlienc -lbrotlidec -lbrotlicommon" # Common goes last 
since dec and enc depend on it
-  AWS_LIBS="-laws-cpp-sdk-config -laws-cpp-sdk-transfer 
-laws-cpp-sdk-identity-management \
-            -laws-cpp-sdk-cognito-identity -laws-cpp-sdk-sts -laws-cpp-sdk-s3 \
-            -laws-cpp-sdk-core -laws-c-event-stream -laws-checksums 
-laws-c-common \
-            -luserenv -lversion -lws2_32 -lbcrypt -lwininet -lwinhttp"
+  # We build aws-sdk-cpp bundled now, so the AWS libs are included in 
arrow_bundled_dependencies
+  # but we also need to include these Windows system libraries
+  AWS_LIBS="-luserenv -lversion -lws2_32 -lbcrypt -lwininet -lwinhttp 
-lsecur32 -lshlwapi -lncrypt"
   # pkg-config --libs libcurl
   GCS_LIBS="-lcurl -lnormaliz -lssh2 -lgdi32 -lssl -lcrypto -lcrypt32 
-lwldap32 \
             -lz -lws2_32 -lnghttp2 -ldbghelp"
diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index 6c68133cd8..d3b9d2ce12 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -635,12 +635,12 @@ build_libarrow <- function(src_dir, dst_dir) {
   invisible(status)
 }
 
-ensure_cmake <- function(cmake_minimum_required = "3.16") {
+ensure_cmake <- function(cmake_minimum_required = "3.25") {
   cmake <- find_cmake(version_required = cmake_minimum_required)
 
   if (is.null(cmake)) {
     # If not found, download it
-    CMAKE_VERSION <- Sys.getenv("CMAKE_VERSION", "3.26.4")
+    CMAKE_VERSION <- Sys.getenv("CMAKE_VERSION", "3.31.2")
     if (on_macos) {
       postfix <- "-macos-universal.tar.gz"
     } else if (tolower(Sys.info()[["machine"]]) %in% c("arm64", "aarch64")) {
@@ -698,7 +698,7 @@ find_cmake <- function(paths = c(
                          if (on_macos) 
"/Applications/CMake.app/Contents/bin/cmake",
                          Sys.which("cmake3")
                        ),
-                       version_required = "3.16") {
+                       version_required) {
   # Given a list of possible cmake paths, return the first one that exists and 
is new enough
   # version_required should be a string or packageVersion; numeric version
   # can be misleading (e.g. 3.10 is actually 3.1)
@@ -715,7 +715,7 @@ find_cmake <- function(paths = c(
       } else {
         # Keep trying
         lg("Not using cmake found at %s", path, .indent = "****")
-        if (found_version > 0) {
+        if (found_version > "0") {
           lg("Version >= %s required; found %s", version_required, 
found_version, .indent = "*****")
         } else {
           # If cmake_version() couldn't determine version, it returns 0
@@ -737,7 +737,7 @@ cmake_version <- function(cmd = "cmake") {
       package_version(sub(pat, "\\1", raw_version[which_line]))
     },
     error = function(e) {
-      return(0)
+      return("0")
     }
   )
 }

Reply via email to