-
Notifications
You must be signed in to change notification settings - Fork 455
Disable ccache by default for versions older than 3.4.3 #1029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but one recommended tweak. Good job on tracking this back to an actual CCache bug.
build/cmake/CCache.cmake
Outdated
@@ -12,11 +12,29 @@ | |||
find_program (CCACHE_EXECUTABLE ccache) | |||
if (CCACHE_EXECUTABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend adding AND NOT DEFINED MONGO_USE_CCACHE
so that this branch only executes the first time and only if the user hasn't already provided a setting. This also prevents the message() from printing multiple times and possibly not reflecting the value that the user has set.
build/cmake/CCache.cmake
Outdated
) | ||
|
||
# Assume `ccache --version` mentions a simple version string, e.g. 1.2.3 | ||
set (SIMPLE_SEMVER_REGEX "([0-9]+)\.([0-9]+)\.([0-9]+)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not always a valid assumption. For instance, on Debian stable, here is the output of ccache --version
:
root@build01:~# ccache --version
ccache version 4.2
Copyright (C) 2002-2007 Andrew Tridgell
Copyright (C) 2009-2021 Joel Rosdahl and other contributors
See <https://ccache.dev/credits.html> for a complete list of contributors.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good info, thank you. Adjusted the regex to permit omission of the patch number. Also included a CMake warning message to report when version string assumptions are violated so that the need for adjustments can be more easily detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (NOT DEFINED MONGO_USE_CCACHE) | ||
find_program (CCACHE_EXECUTABLE ccache) | ||
if (CCACHE_EXECUTABLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The find_program
needs to occur in case that USE_CCACHE
is TRUE
before CCACHE_EXECUTABLE
has been set. The find_program()
call is already cache-aware and will be a no-op if the variable is already set to a truth-y value (i.e. has already been set or successfully found).
if (NOT DEFINED MONGO_USE_CCACHE) | |
find_program (CCACHE_EXECUTABLE ccache) | |
if (CCACHE_EXECUTABLE) | |
if (CCACHE_EXECUTABLE AND NOT DEFINED MONGO_USE_CCACHE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, my mistake. Followup in #1031.
endif (CCACHE_EXECUTABLE) | ||
endif (NOT DEFINED MONGO_USE_CCACHE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endif (CCACHE_EXECUTABLE) | |
endif (NOT DEFINED MONGO_USE_CCACHE) | |
endif () |
(To match the other suggestion)
This reverts commit f55cc6a.
Description
This PR addresses the "ccache.conf: No such file or directory" spurious failures on Evergreen by conditionally disabling ccache by default given the detected ccache version is older than 3.4.3.
After further investigation, I found this issue thread which documented the same spurious failure being observed on Evergreen. Thread participants deduced the cause to be ccache being invoked in parallel, "which is problematic because ccache creates its configuration in
$HOME/.ccache/ccache.conf
on first run, but in non-atomic way, which breaks with error". This issue was then reported and subsequently patched in ccache version 3.4.3.As of time of writing, this condition to disable ccache by default should only affect Evergreen tests being run on the Ubuntu 18.04 variant, which uses ccache version 3.4.1.