This is an automated email from the ASF dual-hosted git repository.
pitrou 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 ce1915a915 GH-50388: [C++][CI] Make ccache effective MSVC-based builds
(#50387)
ce1915a915 is described below
commit ce1915a915b93fb60c3caed78a307bbe7cc0f35c
Author: Antoine Pitrou <[email protected]>
AuthorDate: Mon Jul 6 18:49:11 2026 +0200
GH-50388: [C++][CI] Make ccache effective MSVC-based builds (#50387)
### Rationale for this change
By default, C++ debug builds with MSVC output debug information in separate
PDB files. However, that is [not supported by
ccache](https://github.com/ccache/ccache/issues/1040), hence compilation
caching does not work on those builds and they are always slower than desired.
### What changes are included in this PR?
On MSVC-based CI builds, embed debug information in object files instead of
PDB files, to make ccache effective.
### Are these changes tested?
Yes, on existing CI builds.
Sample build times without this PR:
* [AMD64 Windows 2022 AVX2
C++](https://github.com/apache/arrow/actions/runs/28687053996/job/85081568536):
24m33s compilation (31m37s total)
* [AMD64 Windows MSVC
GLib](https://github.com/apache/arrow/actions/runs/28779670304/job/85331985342#logs):
12m47s compilation (15m29s total)
With this PR:
* [AMD64 Windows 2022 AVX2
C++](https://github.com/apache/arrow/actions/runs/28782043058/job/85347470398?pr=50387#logs):
3m43s compilation (11m33s total)
* [AMD64 Windows MSVC
GLib](https://github.com/apache/arrow/actions/runs/28782042798/job/85344623354?pr=50387#logs):
3m25s compilation (5m50s total)
### Are there any user-facing changes?
No.
* GitHub Issue: #50388
Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
.github/workflows/cpp.yml | 2 ++
.github/workflows/cpp_windows.yml | 2 ++
.github/workflows/ruby.yml | 3 +++
ci/scripts/cpp_build.sh | 1 +
cpp/cmake_modules/SetupCxxFlags.cmake | 18 ------------------
5 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index 5ea9083ff4..9ea6a18664 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -27,6 +27,7 @@ on:
paths:
- '.dockerignore'
- '.github/workflows/cpp.yml'
+ - '.github/workflows/cpp_windows.yml'
- 'ci/conda_env_*'
- 'ci/docker/**'
- 'ci/scripts/ccache_setup.sh'
@@ -44,6 +45,7 @@ on:
paths:
- '.dockerignore'
- '.github/workflows/cpp.yml'
+ - '.github/workflows/cpp_windows.yml'
- 'ci/conda_env_*'
- 'ci/docker/**'
- 'ci/scripts/ccache_setup.sh'
diff --git a/.github/workflows/cpp_windows.yml
b/.github/workflows/cpp_windows.yml
index 3010d89053..0c3498e901 100644
--- a/.github/workflows/cpp_windows.yml
+++ b/.github/workflows/cpp_windows.yml
@@ -72,6 +72,8 @@ jobs:
CMAKE_CXX_STANDARD: "20"
CMAKE_GENERATOR: Ninja
CMAKE_INSTALL_PREFIX: /usr
+ # ccache does not support PDB files
(https://github.com/ccache/ccache/issues/1040)
+ CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: Embedded
CMAKE_UNITY_BUILD: ON
steps:
- name: Disable Crash Dialogs
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
index fc3b3a16d8..0e1da70d20 100644
--- a/.github/workflows/ruby.yml
+++ b/.github/workflows/ruby.yml
@@ -386,6 +386,9 @@ jobs:
CMAKE_CXX_STANDARD: "20"
CMAKE_GENERATOR: Ninja
CMAKE_INSTALL_PREFIX: "${{ github.workspace }}/dist"
+ # ccache does not support PDB files
(https://github.com/ccache/ccache/issues/1040)
+ CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: Embedded
+ CMAKE_UNITY_BUILD: ON
VCPKG_BINARY_SOURCES: 'clear;nugettimeout,600;nuget,GitHub,readwrite'
VCPKG_DEFAULT_TRIPLET: x64-windows
permissions:
diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh
index ce62a5b771..19cfb00c7b 100755
--- a/ci/scripts/cpp_build.sh
+++ b/ci/scripts/cpp_build.sh
@@ -269,6 +269,7 @@ else
-DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-20}" \
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR:-lib} \
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX:-${ARROW_HOME}} \
+
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT:-} \
-DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD:-OFF} \
-DCUDAToolkit_ROOT=${CUDAToolkit_ROOT:-} \
-Dgflags_SOURCE=${gflags_SOURCE:-} \
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake
b/cpp/cmake_modules/SetupCxxFlags.cmake
index 7c02d53e62..21341167fe 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -235,24 +235,6 @@ if(WIN32)
# *
https://developercommunity.visualstudio.com/content/problem/1249671/stdc17-generates-warning-compiling-windowsh.html
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd5105")
- if(ARROW_USE_CCACHE)
- foreach(c_flag
- CMAKE_CXX_FLAGS
- CMAKE_CXX_FLAGS_RELEASE
- CMAKE_CXX_FLAGS_DEBUG
- CMAKE_CXX_FLAGS_MINSIZEREL
- CMAKE_CXX_FLAGS_RELWITHDEBINFO
- CMAKE_C_FLAGS
- CMAKE_C_FLAGS_RELEASE
- CMAKE_C_FLAGS_DEBUG
- CMAKE_C_FLAGS_MINSIZEREL
- CMAKE_C_FLAGS_RELWITHDEBINFO)
- # ccache doesn't work with /Zi.
- # See also: https://github.com/ccache/ccache/issues/1040
- string(REPLACE "/Zi" "/Z7" ${c_flag} "${${c_flag}}")
- endforeach()
- endif()
-
if(ARROW_USE_STATIC_CRT)
foreach(c_flag
CMAKE_CXX_FLAGS