Skip to content

GH-50388: [C++][CI] Make ccache effective MSVC-based builds#50387

Merged
pitrou merged 2 commits into
apache:mainfrom
pitrou:ci-windows-ccache
Jul 6, 2026
Merged

GH-50388: [C++][CI] Make ccache effective MSVC-based builds#50387
pitrou merged 2 commits into
apache:mainfrom
pitrou:ci-windows-ccache

Conversation

@pitrou

@pitrou pitrou commented Jul 6, 2026

Copy link
Copy Markdown
Member

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, 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:

With this PR:

Are there any user-facing changes?

No.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@github-actions github-actions Bot added the awaiting review Awaiting review label Jul 6, 2026
@pitrou pitrou force-pushed the ci-windows-ccache branch from 2f25ca5 to 925a319 Compare July 6, 2026 09:04
@pitrou pitrou changed the title [CI] Try to debug ccache not ccaching anything on Windows + MSVC DO NOT MERGE [CI] Try to debug ccache not ccaching anything on Windows + MSVC Jul 6, 2026
@pitrou pitrou force-pushed the ci-windows-ccache branch from 925a319 to c2d883d Compare July 6, 2026 09:34
@pitrou pitrou changed the title DO NOT MERGE [CI] Try to debug ccache not ccaching anything on Windows + MSVC GH-50388: [C++][CI] Make ccache effective MSVC-based builds Jul 6, 2026
@pitrou pitrou force-pushed the ci-windows-ccache branch from c2d883d to e641c47 Compare July 6, 2026 10:47
@pitrou pitrou marked this pull request as ready for review July 6, 2026 10:57

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Could you remove

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()
?

@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting review Awaiting review labels Jul 6, 2026
@rok

rok commented Jul 6, 2026

Copy link
Copy Markdown
Member

+1, that is a significant improvement.

@pitrou

pitrou commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

+1

Could you remove

Interesting, I hadn't noticed this piece of CMake code. I assume it wasn't working properly? (perhaps the option was passed as -Zi rather than /Zi?).

Do you think we should set CMAKE_MSVC_DEBUG_INFORMATION_FORMAT in

if(ARROW_USE_CCACHE)
rather than in individual CI config?

@kou

kou commented Jul 6, 2026

Copy link
Copy Markdown
Member

The CMake code worked properly. I think that it's broken when we use CMake 3.25 or later. I think that CMake 3.25 introduced CMAKE_MSVC_DEBUG_INFORMATION_FORMAT and removed /Zi from CMAKE_C{,XX}_FLAGS*.

So we should use CMAKE_MSVC_DEBUG_INFORMATION_FORMAT instead of the existing /Zi -> /Z7 code.

@pitrou pitrou added the CI: Extra: C++ Run extra C++ CI label Jul 6, 2026
@pitrou

pitrou commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

I've enabled the C++ Extra tests to check that it also works on ARM64 Windows.

@pitrou

pitrou commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

Ok, cache is now effective on ARM64 Windows as well.

@pitrou pitrou merged commit ce1915a into apache:main Jul 6, 2026
107 of 112 checks passed
@pitrou pitrou removed the awaiting merge Awaiting merge label Jul 6, 2026
@pitrou pitrou deleted the ci-windows-ccache branch July 6, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants