When we build things in cenbuild, we generally don't get any color output from gcc on warnings and errors. This makes it much more difficult to find what's relevant in the compiler output. E.g. in output like this: > $ cbrun x86_64 gcc -Wall -c -o hello.o hello.c > hello.c: In function 'main': > hello.c:3:9: warning: unused variable 'foobar' [-Wunused-variable] > int foobar; Here, "warning" should be in purple, and a number of relevant key words should be bold. The issue seems to be ccache. If I bypass it, then it works: > $ cbrun x86_64 /usr/bin/gcc -Wall -c -o hello.o hello.c It also works when I do linking, which I assume ccache ignores: > $ cbrun x86_64 gcc -Wall -o hello.o hello.c Lastly, it also works when I set GCC_COLORS for some reason: > $ GCC_COLORS=foo cbrun x86_64 gcc -Wall -c -o hello.o hello.c
We run a rather old ccache. A newer version would require a newer gcc, according to bug 7827. However, we are upgrading gcc in bug 8361. I tried the latest ccache using that new compiler, and the issue seems to be gone.
Apparently, that's only part of the problem. "make -O" from bug 7838 also causes gcc to omit colors. This seems to be a well known issue, with hacky workarounds suggested: https://whatofhow.wordpress.com/2014/04/03/gnu-make-4-output-sync/ Ninja also documents this problem: https://github.com/ninja-build/ninja/wiki/FAQ#why-does-my-program-with-colored-output-not-have-color-under-ninja But at the same time, I'm sometimes getting color even with the -O flag. Something odd is going on here.