Skip to content

Commit ce1915a

Browse files
authored
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](ccache/ccache#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 <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 9f55c8d commit ce1915a

5 files changed

Lines changed: 8 additions & 18 deletions

File tree

.github/workflows/cpp.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
paths:
2828
- '.dockerignore'
2929
- '.github/workflows/cpp.yml'
30+
- '.github/workflows/cpp_windows.yml'
3031
- 'ci/conda_env_*'
3132
- 'ci/docker/**'
3233
- 'ci/scripts/ccache_setup.sh'
@@ -44,6 +45,7 @@ on:
4445
paths:
4546
- '.dockerignore'
4647
- '.github/workflows/cpp.yml'
48+
- '.github/workflows/cpp_windows.yml'
4749
- 'ci/conda_env_*'
4850
- 'ci/docker/**'
4951
- 'ci/scripts/ccache_setup.sh'

.github/workflows/cpp_windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ jobs:
7272
CMAKE_CXX_STANDARD: "20"
7373
CMAKE_GENERATOR: Ninja
7474
CMAKE_INSTALL_PREFIX: /usr
75+
# ccache does not support PDB files (https://github.com/ccache/ccache/issues/1040)
76+
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: Embedded
7577
CMAKE_UNITY_BUILD: ON
7678
steps:
7779
- name: Disable Crash Dialogs

.github/workflows/ruby.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ jobs:
386386
CMAKE_CXX_STANDARD: "20"
387387
CMAKE_GENERATOR: Ninja
388388
CMAKE_INSTALL_PREFIX: "${{ github.workspace }}/dist"
389+
# ccache does not support PDB files (https://github.com/ccache/ccache/issues/1040)
390+
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT: Embedded
391+
CMAKE_UNITY_BUILD: ON
389392
VCPKG_BINARY_SOURCES: 'clear;nugettimeout,600;nuget,GitHub,readwrite'
390393
VCPKG_DEFAULT_TRIPLET: x64-windows
391394
permissions:

ci/scripts/cpp_build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ else
269269
-DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-20}" \
270270
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR:-lib} \
271271
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX:-${ARROW_HOME}} \
272+
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT:-} \
272273
-DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD:-OFF} \
273274
-DCUDAToolkit_ROOT=${CUDAToolkit_ROOT:-} \
274275
-Dgflags_SOURCE=${gflags_SOURCE:-} \

cpp/cmake_modules/SetupCxxFlags.cmake

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,24 +235,6 @@ if(WIN32)
235235
# * https://developercommunity.visualstudio.com/content/problem/1249671/stdc17-generates-warning-compiling-windowsh.html
236236
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd5105")
237237

238-
if(ARROW_USE_CCACHE)
239-
foreach(c_flag
240-
CMAKE_CXX_FLAGS
241-
CMAKE_CXX_FLAGS_RELEASE
242-
CMAKE_CXX_FLAGS_DEBUG
243-
CMAKE_CXX_FLAGS_MINSIZEREL
244-
CMAKE_CXX_FLAGS_RELWITHDEBINFO
245-
CMAKE_C_FLAGS
246-
CMAKE_C_FLAGS_RELEASE
247-
CMAKE_C_FLAGS_DEBUG
248-
CMAKE_C_FLAGS_MINSIZEREL
249-
CMAKE_C_FLAGS_RELWITHDEBINFO)
250-
# ccache doesn't work with /Zi.
251-
# See also: https://github.com/ccache/ccache/issues/1040
252-
string(REPLACE "/Zi" "/Z7" ${c_flag} "${${c_flag}}")
253-
endforeach()
254-
endif()
255-
256238
if(ARROW_USE_STATIC_CRT)
257239
foreach(c_flag
258240
CMAKE_CXX_FLAGS

0 commit comments

Comments
 (0)