ccache 4.0 parses the command line and scans for options such as "-fcolor-diagnostics" (and a lot of other stuff, c.f., https://github.com/ccache/ccache/blob/v4.0/src/argprocessing.cpp#L217 and importantly https://github.com/ccache/ccache/blob/v4.0/src/argprocessing.cpp#L690 ) This makes sense in general, since ccache supports a multitude of compilers, and while -fcolor-diagnostics is a proper flag for clang, it isn't for GCC. The downside of that is that the flags are mangled. For instance, ccache silently replaces the given -fcolor-diagnostics flags in its actual compilation step with the (supported by GCC) -fdiagnostics-color flag. As a concrete example of breakage: compiler checks like in net-libs/webkit-gtk-2.28.4 that EXPLICITLY check if the compiler supports -fcolor-diagnostics are masked, the check succeeds wrongly, the flag is added to the global C(XX)FLAGS and everything breaks. You should be able the easily reproduce this issue with the MWE provided here, but another, even easier way is to try to configure net-libs/webkit-gtk with GCC as your system compiler and ccache 4.0 in use. This is just one example, though, the actual problem can occur otherwise as well (obviously). It looks like this a regression in ccache 4.0 and hasn't been the case in the 3.x series. When running the MWE, make sure that such an object is not cached (because that bypasses actual compiler invocation, naturally). Also, do NOT use CCACHE_DISABLE=1, because this disables ccache's mangling and won't reproduce the problem. Reproducible: Always Steps to Reproduce: MWE: # cat src.c int main(void) { return 0; } # /usr/bin/x86_64-pc-linux-gnu-gcc -c -fcolor-diagnostics src.c -o /tmp/blargh x86_64-pc-linux-gnu-gcc: error: unrecognized command line option ‘-fcolor-diagnostics’ # CCACHE_LOGFILE=/tmp/ccache.log /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc -c -fcolor-diagnostics src.c -o /tmp/blargh [no output, so the command succeeded] # cat /tmp/ccache.log [will be attached to this bug report] Actual Results: Compile step succeeds when wrapped in ccache. Expected Results: Compile step should fail.
Created attachment 668813 [details] /tmp/ccache.log
Adding maintainer to CC.
Isn't the real issue here that net-libs/webkit-gtk-2.28.4 performs the check with one compiler (ccache + gcc in this case) then performs the actual build with a different compiler (gcc)?
(In reply to Andrei Slavoiu from comment #3) > Isn't the real issue here that net-libs/webkit-gtk-2.28.4 performs the check > with one compiler (ccache + gcc in this case) then performs the actual build > with a different compiler (gcc)? You could think so, but no. webkit-gtk is actually using the ccache-wrapped compiler all the way. I explicitly mentioned the compile-but-not-link mode, since *normal* compilation fails correctly, even with ccache 4.0: # /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc -fcolor-diagnostics /tmp/src.c -o /tmp/blargh x86_64-pc-linux-gnu-gcc: error: unrecognized command line option ‘-fcolor-diagnostics’ Weirdly, it only wrongly succeeds when using the -c compiler flag.
> Steps to Reproduce: > MWE: > # cat src.c > int main(void) { return 0; } > # /usr/bin/x86_64-pc-linux-gnu-gcc -c -fcolor-diagnostics src.c -o > /tmp/blargh > x86_64-pc-linux-gnu-gcc: error: unrecognized command line option > ‘-fcolor-diagnostics’ > /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc > -c -fcolor-diagnostics src.c -o /tmp/blargh > [no output, so the command succeeded] Yeah, that's an unfortunate breakage. Filed as https://github.com/ccache/ccache/issues/711
Created attachment 669296 [details, diff] webkit-gtk-2.28.4-ccache-nocolor.patch Meanwhile webkit-gtk-2.28.4-ccache-nocolor.patch is a workaround not to inject potentially unsupported diagnostics flags.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7158e6d5be786b4e656beea266330943fe2243d1 commit 7158e6d5be786b4e656beea266330943fe2243d1 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2020-11-22 20:57:12 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2020-11-22 20:57:23 +0000 dev-util/ccache: bump up to 4.1 Among other things it should fix inconsistent handling of `-fcolor-diagnostics` in compiler and linker drivers noticed by Mihai Moldovan. Closes: https://bugs.gentoo.org/751463 Package-Manager: Portage-3.0.10, Repoman-3.0.2 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> dev-util/ccache/Manifest | 1 + dev-util/ccache/ccache-4.1.ebuild | 108 +++++++++++++++++++++ dev-util/ccache/files/ccache-4.1-atomic.patch | 23 +++++ .../ccache/files/ccache-4.1-avoid-run-user.patch | 18 ++++ 4 files changed, 150 insertions(+)