Bug 1925299 - ccache 4.0 can't handle -fdiagnostics-color/-fcolor-diagnostics
Summary: ccache 4.0 can't handle -fdiagnostics-color/-fcolor-diagnostics
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: ccache
Version: 33
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Michael Cullen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-04 19:54 UTC by Michael Catanzaro
Modified: 2021-10-12 02:32 UTC (History)
3 users (show)

Fixed In Version: ccache-4.2-1.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-10-11 15:52:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Michael Catanzaro 2021-02-04 19:54:58 UTC
After upgrading to ccache-4.0-1.fc33, I can't build WebKit anymore. Looking at my CMakeError.log, all of CMake's feature checks are failing like so:

Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test CXX_COMPILER_SUPPORTS_-Wno-suggest-attribute=format failed with the following output:
Change Dir: /home/mcatanzaro/Projects/WebKit/WebKitBuild/GNOME/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/ninja-build cmTC_79f61 && [1/2] Building CXX object CMakeFiles/cmTC_79f61.dir/src.cxx.o
<command-line>: warning: ISO C++11 requires whitespace after the macro name
[2/2] Linking CXX executable cmTC_79f61
FAILED: cmTC_79f61 
: && /usr/lib64/ccache/c++ -fcolor-diagnostics -Wextra -Wall -Wno-expansion-to-defined -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -g -O0 -fno-strict-aliasing -fno-exceptions -fno-rtti -DCXX_COMPILER_SUPPORTS_-Wno-suggest-attribute=format -L/home/mcatanzaro/Projects/GNOME/install/lib -fuse-ld=gold -Wl,--disable-new-dtags CMakeFiles/cmTC_79f61.dir/src.cxx.o -o cmTC_79f61   && :
c++: error: unrecognized command-line option '-fcolor-diagnostics'
ninja: build stopped: subcommand failed.

The problem is every check fails because CMake passes -fcolor-diagnostics, which is a clang flag. It is guaranteed to fail when passed to GCC. Why is CMake doing this? Looking at my build log, that happens because CMake's check_c_compiler_flag() and check_cxx_compiler_flag() succeed when passed -fcolor-diagonstics. They also fail when -fdiagnostics-color=always is passed. That is telling, because that is a GCC flag that would only fail if passed to clang.

So somehow ccache has gone crazy and decided to use clang instead of GCC when performing some cmake feature tests, then switch back to GCC to perform others. That's wild and I haven't figured out why yet, but downgrading ccache fixes the issue. Something really weird is going on with ccache 4.0.

Comment 1 Michael Catanzaro 2021-02-04 20:12:20 UTC
OK the problem is: https://github.com/ccache/ccache/issues/740. It is already fixed by upstream in ccache 4.2, which is now available. (I see there was an initial attempt to fix this in ccache 4.1, but the fix was insufficient).

Only projects that perform feature tests to check for -fcolor-diagnostics or -fdiagnostics-color would be broken.

Comment 2 Fedora Update System 2021-02-05 02:19:21 UTC
FEDORA-2021-7d5a49984e has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-7d5a49984e

Comment 3 Michael Catanzaro 2021-02-05 15:50:28 UTC
Thanks for the quick response!

Comment 4 Fedora Update System 2021-02-06 02:13:06 UTC
FEDORA-2021-7d5a49984e has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-7d5a49984e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-7d5a49984e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2021-02-12 01:41:40 UTC
FEDORA-2021-7d5a49984e has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Michael Catanzaro 2021-10-06 12:53:27 UTC
Reopening this. It was fixed in ccache-4.2-1.fc33, and stayed fixed in F34, but the bug is back again in ccache-4.2.1-2.fc35:

[32/5586] Building CXX object Source/bmalloc/CMakeFiles/bmalloc.dir/bmalloc/Deallocator.cpp.o
FAILED: Source/bmalloc/CMakeFiles/bmalloc.dir/bmalloc/Deallocator.cpp.o 
/usr/lib64/ccache/c++ -DBUILDING_GTK__=1 -DBUILDING_WITH_CMAKE=1 -DBUILDING_bmalloc -DBWRAP_EXECUTABLE=\"/usr/bin/bwrap\" -DDBUS_PROXY_EXECUTABLE=\"/usr/bin/xdg-dbus-proxy\" -DGETTEXT_PACKAGE=\"WebKit2GTK-4.1\" -DHAVE_CONFIG_H=1 -DJSC_GLIB_API_ENABLED -DWEBKITGTK_API_VERSION_STRING=\"4.1\" -I/home/mcatanzaro/Projects/WebKit/Source/bmalloc -fcolor-diagnostics -Wextra -Wall -Wno-expansion-to-defined -Wno-nonnull -Wno-array-bounds -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -g -O0 -fno-strict-aliasing -fno-exceptions -fno-rtti -O2 -g -DNDEBUG -fPIC -fvisibility=hidden -std=c++17 -MD -MT Source/bmalloc/CMakeFiles/bmalloc.dir/bmalloc/Deallocator.cpp.o -MF Source/bmalloc/CMakeFiles/bmalloc.dir/bmalloc/Deallocator.cpp.o.d -o Source/bmalloc/CMakeFiles/bmalloc.dir/bmalloc/Deallocator.cpp.o -c /home/mcatanzaro/Projects/WebKit/Source/bmalloc/bmalloc/Deallocator.cpp
c++: error: unrecognized command-line option ‘-fcolor-diagnostics’

That is ccache trying to pass the clang-specific -fcolor-diagnostics flag to GCC. As a workaround, I have uninstalled ccache.

My guess is that 4.2 is good and 4.2.1 is bad. Looking at suspicious commits between those ranges, I found this one:

https://github.com/ccache/ccache/commit/97a40af49f56e4be2db5e4318d8131e937bd5598#diff-d294680506e79f67b7538b1eb162b58cf8f0c1a66f06d52db43179d69a995a42

Comment 7 Michael Catanzaro 2021-10-11 15:52:43 UTC
Er, can't reproduce today after deleting ~/.ccache. My guess is that it is failing to handle upgrades gracefully. Probably not worth keeping this bug open if the fix is that simple.

Comment 8 Orion Poplawski 2021-10-12 02:32:40 UTC
I would file upstream if this remains a persistent issue.


Note You need to log in before you can comment on or make changes to this bug.